diff options
author | Robert de Bath <rdebath@poboxes.com> | 1996-03-24 21:25:23 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2013-10-23 23:29:54 +0200 |
commit | dcc973ea3e31710429858c99d4f040334ac67c06 (patch) | |
tree | 8883b902eb18eba489957b7f03caa491fd7992a7 /libc/tests/env.c | |
parent | fe22c37817ce338fbbc90b239320248c270957fa (diff) | |
download | dev86-dcc973ea3e31710429858c99d4f040334ac67c06.tar.gz |
Import Dev86-0.0.5.tar.gzv0.0.5
Diffstat (limited to 'libc/tests/env.c')
-rw-r--r-- | libc/tests/env.c | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/libc/tests/env.c b/libc/tests/env.c new file mode 100644 index 0000000..baeb8e9 --- /dev/null +++ b/libc/tests/env.c @@ -0,0 +1,82 @@ + +char hex[] = "0123456789ABCDEF"; + +char buf[20]; +main(argc, argv, envp) +int argc; +char ** argv; +char ** envp; +{ + int i,j; char *p; char * str; + int * arg = &argc; + + for(j=0; j<8; j++) + { + phex(arg); + putstr(":"); + for(i=0; i<8; i++) + { + putstr(" "); + phex(*arg++); + } + putstr("\n"); + } + +#if 0 + str = alloca(sizeof(hex)+2); + putstr("Alloca = "); + phex(&str); + putstr(","); + phex(str); + putstr("\n"); +#endif + + p = (char*) &argc; + + putstr("ARGC="); phex(argc); putstr("\n"); + for(i=0; i<argc; i++) + { + phex(argv[i]); + putstr(":"); + putstr(argv[i]); + putstr("\n"); + } + putstr("ENV=>\n"); + for(; *envp; envp++) + { + phex(envp); + putstr(":"); + phex(*envp); + putstr(":"); + putstr(*envp); + putstr("\n"); + } +} + +phex(val) +{ + int i; + printf("%04x", val); +} + +putstr(str) +{ + printf("%s", str); +} + +#if 0 +int global_var_that_needs_init = 0x201; + +#asm + loc 1 ! Make sure the pointer is in the correct segment +auto_func: ! Label for bcc -M to work. + .word _init_vars ! Pointer to the autorun function + .word no_op ! Space filler cause segs are padded to 4 bytes. + .text ! So the function after is also in the correct seg. +#endasm + +static void init_vars() +{ + global_var_that_needs_init = getuid(); +} +#endif |