/*\r
* AcessOS Shell Version 3\r
*/\r
+#define USE_READLINE 0\r
#include <acess/sys.h>\r
#include <stdlib.h>\r
#include <stdio.h>\r
#include <string.h>\r
#include "header.h"\r
\r
+#if USE_READLINE\r
+# include "readline.h"\r
+#endif\r
+\r
#define _stdin 0\r
#define _stdout 1\r
#define _stderr 2\r
int length = 0;\r
int i;\r
int iArgCount = 0;\r
+ #if !USE_READLINE\r
int bCached = 1;\r
+ #else\r
+ tReadline readline_state = {0};\r
+ #endif\r
+ \r
+ #if USE_READLINE\r
+ readline_state.UseHistory = 1;\r
+ #endif\r
\r
gasEnvironment = envp;\r
\r
{\r
// Free last command & arguments\r
if(saArgs[0]) free(saArgs);\r
+ #if !USE_READLINE\r
if(!bCached) free(sCommandStr);\r
bCached = 0;\r
+ #endif\r
\r
write(_stdout, strlen(gsCurrentDirectory), gsCurrentDirectory);\r
write(_stdout, 2, "$ ");\r
\r
// Read Command line\r
+ #if USE_READLINE\r
+ sCommandStr = Readline( &readline_state );\r
+ length = strlen(sCommandStr);\r
+ #else\r
sCommandStr = ReadCommandLine( &length );\r
\r
if(!sCommandStr) {\r
gasCommandHistory[ giLastCommand ] = sCommandStr;\r
bCached = 1;\r
}\r
+ #endif\r
\r
// Parse Command Line into arguments\r
Parse_Args(sCommandStr, saArgs);\r
\r
// Shall we?\r
CallCommand( &saArgs[1] );\r
+ \r
+ #if USE_READLINE\r
+ free( sCommandStr );\r
+ #endif\r
}\r
}\r
\r