0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

better non-readline version of shell

This commit is contained in:
U-ELIOT-019992DFC\Administrator 2009-02-11 09:15:06 -05:00
parent b0a92ccc83
commit c68d42e36c

View File

@ -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 )