summaryrefslogblamecommitdiff
path: root/src/user/app/init/main.c
blob: 92fb8f7d7b3d60839ff669f2b4868d704ce580a3 (plain) (tree)























                                                                                             
#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;
}