void SC_TerminalClient::readlineCmdLine( char *cmdLine ) { SC_TerminalClient *client = static_cast<SC_TerminalClient*>(instance()); if( cmdLine == NULL ) { postfl("\nExiting sclang (ctrl-D)\n"); client->onQuit(0); return; } if(*cmdLine!=0){ // If line wasn't empty, store it so that uparrow retrieves it add_history(cmdLine); int len = (int)strlen(cmdLine); client->lockInput(); client->mInputBuf.append(cmdLine, len); client->mInputBuf.append(kInterpretPrintCmdLine); client->sendSignal(sig_input); // Wait for input to be processed, // so that its output is displayed before readline prompt. if (client->mInputShouldBeRunning) pthread_cond_wait( &client->mInputCond, &client->mInputMutex ); client->unlockInput(); } }