switched output from std::cerr to std::cout....

now you can run ./retroshare-nogui 2> /dev/null
  to get a usable terminal rs console.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5391 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-08-08 09:23:26 +00:00
parent db35ae95af
commit fa65173171
2 changed files with 137 additions and 137 deletions

View File

@ -51,8 +51,8 @@ uint32_t MenuInterface::process(char key)
{ {
#ifdef MENU_DEBUG #ifdef MENU_DEBUG
std::cerr << "MenuInterface::process(" << key << ")"; std::cout << "MenuInterface::process(" << key << ")";
std::cerr << std::endl; std::cout << std::endl;
#endif // MENU_DEBUG #endif // MENU_DEBUG
/* call process on current menu */ /* call process on current menu */
@ -62,8 +62,8 @@ uint32_t MenuInterface::process(char key)
bool showHelp = false; bool showHelp = false;
#ifdef MENU_DEBUG #ifdef MENU_DEBUG
std::cerr << "MenuInterface::process() currentMenu says: " << rt; std::cout << "MenuInterface::process() currentMenu says: " << rt;
std::cerr << std::endl; std::cout << std::endl;
#endif // MENU_DEBUG #endif // MENU_DEBUG
switch(rt) switch(rt)
@ -92,15 +92,15 @@ uint32_t MenuInterface::process(char key)
/* new menu to switch to */ /* new menu to switch to */
if (mCurrentMenu->selectedMenu()) if (mCurrentMenu->selectedMenu())
{ {
std::cerr << "MenuInterface::process() Switching Menus"; std::cout << "MenuInterface::process() Switching Menus";
std::cerr << std::endl; std::cout << std::endl;
mCurrentMenu = mCurrentMenu->selectedMenu(); mCurrentMenu = mCurrentMenu->selectedMenu();
} }
else else
{ {
std::cerr << "MenuInterface::process() ERROR"; std::cout << "MenuInterface::process() ERROR";
std::cerr << " SelectedMenu == NULL"; std::cout << " SelectedMenu == NULL";
std::cerr << std::endl; std::cout << std::endl;
} }
break; break;
@ -123,7 +123,7 @@ uint32_t MenuInterface::process(char key)
/* HEADER */ /* HEADER */
for(int i = 0; i < 20; i++) for(int i = 0; i < 20; i++)
{ {
std::cerr << std::endl; std::cout << std::endl;
} }
/* ERROR */ /* ERROR */
@ -145,10 +145,10 @@ uint32_t MenuInterface::process(char key)
uint32_t MenuInterface::drawHeader() uint32_t MenuInterface::drawHeader()
{ {
std::cerr << "======================================================="; std::cout << "=======================================================";
std::cerr << std::endl; std::cout << std::endl;
std::cerr << "Retroshare Terminal Menu V2.xxxx ======================"; std::cout << "Retroshare Terminal Menu V2.xxxx ======================";
std::cerr << std::endl; std::cout << std::endl;
unsigned int nTotal = 0; unsigned int nTotal = 0;
unsigned int nConnected = 0; unsigned int nConnected = 0;
@ -200,18 +200,18 @@ uint32_t MenuInterface::drawHeader()
float upKb = 0; float upKb = 0;
rsicontrol -> ConfigGetDataRates(downKb, upKb); rsicontrol -> ConfigGetDataRates(downKb, upKb);
std::cerr << "Friends " << nConnected << "/" << nTotal; std::cout << "Friends " << nConnected << "/" << nTotal;
std::cerr << " Network: " << natState; std::cout << " Network: " << natState;
std::cerr << std::endl; std::cout << std::endl;
std::cerr << "Down: " << downKb << " (kB/s) "; std::cout << "Down: " << downKb << " (kB/s) ";
std::cerr << " Up: " << upKb << " (kB/s) "; std::cout << " Up: " << upKb << " (kB/s) ";
std::cerr << std::endl; std::cout << std::endl;
std::cerr << "Menu State: "; std::cout << "Menu State: ";
tailrec_printparents(mCurrentMenu, std::cerr); tailrec_printparents(mCurrentMenu, std::cout);
std::cerr << std::endl; std::cout << std::endl;
std::cerr << "======================================================="; std::cout << "=======================================================";
std::cerr << std::endl; std::cout << std::endl;
return 1; return 1;
} }
@ -241,8 +241,8 @@ int Menu::addMenuItem(char key, Menu *child)
it = mChildren.find(key); it = mChildren.find(key);
if (it != mChildren.end()) if (it != mChildren.end())
{ {
std::cerr << "Menu::addMenuItem() ERROR DUPLICATE MENU ITEM"; std::cout << "Menu::addMenuItem() ERROR DUPLICATE MENU ITEM";
std::cerr << std::endl; std::cout << std::endl;
return 0; return 0;
} }
mChildren[key] = child; mChildren[key] = child;
@ -337,23 +337,23 @@ uint32_t Menu::process_children(char key)
uint32_t Menu::drawPage() uint32_t Menu::drawPage()
{ {
std::cerr << "Universal Commands ( "; std::cout << "Universal Commands ( ";
std::cerr << (char) MENU_KEY_QUIT << ":Quit "; std::cout << (char) MENU_KEY_QUIT << ":Quit ";
std::cerr << (char) MENU_KEY_HELP << ":Help "; std::cout << (char) MENU_KEY_HELP << ":Help ";
std::cerr << (char) MENU_KEY_TOP << ":Top "; std::cout << (char) MENU_KEY_TOP << ":Top ";
std::cerr << (char) MENU_KEY_UP << ":Up "; std::cout << (char) MENU_KEY_UP << ":Up ";
std::cerr << ")"; std::cout << ")";
std::cerr << std::endl; std::cout << std::endl;
std::cerr << "Specific Commands ("; std::cout << "Specific Commands (";
std::map<uint8_t, Menu *>::iterator it; std::map<uint8_t, Menu *>::iterator it;
for(it = mChildren.begin(); it != mChildren.end(); it++) for(it = mChildren.begin(); it != mChildren.end(); it++)
{ {
std::cerr << (char) it->first << ":"; std::cout << (char) it->first << ":";
std::cerr << it->second->ShortFnDesc() << " "; std::cout << it->second->ShortFnDesc() << " ";
} }
std::cerr << ")"; std::cout << ")";
std::cerr << std::endl; std::cout << std::endl;
return 1; return 1;
} }
@ -361,25 +361,25 @@ uint32_t Menu::drawPage()
uint32_t Menu::drawHelpPage() uint32_t Menu::drawHelpPage()
{ {
std::cerr << "Menu Help: Universal Commands are:"; std::cout << "Menu Help: Universal Commands are:";
std::cerr << std::endl; std::cout << std::endl;
std::cerr << "\tKey: " << (char) MENU_KEY_QUIT << " => Quit"; std::cout << "\tKey: " << (char) MENU_KEY_QUIT << " => Quit";
std::cerr << std::endl; std::cout << std::endl;
std::cerr << "\tKey: " << (char) MENU_KEY_HELP << " => Help"; std::cout << "\tKey: " << (char) MENU_KEY_HELP << " => Help";
std::cerr << std::endl; std::cout << std::endl;
std::cerr << "\tKey: " << (char) MENU_KEY_TOP << " => Top Menu"; std::cout << "\tKey: " << (char) MENU_KEY_TOP << " => Top Menu";
std::cerr << std::endl; std::cout << std::endl;
std::cerr << "\tKey: " << (char) MENU_KEY_UP << " => Up a Menu"; std::cout << "\tKey: " << (char) MENU_KEY_UP << " => Up a Menu";
std::cerr << std::endl; std::cout << std::endl;
std::cerr << "Specific Commands are:"; std::cout << "Specific Commands are:";
std::cerr << std::endl; std::cout << std::endl;
std::map<uint8_t, Menu *>::iterator it; std::map<uint8_t, Menu *>::iterator it;
for(it = mChildren.begin(); it != mChildren.end(); it++) for(it = mChildren.begin(); it != mChildren.end(); it++)
{ {
std::cerr << "\tKey: " << (char) it->first << " => "; std::cout << "\tKey: " << (char) it->first << " => ";
std::cerr << it->second->ShortFnDesc(); std::cout << it->second->ShortFnDesc();
std::cerr << std::endl; std::cout << std::endl;
} }
return 1; return 1;
@ -395,18 +395,18 @@ uint32_t MenuList::drawPage()
{ {
Menu::drawPage(); Menu::drawPage();
std::cerr << "Navigation Commands ("; std::cout << "Navigation Commands (";
//std::cerr << (char) MENULIST_KEY_LIST << ":List "; //std::cout << (char) MENULIST_KEY_LIST << ":List ";
std::cerr << (char) MENULIST_KEY_NEXT << ":Next "; std::cout << (char) MENULIST_KEY_NEXT << ":Next ";
std::cerr << (char) MENULIST_KEY_PREV << ":Prev "; std::cout << (char) MENULIST_KEY_PREV << ":Prev ";
std::cerr << ")"; std::cout << ")";
std::cerr << std::endl; std::cout << std::endl;
std::cerr << "MenuList::Internals "; std::cout << "MenuList::Internals ";
std::cerr << "ListSize: " << getListCount(); std::cout << "ListSize: " << getListCount();
std::cerr << " SelectIdx: " << mSelectIdx; std::cout << " SelectIdx: " << mSelectIdx;
std::cerr << " Cursor: " << mCursor; std::cout << " Cursor: " << mCursor;
std::cerr << std::endl; std::cout << std::endl;
int i = 0; int i = 0;
@ -420,28 +420,28 @@ uint32_t MenuList::drawPage()
if (mSelectIdx >= 0) if (mSelectIdx >= 0)
{ {
std::cerr << "Current Selection Idx: " << mSelectIdx << " : "; std::cout << "Current Selection Idx: " << mSelectIdx << " : ";
std::string desc; std::string desc;
if (getEntryDesc(mSelectIdx, desc) & (desc != "")) if (getEntryDesc(mSelectIdx, desc) & (desc != ""))
{ {
std::cerr << desc; std::cout << desc;
} }
else else
{ {
std::cerr << "Missing Description"; std::cout << "Missing Description";
} }
std::cerr << std::endl; std::cout << std::endl;
} }
else else
{ {
std::cerr << "No Current Selection: Use 0 - 9 to choose an Entry"; std::cout << "No Current Selection: Use 0 - 9 to choose an Entry";
std::cerr << std::endl; std::cout << std::endl;
} }
std::cerr << "Showing " << startCount; std::cout << "Showing " << startCount;
std::cerr << " to " << endCount << " of " << listCount << " Entries"; std::cout << " to " << endCount << " of " << listCount << " Entries";
std::cerr << std::endl; std::cout << std::endl;
std::list<std::string>::iterator it; std::list<std::string>::iterator it;
for (it = mList.begin(); it != mList.end(); it++, i++) for (it = mList.begin(); it != mList.end(); it++, i++)
@ -451,23 +451,23 @@ uint32_t MenuList::drawPage()
{ {
if (i == mSelectIdx) if (i == mSelectIdx)
{ {
std::cerr << "SELECTED => (" << curIdx << ") "; std::cout << "SELECTED => (" << curIdx << ") ";
} }
else else
{ {
std::cerr << "\t(" << curIdx << ") "; std::cout << "\t(" << curIdx << ") ";
} }
std::string desc; std::string desc;
if (getEntryDesc(i, desc) & (desc != "")) if (getEntryDesc(i, desc) & (desc != ""))
{ {
std::cerr << desc; std::cout << desc;
} }
else else
{ {
std::cerr << *it << " => "; std::cout << *it << " => ";
std::cerr << "Missing Description"; std::cout << "Missing Description";
} }
std::cerr << std::endl; std::cout << std::endl;
} }
} }
@ -478,23 +478,23 @@ uint32_t MenuList::drawHelpPage()
{ {
Menu::drawPage(); Menu::drawPage();
std::cerr << "MenuList Help: Navigation Commands are:"; std::cout << "MenuList Help: Navigation Commands are:";
std::cerr << std::endl; std::cout << std::endl;
//std::cerr << "\tKey: " << (char) MENULIST_KEY_LIST << " => List"; //std::cout << "\tKey: " << (char) MENULIST_KEY_LIST << " => List";
//std::cerr << std::endl; //std::cout << std::endl;
std::cerr << "\tKey: " << (char) MENULIST_KEY_NEXT << " => Next Page"; std::cout << "\tKey: " << (char) MENULIST_KEY_NEXT << " => Next Page";
std::cerr << std::endl; std::cout << std::endl;
std::cerr << "\tKey: " << (char) MENULIST_KEY_PREV << " => Prev Page"; std::cout << "\tKey: " << (char) MENULIST_KEY_PREV << " => Prev Page";
std::cerr << std::endl; std::cout << std::endl;
std::cerr << "MenuList::drawPage() Internal Details"; std::cout << "MenuList::drawPage() Internal Details";
std::cerr << std::endl; std::cout << std::endl;
std::cerr << "List Size: " << getListCount(); std::cout << "List Size: " << getListCount();
std::cerr << std::endl; std::cout << std::endl;
std::cerr << "SelectIdx: " << mSelectIdx; std::cout << "SelectIdx: " << mSelectIdx;
std::cerr << std::endl; std::cout << std::endl;
std::cerr << "Cursor: " << mCursor; std::cout << "Cursor: " << mCursor;
std::cerr << std::endl; std::cout << std::endl;
return 1; return 1;
} }
@ -584,13 +584,13 @@ uint32_t MenuList::list_process(char key)
if (mCursor + idx < getListCount()) if (mCursor + idx < getListCount())
{ {
mSelectIdx = mCursor + idx; mSelectIdx = mCursor + idx;
std::cerr << "MenuList::list_process() Selected Idx: " << mSelectIdx; std::cout << "MenuList::list_process() Selected Idx: " << mSelectIdx;
std::cerr << std::endl; std::cout << std::endl;
} }
else else
{ {
std::cerr << "MenuList::list_process() Idx Out of Range"; std::cout << "MenuList::list_process() Idx Out of Range";
std::cerr << std::endl; std::cout << std::endl;
} }
return MENU_PROCESS_DONE; /* ready for next key stroke */ return MENU_PROCESS_DONE; /* ready for next key stroke */
@ -717,14 +717,14 @@ uint32_t MenuOpLineInput::op()
uint32_t MenuOpLineInput::process_lines(std::string input) uint32_t MenuOpLineInput::process_lines(std::string input)
{ {
std::cerr << "MenuOpLineInput::process_lines() => SHOULD BE OVERLOADED"; std::cout << "MenuOpLineInput::process_lines() => SHOULD BE OVERLOADED";
std::cerr << "Input Was: "; std::cout << "Input Was: ";
std::cerr << std::endl; std::cout << std::endl;
std::cerr << "=================================================="; std::cout << "==================================================";
std::cerr << std::endl; std::cout << std::endl;
std::cerr << input; std::cout << input;
std::cerr << "=================================================="; std::cout << "==================================================";
std::cerr << std::endl; std::cout << std::endl;
return MENU_PROCESS_ERROR; return MENU_PROCESS_ERROR;
} }
@ -746,12 +746,12 @@ uint32_t MenuOpLineInput::process(char key)
case MENU_PROCESS_NEEDDATA: case MENU_PROCESS_NEEDDATA:
break; break;
case MENU_PROCESS_ERROR: case MENU_PROCESS_ERROR:
std::cerr << "MenuOpLineInput::process() => ERROR"; std::cout << "MenuOpLineInput::process() => ERROR";
std::cerr << std::endl; std::cout << std::endl;
case MENU_PROCESS_DONE: case MENU_PROCESS_DONE:
/* cleanup for next command */ /* cleanup for next command */
std::cerr << "MenuOpLineInput::process() Clearing Buffer"; std::cout << "MenuOpLineInput::process() Clearing Buffer";
std::cerr << std::endl; std::cout << std::endl;
mInput.clear(); mInput.clear();
/* go back to parent menu */ /* go back to parent menu */

View File

@ -186,16 +186,16 @@ int MenuListTransfer::getEntryDesc(int idx, std::string &desc)
std::string hash; std::string hash;
if (!getListEntry(idx, hash)) if (!getListEntry(idx, hash))
{ {
std::cerr << "MenuListTransfer::getEntryDesc() No ListEntry"; std::cout << "MenuListTransfer::getEntryDesc() No ListEntry";
std::cerr << std::endl; std::cout << std::endl;
return 0; return 0;
} }
FileInfo info; FileInfo info;
if (!rsFiles->FileDetails(hash, RS_FILE_HINTS_DOWNLOAD, info)) if (!rsFiles->FileDetails(hash, RS_FILE_HINTS_DOWNLOAD, info))
{ {
std::cerr << "MenuListTransfer::getEntryDesc() No FileDetails"; std::cout << "MenuListTransfer::getEntryDesc() No FileDetails";
std::cerr << std::endl; std::cout << std::endl;
return 0; return 0;
} }
@ -302,9 +302,9 @@ int MenuListSearch::getCurrentSearchId(uint32_t &id)
int MenuListSearch::storeSearch(uint32_t searchId, std::string match_string) int MenuListSearch::storeSearch(uint32_t searchId, std::string match_string)
{ {
std::cerr << "MenuListSearch::storeSearch(" << searchId << " => "; std::cout << "MenuListSearch::storeSearch(" << searchId << " => ";
std::cerr << match_string; std::cout << match_string;
std::cerr << std::endl; std::cout << std::endl;
std::string strSearchId; std::string strSearchId;
rs_sprintf(strSearchId, "%lu", searchId); rs_sprintf(strSearchId, "%lu", searchId);
@ -318,8 +318,8 @@ int MenuListSearch::storeSearch(uint32_t searchId, std::string match_string)
int MenuListSearch::removeSearch(std::string strSearchId) int MenuListSearch::removeSearch(std::string strSearchId)
{ {
std::cerr << "MenuListSearch::removeSearch(" << strSearchId << ")"; std::cout << "MenuListSearch::removeSearch(" << strSearchId << ")";
std::cerr << std::endl; std::cout << std::endl;
std::map<std::string, uint32_t>::iterator it; std::map<std::string, uint32_t>::iterator it;
it = mSearchIds.find(strSearchId); it = mSearchIds.find(strSearchId);
@ -341,8 +341,8 @@ uint32_t MenuOpSearchNew::process_lines(std::string input)
/* launch search */ /* launch search */
if (input.size() < 4) if (input.size() < 4)
{ {
std::cerr << "MenuOpSearchNew::process_lines() ERROR Input too small"; std::cout << "MenuOpSearchNew::process_lines() ERROR Input too small";
std::cerr << std::endl; std::cout << std::endl;
return MENU_PROCESS_ERROR; return MENU_PROCESS_ERROR;
} }
@ -378,8 +378,8 @@ uint32_t MenuListSearchList::refresh()
MenuListSearch *mls = dynamic_cast<MenuListSearch *>(p); MenuListSearch *mls = dynamic_cast<MenuListSearch *>(p);
if (!mls) if (!mls)
{ {
std::cerr << "MenuListSearchList::refresh() mls not there"; std::cout << "MenuListSearchList::refresh() mls not there";
std::cerr << std::endl; std::cout << std::endl;
return MENU_OP_ERROR; return MENU_OP_ERROR;
} }
@ -389,13 +389,13 @@ uint32_t MenuListSearchList::refresh()
uint32_t searchId; uint32_t searchId;
if (!mls->getCurrentSearchId(searchId)) if (!mls->getCurrentSearchId(searchId))
{ {
std::cerr << "MenuListSearchList::refresh() currentIdx invalid"; std::cout << "MenuListSearchList::refresh() currentIdx invalid";
std::cerr << std::endl; std::cout << std::endl;
return MENU_OP_ERROR; return MENU_OP_ERROR;
} }
std::cerr << "MenuListSearchList::refresh() searchId: " << searchId; std::cout << "MenuListSearchList::refresh() searchId: " << searchId;
std::cerr << std::endl; std::cout << std::endl;
std::list<TurtleFileInfo>::iterator it; std::list<TurtleFileInfo>::iterator it;
mNotify->getSearchResults(searchId, mSearchResults); mNotify->getSearchResults(searchId, mSearchResults);
@ -432,8 +432,8 @@ int MenuListSearchList::downloadSelected()
{ {
if (mSelectIdx < 0) if (mSelectIdx < 0)
{ {
std::cerr << "MenuListSearchList::downloadSelected() Invalid Selection"; std::cout << "MenuListSearchList::downloadSelected() Invalid Selection";
std::cerr << std::endl; std::cout << std::endl;
return MENU_ENTRY_NONE; return MENU_ENTRY_NONE;
} }
@ -448,13 +448,13 @@ int MenuListSearchList::downloadSelected()
if (rsFiles -> FileRequest(it->name, it->hash, it->size, if (rsFiles -> FileRequest(it->name, it->hash, it->size,
"", RS_FILE_HINTS_NETWORK_WIDE, srcIds)) "", RS_FILE_HINTS_NETWORK_WIDE, srcIds))
{ {
std::cerr << "MenuListSearchList::downloadSelected() Download Started"; std::cout << "MenuListSearchList::downloadSelected() Download Started";
std::cerr << std::endl; std::cout << std::endl;
} }
else else
{ {
std::cerr << "MenuListSearchList::downloadSelected() Error Starting Download"; std::cout << "MenuListSearchList::downloadSelected() Error Starting Download";
std::cerr << std::endl; std::cout << std::endl;
} }
return MENU_ENTRY_OKAY; return MENU_ENTRY_OKAY;
} }
@ -469,8 +469,8 @@ uint32_t MenuOpSearchListDownload::op_basic(std::string key)
MenuListSearchList *mlsl = dynamic_cast<MenuListSearchList *>(p); MenuListSearchList *mlsl = dynamic_cast<MenuListSearchList *>(p);
if (!mlsl) if (!mlsl)
{ {
std::cerr << "MenuOpSearchListDownload::op_basic() ERROR"; std::cout << "MenuOpSearchListDownload::op_basic() ERROR";
std::cerr << std::endl; std::cout << std::endl;
return MENU_OP_ERROR; return MENU_OP_ERROR;
} }