Fixed correctness in stdio, minor changes in ls to handle dirs with negative sizes
[tpg/acess2.git] / Usermode / Applications / CLIShell_src / main.c
index ec83ac9..2e51419 100644 (file)
@@ -48,7 +48,7 @@ char  **gasCommandHistory;
 int main(int argc, char *argv[], char *envp[])\r
 {\r
        char    *sCommandStr;\r
-       char    *saArgs[32];\r
+       char    *saArgs[32] = {0};\r
         int    length = 0;\r
         int    i;\r
         int    iArgCount = 0;\r
@@ -144,7 +144,7 @@ char *ReadCommandLine(int *Length)
        // Read In Command Line\r
        do {\r
                read(_stdin, 1, &ch);   // Read Character from stdin (read is a blocking call)\r
-               // Ignore control characters\r
+               // Control characters\r
                if(ch == '\x1B') {\r
                        read(_stdin, 1, &ch);   // Read control character\r
                        switch(ch)\r
@@ -174,6 +174,13 @@ char *ReadCommandLine(int *Length)
                        write(_stdout, 1, &ch);\r
                        continue;\r
                }\r
+               // Tab\r
+               if(ch == '\t') {\r
+                       //TODO: Implement Tab-Completion\r
+                       //Currently just ignore tabs\r
+                       continue;\r
+               }\r
+               \r
                // Expand Buffer\r
                if(len > space) {\r
                        space += 256;\r
@@ -462,10 +469,7 @@ void Command_Dir(int argc, char **argv)
        // Check if file opened\r
        if(dp == -1)\r
        {\r
-               //printf("Unable to open directory `%s', File cannot be found\n", tmpPath);\r
-               write(_stdout, 27, "Unable to open directory `");\r
-               write(_stdout, strlen(tmpPath)+1, tmpPath);\r
-               write(_stdout, 25, "', File cannot be found\n");\r
+               printf("Unable to open directory `%s', File cannot be found\n", tmpPath);\r
                return;\r
        }\r
        // Get File Stats\r

UCC git Repository :: git.ucc.asn.au