32 lines
620 B
C
32 lines
620 B
C
#include <stdint.h>
|
|
#include <ulib.h>
|
|
|
|
void tb_runinitscript(void) {
|
|
|
|
char *tbargs[] = { "-m", "runfile", "-f", "base:/scripts/init.tb" };
|
|
int32_t tb = proc_spawn("base:/bin/tb", tbargs, ARRLEN(tbargs));
|
|
|
|
proc_run(tb);
|
|
|
|
while(proc_pollstate(tb) != 4) {
|
|
int32_t r;
|
|
|
|
char buf[1024];
|
|
string_memset(buf, 0, sizeof(buf));
|
|
r = ipc_piperead(tb, 0, (uint8_t *const)buf, sizeof(buf)-1);
|
|
if (r > 0) {
|
|
term_write(buf, string_len(buf));
|
|
} else {
|
|
schedrelease();
|
|
}
|
|
}
|
|
}
|
|
|
|
void main(void) {
|
|
tb_runinitscript();
|
|
|
|
uprintf("Shell exited! Please reboot the system.\n");
|
|
|
|
for(;;);
|
|
}
|