summaryrefslogtreecommitdiff
path: root/src/user/init/main.c
blob: 7d4ea0e18e5904246522a70fb4afe992eff68768 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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");
}