X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FConsole%2FExecutor.cc;h=1cff22101130fa0364e5a7355887765a487540bc;hb=57daeae6f2e924ce3f16f9677c3474f531cba9e5;hp=ce2376f5403c97f2e0859683aae830db76372ba4;hpb=b0918b010bd5ebfb4cce6900c6889dbe4767b5f3;p=senf.git diff --git a/senf/Utils/Console/Executor.cc b/senf/Utils/Console/Executor.cc index ce2376f..1cff221 100644 --- a/senf/Utils/Console/Executor.cc +++ b/senf/Utils/Console/Executor.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -35,10 +35,11 @@ #include #include #include "Server.hh" +#include "senf/Utils/IgnoreValue.hh" //#include "Executor.mpp" #define prefix_ -///////////////////////////////cc.p//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// namespace { @@ -48,16 +49,16 @@ namespace { return token.value(); } }; - + } -/////////////////////////////////////////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::console::Executor prefix_ senf::console::DirectoryNode & senf::console::Executor::cwd() const { - SENF_ASSERT( ! cwd_.empty() ); + SENF_ASSERT( ! cwd_.empty(), "Internal error: CWD history empty ?" ); while (cwd_.size()>1 && (cwd_.back().expired() || ! cwd_.back().lock()->active())) cwd_.pop_back(); return * cwd_.back().lock(); @@ -68,7 +69,7 @@ prefix_ std::string senf::console::Executor::cwdPath() { if (skipping()) return ""; - (void) cwd(); // ensure, cwd is live. + senf::IGNORE( cwd() ); // ensure, cwd is live. return "/" + senf::stringJoin( senf::make_transform_range( boost::make_iterator_range(boost::next(cwd_.begin()), cwd_.end()), @@ -82,11 +83,11 @@ prefix_ void senf::console::Executor::execute(std::ostream & output, SENF_LOG(( "Executing: " << command )); if (! skipping()) - (void) cwd(); // Prune the cwd path of expired entries + senf::IGNORE( cwd() ); // Prune the cwd path of expired entries try { switch(command.builtin()) { - case ParseCommandInfo::NoBuiltin : + case ParseCommandInfo::NoBuiltin : if (skipping()) return; exec(output, command); @@ -104,7 +105,7 @@ prefix_ void senf::console::Executor::execute(std::ostream & output, "'cd' cannot be skipped (don't use 'cd' in conf-files)"); } break; - + case ParseCommandInfo::BuiltinLS : if (skipping()) break; @@ -133,12 +134,12 @@ prefix_ void senf::console::Executor::execute(std::ostream & output, else exec(output, command); break; - + case ParseCommandInfo::BuiltinPOPD : // The parser ensures, we have no arguments popd(); break; - + case ParseCommandInfo::BuiltinEXIT : if (skipping()) break; @@ -231,7 +232,7 @@ prefix_ void senf::console::Executor::cd(ParseCommandInfo::TokensRange dir) { if (dir.size() == 1 && *dir.begin() == WordToken("-")) { cwd_.swap(oldCwd_); - (void) cwd(); // Prune any expired items + senf::IGNORE( cwd() ); // Prune any expired items } else { // We need to use a temporary so an error somewhere while traversing the dir does not cause @@ -286,7 +287,7 @@ namespace { typedef std::map NodesMap; - void dolr(std::ostream & output, unsigned width, NodesMap & nodes, std::string const & base, + void dolr(std::ostream & output, unsigned width, NodesMap & nodes, std::string const & base, unsigned level, senf::console::DirectoryNode & node) { boost::format fmt ("%s%s%s %|" BOOST_PP_STRINGIZE(HELP_COLUMN) "t|%s\n"); @@ -300,7 +301,7 @@ namespace { NodesMap::iterator j (nodes.find(&subnode)); if (j == nodes.end()) { output << fmt - % pad % i->first + % pad % i->first % ( i->second->isDirectory() ? "/" : i->second->isLink() ? "@" : "" ) % i->second->shorthelp().substr(0,width); std::string subbase (base); @@ -310,12 +311,12 @@ namespace { nodes.insert(std::make_pair(&subnode, subbase)); dolr(output, width, nodes, subbase, level+1, subnode); } else - output << pad << i->first + output << pad << i->first << ( i->second->isDirectory() ? "/" : i->second->isLink() ? "@" : "" ) << " -> " << j->second << "\n"; } else { output << fmt - % pad % i->first + % pad % i->first % ( i->second->isDirectory() ? "/" : i->second->isLink() ? "@" : "" ) % i->second->shorthelp().substr(0,width); } @@ -331,7 +332,7 @@ prefix_ void senf::console::Executor::lr(std::ostream & output, traverseDirectory(path, dir); DirectoryNode & node (*dir.back().lock()); NodesMap nodes; - dolr(output, senf::console::Client::getWidth(output, 80u, 60u)-(HELP_COLUMN+1), + dolr(output, senf::console::Client::getWidth(output, 80u, 60u)-(HELP_COLUMN+1), nodes, "", 0, node); } @@ -470,7 +471,7 @@ prefix_ void senf::console::senf_console_format_value(DirectoryNode::ptr value, os << ""; } -///////////////////////////////cc.e//////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// #undef prefix_ //#include "Executor.mpp"