git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Usermode - IRC Client
[tpg/acess2.git]
/
Usermode
/
Applications
/
CLIShell_src
/
main.c
diff --git
a/Usermode/Applications/CLIShell_src/main.c
b/Usermode/Applications/CLIShell_src/main.c
index
1f381e2
..
af81782
100644
(file)
--- a/
Usermode/Applications/CLIShell_src/main.c
+++ b/
Usermode/Applications/CLIShell_src/main.c
@@
-1,12
+1,17
@@
/*
\r
* AcessOS Shell Version 3
\r
*/
\r
/*
\r
* AcessOS Shell Version 3
\r
*/
\r
+#define USE_READLINE 1
\r
#include <acess/sys.h>
\r
#include <stdlib.h>
\r
#include <stdio.h>
\r
#include <string.h>
\r
#include "header.h"
\r
\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
#define _stdin 0
\r
#define _stdout 1
\r
#define _stderr 2
\r
@@
-51,7
+56,11
@@
int main(int argc, char *argv[], char *envp[])
int length = 0;
\r
int i;
\r
int iArgCount = 0;
\r
int length = 0;
\r
int i;
\r
int iArgCount = 0;
\r
+ #if !USE_READLINE
\r
int bCached = 1;
\r
int bCached = 1;
\r
+ #else
\r
+ tReadline *readline_state = Readline_Init(1);
\r
+ #endif
\r
\r
gasEnvironment = envp;
\r
\r
\r
gasEnvironment = envp;
\r
\r
@@
-74,13
+83,20
@@
int main(int argc, char *argv[], char *envp[])
{
\r
// Free last command & arguments
\r
if(saArgs[0]) free(saArgs);
\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
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
\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
+ printf("\n");
\r
+ length = strlen(sCommandStr);
\r
+ #else
\r
sCommandStr = ReadCommandLine( &length );
\r
\r
if(!sCommandStr) {
\r
sCommandStr = ReadCommandLine( &length );
\r
\r
if(!sCommandStr) {
\r
@@
-99,6
+115,7
@@
int main(int argc, char *argv[], char *envp[])
gasCommandHistory[ giLastCommand ] = sCommandStr;
\r
bCached = 1;
\r
}
\r
gasCommandHistory[ giLastCommand ] = sCommandStr;
\r
bCached = 1;
\r
}
\r
+ #endif
\r
\r
// Parse Command Line into arguments
\r
Parse_Args(sCommandStr, saArgs);
\r
\r
// Parse Command Line into arguments
\r
Parse_Args(sCommandStr, saArgs);
\r
@@
-123,6
+140,10
@@
int main(int argc, char *argv[], char *envp[])
\r
// Shall we?
\r
CallCommand( &saArgs[1] );
\r
\r
// Shall we?
\r
CallCommand( &saArgs[1] );
\r
+
\r
+ #if USE_READLINE
\r
+ free( sCommandStr );
\r
+ #endif
\r
}
\r
}
\r
\r
}
\r
}
\r
\r
UCC
git Repository :: git.ucc.asn.au