X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2FCLIShell_src%2Fmain.c;h=58432daf2cd985655086792a2ba09174d6ff0b7f;hb=afe31a49af11cf83b48947de018a5ac147835762;hp=50c95891a23ec721f5fb309283db8c5e64b23875;hpb=321d008781422b7d7137e9acc1ba0e84dec79ff1;p=tpg%2Facess2.git diff --git a/Usermode/Applications/CLIShell_src/main.c b/Usermode/Applications/CLIShell_src/main.c index 50c95891..58432daf 100644 --- a/Usermode/Applications/CLIShell_src/main.c +++ b/Usermode/Applications/CLIShell_src/main.c @@ -59,11 +59,7 @@ int main(int argc, char *argv[], char *envp[]) #if !USE_READLINE int bCached = 1; #else - tReadline readline_state = {0}; - #endif - - #if USE_READLINE - readline_state.UseHistory = 1; + tReadline *readline_state = Readline_Init(1); #endif gasEnvironment = envp; @@ -81,8 +77,7 @@ int main(int argc, char *argv[], char *envp[]) } } - write(_stdout, 22, "Acess Shell Version 3\n"); - write(_stdout, 2, "\n"); + printf("Acess Shell Version 3\n\n"); for(;;) { // Free last command & arguments @@ -92,18 +87,18 @@ int main(int argc, char *argv[], char *envp[]) bCached = 0; #endif - write(_stdout, strlen(gsCurrentDirectory), gsCurrentDirectory); - write(_stdout, 2, "$ "); + printf("%s$ ", gsCurrentDirectory); // Read Command line #if USE_READLINE - sCommandStr = Readline( &readline_state ); + sCommandStr = Readline( readline_state ); + printf("\n"); length = strlen(sCommandStr); #else sCommandStr = ReadCommandLine( &length ); if(!sCommandStr) { - write(_stdout, 25, "PANIC: Out of heap space\n"); + printf("PANIC: Out of heap space\n"); return -1; } @@ -150,6 +145,7 @@ int main(int argc, char *argv[], char *envp[]) } } +#if !USE_READLINE /** * \fn char *ReadCommandLine(int *Length) * \brief Read from the command line @@ -170,21 +166,20 @@ char *ReadCommandLine(int *Length) // Read In Command Line do { - read(_stdin, 1, &ch); // Read Character from stdin (read is a blocking call) - + ch = getchar(); // Read Character from stdin (read is a blocking call) if(ch == '\n') break; switch(ch) { // Control characters case '\x1B': - read(_stdin, 1, &ch); // Read control character + ch = getchar(); // Read control character switch(ch) { //case 'D': if(pos) pos--; break; //case 'C': if(pos