diff options
| author | _ov4 <ov4@ov4.org> | 2026-08-11 10:25:46 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-08-11 10:25:46 +0000 |
| commit | 8370ecfb22fcdb3f0a9b76b5fdb0b7000725ebdc (patch) | |
| tree | 09ffb7693cd03ad76059d151471e149fac4ad1e9 /shlab-handout/mysplit.c | |
| parent | c13b300279d10e8b0700312b6bff2af872474c46 (diff) | |
1
Diffstat (limited to 'shlab-handout/mysplit.c')
| -rw-r--r-- | shlab-handout/mysplit.c | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/shlab-handout/mysplit.c b/shlab-handout/mysplit.c deleted file mode 100644 index 9ac016e..0000000 --- a/shlab-handout/mysplit.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * mysplit.c - Another handy routine for testing your tiny shell - * - * usage: mysplit <n> - * Fork a child that spins for <n> seconds in 1-second chunks. - */ -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <signal.h> - -int main(int argc, char **argv) -{ - int i, secs; - - if (argc != 2) { - fprintf(stderr, "Usage: %s <n>\n", argv[0]); - exit(0); - } - secs = atoi(argv[1]); - - - if (fork() == 0) { /* child */ - for (i=0; i < secs; i++) - sleep(1); - exit(0); - } - - /* parent waits for child to terminate */ - wait(NULL); - - exit(0); -} |
