X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2FCLIShell_src%2Fmain.c;h=d605baa799938f643f9334c2322c0a90503c26db;hb=f119d0e5b18b7286d04fc536a94e0f96e3c51714;hp=28d476f3ec08fc15bc86ea0105218fddd2188fed;hpb=17e16b3110b4c5124b0707435e0427993d696545;p=tpg%2Facess2.git diff --git a/Usermode/Applications/CLIShell_src/main.c b/Usermode/Applications/CLIShell_src/main.c index 28d476f3..d605baa7 100644 --- a/Usermode/Applications/CLIShell_src/main.c +++ b/Usermode/Applications/CLIShell_src/main.c @@ -50,7 +50,8 @@ int main(int argc, char *argv[], char *envp[]) //Command_Clear(0, NULL); - write(_stdout, 36, "AcessOS/AcessBasic Shell Version 2\n"); + write(_stdout, 1, "\n"); + write(_stdout, 36, "Acess Shell Version 3\n"); write(_stdout, 30, " Based on CLI Shell for IOOS\n"); write(_stdout, 2, "\n"); for(;;) @@ -96,35 +97,35 @@ int main(int argc, char *argv[], char *envp[]) cBUILTINS[length].fcn(iArgCount-1, &saArgs[1]); break; } - } - // Calling a file - if(length == BUILTIN_COUNT) - { - GeneratePath(saArgs[1], gsCurrentDirectory, gsTmpBuffer); - // Use length in place of fp - length = open(gsTmpBuffer, 0); - // Check file existence - if(length == -1) { - Print("Unknown Command: `");Print(saArgs[1]);Print("'\n"); // Error Message - continue; - } - // Check if the file is a directory - finfo( length, &info ); - close( length ); - if(info.flags & FILEFLAG_DIRECTORY) { - Print("`");Print(saArgs[1]); // Error Message - Print("' is a directory.\n"); - continue; - } - pid = clone(CLONE_VM, 0); - if(pid == 0) execve(gsTmpBuffer, &saArgs[1], NULL); - if(pid <= 0) { - Print("Unablt to create process: `");Print(gsTmpBuffer);Print("'\n"); // Error Message - //SysDebug("pid = %i\n", pid); - } - else { - //waitpid(pid, K_WAITPID_DIE); - } + } + + if(length != BUILTIN_COUNT) continue; + + // - Calling a file + GeneratePath(saArgs[1], gsCurrentDirectory, gsTmpBuffer); + // Use length in place of fp + length = open(gsTmpBuffer, 0); + // Check file existence + if(length == -1) { + Print("Unknown Command: `");Print(saArgs[1]);Print("'\n"); // Error Message + continue; + } + // Check if the file is a directory + finfo( length, &info ); + close( length ); + if(info.flags & FILEFLAG_DIRECTORY) { + Print("`");Print(saArgs[1]); // Error Message + Print("' is a directory.\n"); + continue; + } + pid = clone(CLONE_VM, 0); + if(pid == 0) execve(gsTmpBuffer, &saArgs[1], NULL); + if(pid <= 0) { + Print("Unablt to create process: `");Print(gsTmpBuffer);Print("'\n"); // Error Message + //SysDebug("pid = %i\n", pid); + } + else { + //waitpid(pid, K_WAITPID_DIE); } } } @@ -291,6 +292,10 @@ void Command_Clear(int argc, char **argv) write(_stdout, 4, "\x1B[2J"); //Clear Screen } +/** + * \fn void Command_Cd(int argc, char **argv) + * \brief Change directory + */ void Command_Cd(int argc, char **argv) { char tmpPath[1024]; @@ -313,7 +318,7 @@ void Command_Cd(int argc, char **argv) finfo(fp, &stats); close(fp); - if(!(stats.flags & FILEFLAG_DIRECTORY)) { + if( !(stats.flags & FILEFLAG_DIRECTORY) ) { write(_stdout, 17, "Not a Directory\n"); return; }