summaryrefslogtreecommitdiff
path: root/src/user/app/init/main.c
blob: 92fb8f7d7b3d60839ff669f2b4868d704ce580a3 (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 <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;
}