2 * Acess2 System Init Task
7 //#include <spiderscript.h>
11 #define NULL ((void*)0)
13 #define DEFAULT_TERMINAL "/Devices/VTerm/0"
14 #define DEFAULT_SHELL "/Acess/SBin/login"
15 #define DEFAULT_SCRIPT "/Acess/Conf/BootConf.isc"
17 #define ARRAY_SIZE(x) ((sizeof(x))/(sizeof((x)[0])))
21 tSpiderVariable *Script_System_IO_Open(tSpiderScript *, int, tSpiderVariable *);
26 tSpiderFunction gaScriptNS_IO_Fcns[] = {
27 {"Open", Script_System_IO_Open}
29 tSpiderNamespace gaScriptNS_System[] = {
33 ARRAY_SIZE(gaScriptNS_IO_Fcns), gaScriptNS_IO_Fcns,
38 tSpiderNamespace gaScriptNamespaces[] = {
41 ARRAY_SIZE(gaScriptNS_System), gaScriptNS_System,
47 tSpiderVariant gScriptVariant = {
49 ARRAY_SIZE(gaScriptNamespaces), gaScriptNamespaces
55 * \fn int main(int argc, char *argv[])
58 int main(int argc, char *argv[])
62 char termpath[sizeof(DEFAULT_TERMINAL)] = DEFAULT_TERMINAL;
63 char *child_argv[2] = {DEFAULT_SHELL, 0};
65 // - Parse init script
67 // - Start virtual terminals
68 for( i = 0; i < NUM_TERMS; i++ )
70 tid = clone(CLONE_VM, 0);
73 termpath[sizeof(DEFAULT_TERMINAL)-2] = '0' + i;
75 open(termpath, OPENFLAG_READ); // Stdin
76 open(termpath, OPENFLAG_WRITE); // Stdout
77 open(termpath, OPENFLAG_WRITE); // Stderr
78 execve(DEFAULT_SHELL, child_argv, NULL);
83 // TODO: Implement message watching
90 * \brief Reads and parses the boot configuration script
91 * \param Filename File to parse and execute
93 void ExecuteScript(const char *Filename)
96 tSpiderScript *script;
97 script = SpiderScript_ParseFile(&gScriptVariant, Filename);
98 SpiderScript_ExecuteMethod(script, "");
99 SpiderScript_Free(script);
107 tSpiderVariable *Script_System_IO_Open(tSpiderScript *Script, int NArgs, tSpiderVariable *Args)