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
Kernel/x86 - Some extra logging in ACPICA shim
[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
28007e1
..
8cea364
100644
(file)
--- a/
Usermode/Applications/CLIShell_src/main.c
+++ b/
Usermode/Applications/CLIShell_src/main.c
@@
-8,6
+8,7
@@
#include <string.h>
\r
#include "header.h"
\r
#include <readline.h>
\r
#include <string.h>
\r
#include "header.h"
\r
#include <readline.h>
\r
+#include <errno.h>
\r
\r
#define _stdin 0
\r
#define _stdout 1
\r
\r
#define _stdin 0
\r
#define _stdout 1
\r
@@
-31,11
+32,11
@@
struct {
{"help", Command_Help}, {"clear", Command_Clear},
\r
{"cd", Command_Cd}, {"dir", Command_Dir}
\r
};
\r
{"help", Command_Help}, {"clear", Command_Clear},
\r
{"cd", Command_Cd}, {"dir", Command_Dir}
\r
};
\r
-static char *cDEFAULT_PATH[] = {"/Acess/Bin"};
\r
+static char *cDEFAULT_PATH[] = {"/Acess/Bin"
,"/Acess/SBin"
};
\r
#define BUILTIN_COUNT (sizeof(cBUILTINS)/sizeof(cBUILTINS[0]))
\r
\r
// ==== LOCAL VARIABLES ====
\r
#define BUILTIN_COUNT (sizeof(cBUILTINS)/sizeof(cBUILTINS[0]))
\r
\r
// ==== LOCAL VARIABLES ====
\r
- int giNumPathDirs =
1
;
\r
+ int giNumPathDirs =
2
;
\r
char **gasPathDirs = cDEFAULT_PATH;
\r
char **gasEnvironment;
\r
char gsCommandBuffer[1024];
\r
char **gasPathDirs = cDEFAULT_PATH;
\r
char **gasEnvironment;
\r
char gsCommandBuffer[1024];
\r
@@
-55,7
+56,7
@@
int main(int argc, char *argv[], char **envp)
\r
gasEnvironment = envp;
\r
\r
\r
gasEnvironment = envp;
\r
\r
-
Command_Clear(0, NULL);
\r
+
//
Command_Clear(0, NULL);
\r
\r
{
\r
char *tmp = getenv("CWD");
\r
\r
{
\r
char *tmp = getenv("CWD");
\r
@@
-75,10
+76,15
@@
int main(int argc, char *argv[], char **envp)
if(saArgs[0]) free(saArgs[0]);
\r
\r
printf("%s$ ", gsCurrentDirectory);
\r
if(saArgs[0]) free(saArgs[0]);
\r
\r
printf("%s$ ", gsCurrentDirectory);
\r
+ fflush(stdout);
\r
\r
// Read Command line
\r
sCommandStr = Readline( readline_state );
\r
printf("\n");
\r
\r
// Read Command line
\r
sCommandStr = Readline( readline_state );
\r
printf("\n");
\r
+ if( !sCommandStr ) {
\r
+ perror("Readline");
\r
+ return 1;
\r
+ }
\r
\r
// Parse Command Line into arguments
\r
iArgCount = Parse_Args(sCommandStr, saArgs);
\r
\r
// Parse Command Line into arguments
\r
iArgCount = Parse_Args(sCommandStr, saArgs);
\r
@@
-299,27
+305,23
@@
void Command_Cd(int argc, char **argv)
*/
\r
void Command_Dir(int argc, char **argv)
\r
{
\r
*/
\r
void Command_Dir(int argc, char **argv)
\r
{
\r
- int dp, fp
, dirLen
;
\r
+ int dp, fp;
\r
char modeStr[11] = "RWXrwxRWX ";
\r
char modeStr[11] = "RWXrwxRWX ";
\r
- char tmpPath[1024];
\r
- char *fileName;
\r
+ char fileName[256];
\r
t_sysFInfo info;
\r
t_sysACL acl;
\r
\r
t_sysFInfo info;
\r
t_sysACL acl;
\r
\r
+
\r
+ // -- Generate and open directory --
\r
// Generate Directory Path
\r
// Generate Directory Path
\r
+ char tmpPath[1024];
\r
if(argc > 1)
\r
if(argc > 1)
\r
-
dirLen =
GeneratePath(argv[1], gsCurrentDirectory, tmpPath);
\r
+ GeneratePath(argv[1], gsCurrentDirectory, tmpPath);
\r
else
\r
else
\r
- {
\r
strcpy(tmpPath, gsCurrentDirectory);
\r
strcpy(tmpPath, gsCurrentDirectory);
\r
- }
\r
- dirLen = strlen(tmpPath);
\r
-
\r
// Open Directory
\r
dp = _SysOpen(tmpPath, OPENFLAG_READ);
\r
// Open Directory
\r
dp = _SysOpen(tmpPath, OPENFLAG_READ);
\r
- // Check if file opened
\r
- if(dp == -1)
\r
- {
\r
+ if(dp == -1) {
\r
printf("Unable to open directory `%s', File cannot be found\n", tmpPath);
\r
return;
\r
}
\r
printf("Unable to open directory `%s', File cannot be found\n", tmpPath);
\r
return;
\r
}
\r
@@
-338,15
+340,7
@@
void Command_Dir(int argc, char **argv)
return;
\r
}
\r
\r
return;
\r
}
\r
\r
- // Append Shash for file paths
\r
- if(tmpPath[dirLen-1] != '/')
\r
- {
\r
- tmpPath[dirLen++] = '/';
\r
- tmpPath[dirLen] = '\0';
\r
- }
\r
-
\r
- fileName = (char*)(tmpPath+dirLen);
\r
- // Read Directory Content
\r
+ // -- Read Directory Contents --
\r
while( (fp = _SysReadDir(dp, fileName)) )
\r
{
\r
if(fp < 0)
\r
while( (fp = _SysReadDir(dp, fileName)) )
\r
{
\r
if(fp < 0)
\r
@@
-356,7
+350,7
@@
void Command_Dir(int argc, char **argv)
break;
\r
}
\r
// Open File
\r
break;
\r
}
\r
// Open File
\r
- fp = _SysOpen
(tmpPath
, 0);
\r
+ fp = _SysOpen
Child(dp, fileName
, 0);
\r
if(fp == -1) continue;
\r
// Get File Stats
\r
_SysFInfo(fp, &info, 0);
\r
if(fp == -1) continue;
\r
// Get File Stats
\r
_SysFInfo(fp, &info, 0);
\r
UCC
git Repository :: git.ucc.asn.au