diff --git a/newlib/examples/hello.c b/newlib/examples/hello.c index fd357d5f..f65ce176 100644 --- a/newlib/examples/hello.c +++ b/newlib/examples/hello.c @@ -27,10 +27,6 @@ extern int errno; int main(int argc, char** argv) { - int i; - char* str = (char *)malloc(40000 * sizeof(char)); - scanf("%s", str); - printf("SCANF: %s", str); - fflush(NULL); + printf("test!"); return errno; } diff --git a/newlib/examples/mshell b/newlib/examples/mshell index f209d3db..5d9d80cf 100755 Binary files a/newlib/examples/mshell and b/newlib/examples/mshell differ diff --git a/newlib/examples/mshell.c b/newlib/examples/mshell.c index e7a1bb65..3389c610 100644 --- a/newlib/examples/mshell.c +++ b/newlib/examples/mshell.c @@ -1,6 +1,10 @@ -#include #include +#include #include +#include +#include +#include +#include void showlogo() { printf("\n\n"); @@ -19,7 +23,8 @@ void help() { int main(int argc, char** argv) { char* command = malloc(1024*sizeof(char)); - int size; + int size, status = 0; + pid_t pid; system("clear"); showlogo(); while(1) { @@ -29,11 +34,20 @@ int main(int argc, char** argv) } if(!strcmp(command, "help")) { help(); - } - else { - char* argv[] = {command, NULL}; - execve(command, argv, NULL); + } else { + //pid = fork(); + //if (pid == 0) { //child + char* newargv[] = {command, NULL}; + char* newenv[] = {"USER=root", "PATH=/bin:/sbin:/usr/bin", "PWD=/", "TEMP=/tmp", NULL}; + + execve(command, newargv, newenv); + return errno; + //} else { + // wait(&status); + // printf("Beendet"); + //} } } + return errno; }