#include "shell.hpp" // print a list of entries in the curent directory. // resolve symbolic links, and mark directories with / void shell::c_ls (std::string args) { // get the list std::vector entries = cwd_.list (); // iterate over children for ( std::size_t i = 0; i < entries.size (); ++i ) { std::string entry (entries[i].get_string ()); std::cout << " " << entry; // check if child is directory, mark it if ( cwd_.is_dir (saga::url(entry)) ) { std::cout << "/"; } // if child is link, print link target if ( cwd_.is_link (saga::url(entry)) ) { std::cout << " -> " << cwd_.read_link (entry); } std::cout << std::endl; // FIXME: more could be done here, e.g. checking for file // sizes, recursive listings etc. That is left as an // excercise to the reader ;-) } // that's it! return; }