void print_dir(inode_state& state) { cout << pathname(state.get_contents().at("."), state.get_root()->get_inode_nr()) << ":" << endl; for(auto elem : state.get_contents()) { cout << "\t" << elem.second->get_inode_nr() << " " << elem.second->size() << " " << elem.first << " " << endl; } cout << endl; }
//DONEDONEDONEDONEDONEDONEDONE/////////////////////////////////////// void fn_ls (inode_state& state, const wordvec& words){ bool r = false; string orig = pathname(state.get_contents().at("."), state.get_root()->get_inode_nr()); if (words.size() > 1) { for(auto word = words.begin()+1; word != words.end(); word++) { if((*word)[0] == '/') r = true; state.set_cwd(split(*word,"/"), r); print_dir(state); state.set_cwd(split(orig,"/"),true); } } else print_dir(state); DEBUGF ('c', state); DEBUGF ('c', words); }