X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2FCLIShell_src%2Fmain.c;h=6de92df42d99804328e83ec3cf86e74025ad2b8c;hb=8e77b7c2bd3809310bcd445de9fa73582c603ea2;hp=1a501ad17c453dea52cba74bdaeaed8326d247d9;hpb=e7a76b0d8a0cc6aa77966509780973a6f8216ef7;p=tpg%2Facess2.git diff --git a/Usermode/Applications/CLIShell_src/main.c b/Usermode/Applications/CLIShell_src/main.c index 1a501ad1..6de92df4 100644 --- a/Usermode/Applications/CLIShell_src/main.c +++ b/Usermode/Applications/CLIShell_src/main.c @@ -9,6 +9,7 @@ #include "header.h" #include #include +#include #define _stdin 0 #define _stdout 1 @@ -32,11 +33,11 @@ struct { {"help", Command_Help}, {"clear", Command_Clear}, {"cd", Command_Cd}, {"dir", Command_Dir} }; -static char *cDEFAULT_PATH[] = {"/Acess/Bin"}; +static char *cDEFAULT_PATH[] = {"/Acess/Bin","/Acess/SBin"}; #define BUILTIN_COUNT (sizeof(cBUILTINS)/sizeof(cBUILTINS[0])) // ==== LOCAL VARIABLES ==== - int giNumPathDirs = 1; + int giNumPathDirs = 2; char **gasPathDirs = cDEFAULT_PATH; char **gasEnvironment; char gsCommandBuffer[1024]; @@ -56,7 +57,7 @@ int main(int argc, char *argv[], char **envp) gasEnvironment = envp; - Command_Clear(0, NULL); +// Command_Clear(0, NULL); { char *tmp = getenv("CWD"); @@ -213,14 +214,28 @@ void CallCommand(char **Args) // Create new process int fds[] = {0, 1, 2}; + int status; pid = _SysSpawn(sTmpBuffer, (const char **)Args, (const char **)gasEnvironment, 3, fds, NULL); if(pid <= 0) { printf("Unable to create process: `%s'\n", sTmpBuffer); // Error Message + status = 0; } else { - int status; + _SysIOCtl(0, PTY_IOCTL_SETPGRP, &pid); _SysWaitTID(pid, &status); } + + // Return terminal to a sane state + { + int zero = 0; + _SysIOCtl(0, PTY_IOCTL_SETPGRP, &zero); + printf("\x1b[0m"); + } + // Print a status message if termination was non-clean + if( status ) + { + printf("[%i] exited %i\n", pid, status); + } } /**