diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2012-11-25 21:06:40 +0100 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2012-11-25 21:06:40 +0100 |
commit | 0dadfa903b7a780b4f88155a6eae7855890b797e (patch) | |
tree | 16ab5632128deaaad8643b7fcca11118fc0498e7 /src/user/app/init | |
parent | e138ba093d5e1acbad0587aee38f9c09415d24ca (diff) | |
download | TCE-0dadfa903b7a780b4f88155a6eae7855890b797e.tar.gz TCE-0dadfa903b7a780b4f88155a6eae7855890b797e.zip |
Return to standard C.
Diffstat (limited to 'src/user/app/init')
-rw-r--r-- | src/user/app/init/Makefile | 2 | ||||
-rw-r--r-- | src/user/app/init/main.c | 24 | ||||
-rw-r--r-- | src/user/app/init/main.cpp | 23 |
3 files changed, 25 insertions, 24 deletions
diff --git a/src/user/app/init/Makefile b/src/user/app/init/Makefile index 6ab7cf8..3486f0d 100644 --- a/src/user/app/init/Makefile +++ b/src/user/app/init/Makefile @@ -1,6 +1,6 @@ Obj = main.o Out = init.elf -include $(SrcPath)/user/app/fwik.make +include $(SrcPath)/user/app/common.make LDFLAGS += -Map init.map diff --git a/src/user/app/init/main.c b/src/user/app/init/main.c new file mode 100644 index 0000000..92fb8f7 --- /dev/null +++ b/src/user/app/init/main.c @@ -0,0 +1,24 @@ +#include <tce/syscall.h> +#include <stdio.h> + +int main(char **args) { + FILE home_term = open("/.ui/home", 0); + int i, pid; + if (home_term < 0) return -1; + + printf("(init) Trivial/Computing Environment says hello. Press super to go home.\n"); + + for (i = 0; args[i]; i++) { + if (i == 0) continue; + printf("(init) Spawning %s...\n", args[i]); + + pid = run(args[i], 0, home_term); + if (pid < 0) { + printf("(init) Error. Sorry.\n"); + } else { + waitpid(pid, 1); + } + } + printf("(init) Goodbye.\n"); + return 0; +} diff --git a/src/user/app/init/main.cpp b/src/user/app/init/main.cpp deleted file mode 100644 index 759d804..0000000 --- a/src/user/app/init/main.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include <tce/syscall.h> -#include <IO/IOStream.h> -#include <String.h> - -int Main(String *args) { - FILE home_term = libc::open("/.ui/home", 0); - if (home_term < 0) return -1; - - stdio << "(init) Trivial/Computing Environment says hello. Press super to go home.\n"; - - for (int i = 0; args[i]; i++) { - if (i == 0) continue; - stdio.printf("(init) Spawning %s...\n", args[i].c_str()); - int pid = libc::run(args[i].c_str(), 0, home_term); - if (pid < 0) { - stdio << "(init) Error. Sorry.\n"; - } else { - libc::waitpid(pid, 1); - } - } - stdio << "(init) Goodbye.\n"; - return 0; -} |