From c68d42e36c5516fab7e975f6b6bd422c4779509f Mon Sep 17 00:00:00 2001 From: "U-ELIOT-019992DFC\\Administrator" Date: Wed, 11 Feb 2009 09:15:06 -0500 Subject: better non-readline version of shell --- shell/dbshell.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/shell/dbshell.cpp b/shell/dbshell.cpp index 7cbe5bf32ef..fee4fc467cc 100644 --- a/shell/dbshell.cpp +++ b/shell/dbshell.cpp @@ -22,6 +22,8 @@ void shellHistoryInit(){ #ifdef USE_READLINE using_history(); read_history( ".dbshell" ); +#else + cout << "type \"exit\" to exit" << endl; #endif } void shellHistoryDone(){ @@ -42,7 +44,10 @@ char * shellReadline( const char * prompt ){ #else printf( "> " ); char * buf = new char[1024]; - return fgets( buf , 1024 , stdin ); + char *l = fgets( buf , 1024 , stdin ); + int len = strlen( buf ); + buf[len-1] = 0; + return buf; #endif } @@ -296,7 +301,10 @@ int main(int argc, char* argv[]) { } string code = line; - + if ( code == "exit" ){ + break; + } + { string cmd = line; if ( cmd.find( " " ) > 0 ) -- cgit v1.2.1