diff --git a/src/bin/ls/main.c b/src/bin/ls/main.c index 03be170..c7642da 100755 --- a/src/bin/ls/main.c +++ b/src/bin/ls/main.c @@ -24,9 +24,13 @@ #include int main() { - long *test = malloc(4096); + long *test = 0x0; int i=0; printf("pwd init shell ls\n"); + if (!(test = malloc(4096))) { + printf("Error"); + exit(1); + } for (i=0;i<1024;i++) { test[i] = 0x0; } diff --git a/src/bin/shell/main.c b/src/bin/shell/main.c index 09d6278..8f5a021 100755 --- a/src/bin/shell/main.c +++ b/src/bin/shell/main.c @@ -24,16 +24,14 @@ #include #include #include - -struct currentInfo { - char pwd[256]; - }; int main() { - unsigned char buffer[256],*tmp; + unsigned char *buffer,*tmp; int cPid = 0; - struct currentInfo curInfo[1];// = 0x900000; - sprintf(curInfo[0].pwd,"/"); + if (!(buffer = (char *)malloc(256))) { + printf("Error\n"); + exit(1); + } while (1) { printf("UbixOS: "); gets((char *)&buffer); @@ -43,6 +41,10 @@ } if (0 == memcmp(tmp, "uname", 5)) printf("UbixOS v0.01a " __DATE__" " __TIME__ " \n"); + if (0 == memcmp(tmp, "exit", 4)) + exit(1); + if (0 == memcmp(tmp, "mypid", 5)) + printf("My Pid: [%i]\n",getpid()); else if (memcmp(tmp,"stress", 6) == 0) { while (1) { cPid = fork();