Removed debug from VFS_GetACL and VTerm, fixed DevFS not being a directory
[tpg/acess2.git] / Usermode / Applications / CLIShell_src / main.c
index f4d703c..e806a53 100644 (file)
@@ -31,7 +31,7 @@ struct        {
 \r
 // ==== LOCAL VARIABLES ====\r
 char   gsCommandBuffer[1024];\r
-char   *gsCurrentDirectory = "/";\r
+char   *gsCurrentDirectory = NULL;\r
 char   gsTmpBuffer[1024];\r
 char   **gasCommandHistory;\r
  int   giLastCommand = 0;\r
@@ -50,8 +50,19 @@ int main(int argc, char *argv[], char *envp[])
        \r
        //Command_Clear(0, NULL);\r
        \r
+       {\r
+               char    *tmp = getenv("CWD");\r
+               if(tmp) {\r
+                       gsCurrentDirectory = malloc(strlen(tmp)+1);\r
+                       strcpy(gsCurrentDirectory, tmp);\r
+               } else {\r
+                       gsCurrentDirectory = malloc(2);\r
+                       strcpy(gsCurrentDirectory, "/");\r
+               }\r
+       }       \r
+       \r
        write(_stdout, 1, "\n");\r
-       write(_stdout, 36, "Acess Shell Version 3\n");\r
+       write(_stdout, 22, "Acess Shell Version 3\n");\r
        write(_stdout,  2, "\n");\r
        for(;;)\r
        {\r
@@ -59,6 +70,7 @@ int main(int argc, char *argv[], char *envp[])
                if(saArgs[0])   free(saArgs);\r
                if(!bCached)    free(sCommandStr);\r
                bCached = 0;\r
+               write(_stdout, 1, "\n");\r
                write(_stdout, strlen(gsCurrentDirectory), gsCurrentDirectory);\r
                write(_stdout, 3, "$ ");\r
                \r
@@ -324,6 +336,8 @@ void Command_Cd(int argc, char **argv)
                return;\r
        }\r
        \r
+       free(gsCurrentDirectory);\r
+       gsCurrentDirectory = malloc(strlen(tmpPath)+1);\r
        strcpy(gsCurrentDirectory, tmpPath);\r
 }\r
 \r

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