X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2FCLIShell_src%2Fmain.c;h=89bfe0d1af7428b0118c369f32857bd37d5f8d2a;hb=4d45d15216040b78b91af7469a796797b6b03c4f;hp=af8178256ac733bd850614ef48d43f724e159d3e;hpb=3dedfe567817548ecc164ab497bcbb2395045659;p=tpg%2Facess2.git diff --git a/Usermode/Applications/CLIShell_src/main.c b/Usermode/Applications/CLIShell_src/main.c index af817825..89bfe0d1 100644 --- a/Usermode/Applications/CLIShell_src/main.c +++ b/Usermode/Applications/CLIShell_src/main.c @@ -49,7 +49,7 @@ char **gasCommandHistory; int giCommandSpace = 0; // ==== CODE ==== -int main(int argc, char *argv[], char *envp[]) +int main(int argc, char *argv[], char **envp) { char *sCommandStr; char *saArgs[32] = {0}; @@ -77,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 @@ -88,8 +87,7 @@ 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 @@ -100,7 +98,7 @@ int main(int argc, char *argv[], char *envp[]) sCommandStr = ReadCommandLine( &length ); if(!sCommandStr) { - write(_stdout, 25, "PANIC: Out of heap space\n"); + printf("PANIC: Out of heap space\n"); return -1; } @@ -147,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 @@ -167,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