summaryrefslogblamecommitdiff
path: root/src/user/init/main.c
blob: 7300efe93d720bbd86e792678a858b12379601c3 (plain) (tree)
1
2
3
4
5
6
7
8
9






                        

                                              
 
                                                                                            


                                        
                                                           
                                                     
                              
                                                        
                        
                                        

                 
                                   
 
#include <tce/syscall.h>
#include <stdlib.h>
#include <stdio.h>

int main(char** args) {
	int i;

	FILE home_term = open("/.ui/home", 0);
	if (home_term < 0) return -1;

	print("(init) Trivial/Computing Environment says hello. Press super to go home.\n");

	for (i = 0; args[i] != 0; i++) {
		if (i == 0) continue;
		printf("(init) Spawning %s...\n", args[i]);
		int pid = run(args[i], 0, home_term);
		if (pid < 0) {
			print("(init) Error. Sorry.\n");
		} else {
			waitpid(pid, 1);
		}
	}
	print("(init) Goodbye.\n");
}