8000 read_minix/minix/tests/t40c.c at master · LegendGC/read_minix · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
179 lines (143 loc) · 5.47 KB

t40c.c

File metadata and controls

179 lines (143 loc) · 5.47 KB
close(terminal);
waitpid(child, &retval, 0);
exit(errct);
}
int main(int argc, char **argv) {
int forkres;
int master, slave;
/* Get subtest number */
if(argc != 2) {
printf("Usage: %s subtest_no\n", argv[0]);
exit(-1);
} else if(sscanf(argv[1], "%d", &subtest) != 1) {
printf("Usage: %s subtest_no\n", argv[0]);
exit(-1);
}
open_terminal(&master, &slave);
forkres = fork();
if(forkres == 0) do_child(master);
else if(forkres > 0) do_parent(forkres, slave);
else { /* Fork failed */
perror("Unable to fork");
exit(-1);
}
exit(-2); /* We're not supposed to get here. Both do_* routines should exit*/
}
0