Removed old debug from init
[tpg/acess2.git] / Usermode / Applications / init_src / main.c
1 /*
2  * Acess2 System Init Task
3  */
4 #include <acess/sys.h>
5
6 // === CONSTANTS ===
7 #define NULL    ((void*)0)
8 #define NUM_TERMS       4
9 #define DEFAULT_TERMINAL        "/Devices/VTerm/0"
10 #define DEFAULT_SHELL   "/Acess/SBin/login"
11
12 // === CODE ===
13 /**
14  * \fn int main(int argc, char *argv[])
15  * \brief Entrypoint
16  */
17 int main(int argc, char *argv[])
18 {
19          int    tid;
20          int    i;
21         char    termpath[sizeof(DEFAULT_TERMINAL)] = DEFAULT_TERMINAL;
22         char    *child_argv[2] = {DEFAULT_SHELL, 0};
23         
24         for( i = 0; i < NUM_TERMS; i++ )
25         {               
26                 tid = clone(CLONE_VM, 0);
27                 if(tid == 0)
28                 {
29                         termpath[sizeof(DEFAULT_TERMINAL)-2] = '0' + i;
30                         
31                         open(termpath, OPENFLAG_READ);  // Stdin
32                         open(termpath, OPENFLAG_WRITE); // Stdout
33                         open(termpath, OPENFLAG_WRITE); // Stderr
34                         execve(DEFAULT_SHELL, child_argv, NULL);
35                         for(;;) sleep();
36                 }
37         }
38         
39         // TODO: Implement message watching
40         for(;;) sleep();
41         
42         return 42;
43 }

UCC git Repository :: git.ucc.asn.au