summaryrefslogtreecommitdiff
path: root/userspace
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-11-24 01:54:47 +0100
committerMichal Idziorek <m.i@gmx.at>2014-11-24 01:54:47 +0100
commit369c62119b9dd60db77fc28e8857ed9c4d498889 (patch)
treeea06cc9b95516863cc674bf700e27db601e0529b /userspace
parent0d36b950f6a560a0312f2dcd326d3bb5362af370 (diff)
problems with ENV
Diffstat (limited to 'userspace')
-rw-r--r--userspace/foolshell.c5
-rw-r--r--userspace/simple.c15
-rw-r--r--userspace/sys/Makefile1
-rw-r--r--userspace/sys/syscalls.c5
4 files changed, 19 insertions, 7 deletions
diff --git a/userspace/foolshell.c b/userspace/foolshell.c
index 7a4f616..9002269 100644
--- a/userspace/foolshell.c
+++ b/userspace/foolshell.c
@@ -26,7 +26,6 @@ void hello()
void prompt()
{
printf("%s",getenv("PS1"));
- printf("%s",getenv("PS1"));
}
int main(int argc, char **argv)
@@ -125,14 +124,14 @@ int process(char *buf)
}
else if(!strcmp(command,"getenv"))
{
- printf("%s = %s(0x%08X) \n",token[1],getenv(token[1]),getenv(token[1]));
+ printf("(0x%08X) put: %s = %s(0x%08X) \n",environ,token[1],getenv(token[1]),getenv(token[1]));
}
else if(!strcmp(command,"putenv"))
{
char buf[256];
sprintf(buf,"%s=%s",token[1],token[2]);
putenv(buf);
- printf("set: %s = %s \n",token[1],getenv(token[1]));
+ printf("(0x%08X) set: %s = %s \n",environ,token[1],getenv(token[1]));
}
else
{
diff --git a/userspace/simple.c b/userspace/simple.c
index bd42d9c..e84b072 100644
--- a/userspace/simple.c
+++ b/userspace/simple.c
@@ -1,15 +1,14 @@
#include <stdlib.h>
extern char **environ;
+
int main(int argc, char **argv)
{
printf("argv: 0x%08X\n",argv);
- printf("env: 0x%08X\n",environ);
-
- putenv("test=11");
+ printf("env: 0x%08X\n",environ);
int i=0;
while(environ[i]!=NULL)
@@ -18,7 +17,15 @@ int main(int argc, char **argv)
i++;
}
- puts("bye");
+ putenv("supa=dupa");
+ printf("env: 0x%08X\n",environ);
+
+ i=0;
+ while(environ[i]!=NULL)
+ {
+ printf("envvar %s (0x%08X)\n" ,environ[i],environ[i]);
+ i++;
+ }
return 0;
}
diff --git a/userspace/sys/Makefile b/userspace/sys/Makefile
index 9917d90..e341312 100644
--- a/userspace/sys/Makefile
+++ b/userspace/sys/Makefile
@@ -4,6 +4,7 @@ CFLAGS+=-w
OBJECTS=sys.o syscalls.o crt0.o
+full: clean library_install crt_install
all: $(OBJECTS)
library_install: all
diff --git a/userspace/sys/syscalls.c b/userspace/sys/syscalls.c
index 9456ea4..fe34f47 100644
--- a/userspace/sys/syscalls.c
+++ b/userspace/sys/syscalls.c
@@ -2,6 +2,11 @@
char **environ;
+void _exit(int ret)
+{
+ _exit2(ret,environ);
+}
+
void _exit2(int ret,char **environ)
{
return syscall(SYSCALL_EXIT,ret,environ,0);