blob: f61e1a7da2461ea4c78d96431ba6e3084eee81bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/** @file 410user/progs/init.c
* @author ?
* @brief Initial program.
* @public yes
* @for p2 p3
* @covers fork exec wait print
* @status done
*/
#include <syscall.h>
#include <stdio.h>
int main()
{
int pid, exitstatus;
char shell[] = "shell";
char * args[] = {shell, 0};
while(1) {
pid = fork();
if (!pid)
exec(shell, args);
while (pid != wait(&exitstatus));
printf("Shell exited with status %d; starting it back up...", exitstatus);
}
}
|