2 * Acess2 System Init Task
7 //#include <spiderscript.h>
12 #define DEFAULT_TERMINAL "/Devices/VTerm/0"
13 #define DEFAULT_SHELL "/Acess/SBin/login"
14 #define DEFAULT_SCRIPT "/Acess/Conf/BootConf.isc"
16 #define ARRAY_SIZE(x) ((sizeof(x))/(sizeof((x)[0])))
20 tSpiderVariable *Script_System_IO_Open(tSpiderScript *, int, tSpiderVariable *);
25 tSpiderFunction gaScriptNS_IO_Fcns[] = {
26 {"Open", Script_System_IO_Open}
28 tSpiderNamespace gaScriptNS_System[] = {
32 ARRAY_SIZE(gaScriptNS_IO_Fcns), gaScriptNS_IO_Fcns,
37 tSpiderNamespace gaScriptNamespaces[] = {
40 ARRAY_SIZE(gaScriptNS_System), gaScriptNS_System,
46 tSpiderVariant gScriptVariant = {
48 ARRAY_SIZE(gaScriptNamespaces), gaScriptNamespaces
54 * \fn int main(int argc, char *argv[])
57 int main(int argc, char *argv[])
61 char termpath[sizeof(DEFAULT_TERMINAL)] = DEFAULT_TERMINAL;
62 char *child_argv[2] = {DEFAULT_SHELL, 0};
64 // - Parse init script
66 // - Start virtual terminals
67 for( i = 0; i < NUM_TERMS; i++ )
69 tid = clone(CLONE_VM, 0);
72 termpath[sizeof(DEFAULT_TERMINAL)-2] = '0' + i;
74 open(termpath, OPENFLAG_READ); // Stdin
75 open(termpath, OPENFLAG_WRITE); // Stdout
76 open(termpath, OPENFLAG_WRITE); // Stderr
77 execve(DEFAULT_SHELL, child_argv, NULL);
82 // TODO: Implement message watching
89 * \brief Reads and parses the boot configuration script
90 * \param Filename File to parse and execute
92 void ExecuteScript(const char *Filename)
95 tSpiderScript *script;
96 script = SpiderScript_ParseFile(&gScriptVariant, Filename);
97 SpiderScript_ExecuteMethod(script, "");
98 SpiderScript_Free(script);
106 tSpiderVariable *Script_System_IO_Open(tSpiderScript *Script, int NArgs, tSpiderVariable *Args)