summaryrefslogblamecommitdiff
path: root/src/user/app/init/main.cpp
blob: 4bb12da2e1d5158b6a9fa14e6f418e154d206c35 (plain) (tree)





















                                                                                              
#include <tce/syscall.h>
#include <IO/IOStream.h>

int Main(char** 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] != 0; i++) {
		if (i == 0) continue;
		stdio.printf("(init) Spawning %s...\n", args[i]);
		int pid = libc::run(args[i], 0, home_term);
		if (pid < 0) {
			stdio << "(init) Error. Sorry.\n";
		} else {
			libc::waitpid(pid, 1);
		}
	}
	stdio << "(init) Goodbye.\n";
	return 0;
}