aboutsummaryrefslogtreecommitdiff
path: root/shlab-handout/mysplit.c
diff options
context:
space:
mode:
Diffstat (limited to 'shlab-handout/mysplit.c')
-rw-r--r--shlab-handout/mysplit.c35
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);
-}