diff options
| author | Michal Idziorek <m.i@gmx.at> | 2014-11-24 01:10:32 +0100 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2014-11-24 01:10:32 +0100 |
| commit | 0d36b950f6a560a0312f2dcd326d3bb5362af370 (patch) | |
| tree | 6d417483e22589e5ca07bf98a0bd8099ae5882e8 /userspace/foolshell.c | |
| parent | ec0ba7bc40854eab6a1cdb41364f41f9c11407e1 (diff) | |
playing with enviroment variables
Diffstat (limited to 'userspace/foolshell.c')
| -rw-r--r-- | userspace/foolshell.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/userspace/foolshell.c b/userspace/foolshell.c index 819c5d6..7a4f616 100644 --- a/userspace/foolshell.c +++ b/userspace/foolshell.c @@ -3,20 +3,21 @@ #include <stdbool.h> #include <string.h> +extern char **environ; // void hello() { // ascci art: http://patorjk.com/software/taag/#p=testall&f=Cards&t=Fool%20OS puts( - - " ______ __ ____ _____ \n" - " / ____/___ ____ / / / __ \\/ ___/ \n" - " / /_ / __ \\/ __ \\/ / / / / /\\__ \\ \n" - " / __/ / /_/ / /_/ / / / /_/ /___/ / \n" - " /_/ \\____/\\____/_/ \\____//____/ \n" - " \n" + + " ______ __ ____ _____ \n" + " / ____/___ ____ / / / __ \\/ ___/ \n" + " / /_ / __ \\/ __ \\/ / / / / /\\__ \\ \n" + " / __/ / /_/ / /_/ / / / /_/ /___/ / \n" + " /_/ \\____/\\____/_/ \\____//____/ \n" + " \n" "Welcome to FoolShell v0.2 (Compiled on " __DATE__ " at " __TIME__ "\n" - "--------------------------------------------------------------------\n\n" + "--------------------------------------------------------------------\n\n" "type 'help' anytime to show shell built-ins\n" "or execute user programms that are in the '/bin' directory (e.g. ls)\n" ); @@ -24,9 +25,8 @@ void hello() void prompt() { - printf( - "$ " - ); + printf("%s",getenv("PS1")); + printf("%s",getenv("PS1")); } int main(int argc, char **argv) @@ -125,7 +125,7 @@ int process(char *buf) } else if(!strcmp(command,"getenv")) { - printf("%s = %s \n",token[1],getenv(token[1])); + printf("%s = %s(0x%08X) \n",token[1],getenv(token[1]),getenv(token[1])); } else if(!strcmp(command,"putenv")) { @@ -139,7 +139,7 @@ int process(char *buf) execve(token[0],token,0); char buf[256]; sprintf(buf,"/bin/%s",token[0]); - execve(buf,token,0); + execve(buf,token,environ); puts("foolshell: command not found"); } |
