diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-18 19:06:35 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-18 19:06:35 +0200 |
commit | 478c691187fbc9ba4ccaacf92f57828eef20041c (patch) | |
tree | 4cb4b00d7da1fd533cebc347f3641cc0455935f5 /src/user/init | |
parent | 7e6454020ed1143e05e83a683606f318995458e5 (diff) | |
download | TCE-478c691187fbc9ba4ccaacf92f57828eef20041c.tar.gz TCE-478c691187fbc9ba4ccaacf92f57828eef20041c.zip |
Simple shell added. Simple fprintf function added too.
Diffstat (limited to 'src/user/init')
-rw-r--r-- | src/user/init/Makefile | 6 | ||||
-rw-r--r-- | src/user/init/main.c | 24 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/user/init/Makefile b/src/user/init/Makefile new file mode 100644 index 0000000..286de06 --- /dev/null +++ b/src/user/init/Makefile @@ -0,0 +1,6 @@ +Obj = main.o +Out = init.elf + +include $(SrcPath)/user/app_common.make + +LDFLAGS += -Map test.map diff --git a/src/user/init/main.c b/src/user/init/main.c new file mode 100644 index 0000000..7d4ea0e --- /dev/null +++ b/src/user/init/main.c @@ -0,0 +1,24 @@ +#include <tce/syscall.h> +#include <stdlib.h> +#include <stdio.h> + +int main(char** args) { + int i; + + FILE term = open("/.ui/klog", 0); + if (term <= 0) return -1; + + fprint(term, "(init) Trivial/Computing Environment says hello. Press super to go home.\n"); + + for (i = 0; args[i] != 0; i++) { + if (i == 0) continue; + fprintf(term, "(init) Spawning %s...\n", args[i]); + int pid = run(args[i], 0); + if (pid < 0) { + fprint(term, "(init) Error. Sorry.\n"); + } else { + waitpid(pid); + } + } + fprint(term, "(init) Goodbye.\n"); +} |