From: Derek J S. <der...@us...> - 2005-07-26 02:52:52
|
Update of /cvsroot/openh323/pwlib/samples/threadex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7394 Modified Files: main.cxx Log Message: Use different console handling code. Still get "console gone errors" when on remote box. Index: main.cxx =================================================================== RCS file: /cvsroot/openh323/pwlib/samples/threadex/main.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.cxx 26 Jul 2005 01:43:05 -0000 1.3 --- main.cxx 26 Jul 2005 02:52:39 -0000 1.4 *************** *** 25,28 **** --- 25,32 ---- * * $Log$ + * Revision 1.4 2005/07/26 02:52:39 dereksmithies + * Use different console handling code. Still get "console gone errors" when on + * remote box. + * * Revision 1.3 2005/07/26 01:43:05 dereksmithies * Set up so that only H or h or ? generate a help message. *************** *** 169,195 **** // display the prompt ! PError << "Command ? " << flush; ! // terminate the menu loop if console finished ! char ch = (char)console.peek(); if (console.eof()) { ! PError << "\nConsole gone - menu disabled" << endl; ! launch.Terminate(); ! launch.WaitForTermination(); ! return; } ! console >> ch; switch (tolower(ch)) { case 'r' : ! PError << "\nHave completed " << launch.GetIteration() << " iterations" << endl; break; case 't' : ! PError << "\nElapsed time is " << launch.GetElapsedTime() << " (Hours:mins:seconds.millseconds)" << endl; break; case 'x' : case 'q' : ! PError << "Exiting." << endl; launch.Terminate(); launch.WaitForTermination(); --- 173,206 ---- // display the prompt ! cout << "Command ? " << flush; ! ! // terminate the menu loop if console finished ! char ch = (char)tolower(console.peek()); if (console.eof()) { ! cout << "\nConsole gone - menu disabled" << endl; ! launch.Terminate(); ! launch.WaitForTermination(); ! return; } ! ! if (ch == '\n') { ! console.ignore(INT_MAX, '\n'); ! continue; ! } ! console >> ch; + switch (tolower(ch)) { case 'r' : ! cout << "\nHave completed " << launch.GetIteration() << " iterations" << endl; break; case 't' : ! cout << "\nElapsed time is " << launch.GetElapsedTime() << " (Hours:mins:seconds.millseconds)" << endl; break; case 'x' : case 'q' : ! cout << "Exiting." << endl; launch.Terminate(); launch.WaitForTermination(); *************** *** 198,202 **** case '?' : case 'h' : ! PError << help << endl; default: --- 209,213 ---- case '?' : case 'h' : ! cout << help << endl; default: |