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/simple.c | |
| parent | ec0ba7bc40854eab6a1cdb41364f41f9c11407e1 (diff) | |
playing with enviroment variables
Diffstat (limited to 'userspace/simple.c')
| -rw-r--r-- | userspace/simple.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/userspace/simple.c b/userspace/simple.c index 5322584..bd42d9c 100644 --- a/userspace/simple.c +++ b/userspace/simple.c @@ -1,14 +1,23 @@ +#include <stdlib.h> + +extern char **environ; int main(int argc, char **argv) { - int i; printf("argv: 0x%08X\n",argv); + printf("env: 0x%08X\n",environ); + + putenv("test=11"); - for(i=0;i<argc;i++) + + int i=0; + while(environ[i]!=NULL) { - if(!strcmp(argv[i],"-v"))puts("version 1"); + printf("envvar %s (0x%08X)\n" ,environ[i],environ[i]); + i++; } + puts("bye"); return 0; |
