still serv_close bug...
[mit-jos.git] / user / icode.c
blob43ff8d60c287b9b64232db698fd4eb8422dff01c
1 #include <inc/lib.h>
3 void
4 umain(void)
6 int fd, n, r;
7 char buf[512+1];
9 cprintf("icode startup\n");
11 cprintf("icode: open /motd\n");
12 if ((fd = open("/motd", O_RDONLY)) < 0)
13 panic("icode: open /motd: %e", fd);
15 cprintf("icode: read /motd\n");
16 while ((n = read(fd, buf, sizeof buf-1)) > 0)
17 sys_cputs(buf, n);
19 cprintf("icode: close /motd\n");
20 close(fd);
22 cprintf("icode: spawn /init\n");
23 if ((r = spawnl("/init", "init", "initarg1", "initarg2", (char*)0)) < 0)
24 panic("icode: spawn /init: %e", r);
26 cprintf("icode: exiting\n");