#include "shell.hpp" // list all known replicas on a logical file void shell::c_log_find (std::string args) { std::string pattern = args; std::string rest = args; std::vector keyvals; // search for the name pattern (first argument) if ( pattern.length () > 0 ) { size_t idx = args.find (" "); if ( idx != 0 && idx != std::string::npos ) { pattern.erase (idx); rest.erase (0, idx + 1); } } // search for more args which are all used as key=val pattern if ( rest.length () > 0 ) { size_t idx = args.find (" "); std::string pat = args; while ( idx != 0 && idx != std::string::npos ) { // trim this match pat.erase (idx); rest.erase (0, idx + 1); // remember this match keyvals.push_back (pat); // search next idx = args.find (" "); } } // open the current directory as logical dir saga::logical_file::logical_directory dir (cwd_.get_url ()); std::vector list = dir.find (pattern, keyvals); std::cout << std::endl; // iterate over replica locations for ( std::size_t i = 0; i < list.size (); ++i ) { std::cout << " " << list[i].get_string () << std::endl; } std::cout << std::endl; return; }