still serv_close bug...
[mit-jos.git] / user / initsh.c
blob25418888eed3b0cc6a18a0fafbb07cc5abb18c9d
1 #include <inc/lib.h>
3 void
4 umain(int argc, char **argv)
6 int i, r, x, want;
8 cprintf("initsh: running sh\n");
10 // being run directly from kernel, so no file descriptors open yet
11 close(0);
12 if ((r = opencons()) < 0)
13 panic("opencons: %e", r);
14 if (r != 0)
15 panic("first opencons used fd %d", r);
16 if ((r = dup(0, 1)) < 0)
17 panic("dup: %e", r);
18 while (1) {
19 cprintf("init: starting sh\n");
20 r = spawnl("/sh", "sh", (char*)0);
21 if (r < 0) {
22 cprintf("init: spawn sh: %e\n", r);
23 continue;
25 wait(r);