aboutsummaryrefslogtreecommitdiff
path: root/shlab-handout/myint.c
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-08-11 10:25:46 +0000
committer_ov4 <ov4@ov4.org>2026-08-11 10:25:46 +0000
commit8370ecfb22fcdb3f0a9b76b5fdb0b7000725ebdc (patch)
tree09ffb7693cd03ad76059d151471e149fac4ad1e9 /shlab-handout/myint.c
parentc13b300279d10e8b0700312b6bff2af872474c46 (diff)
1
Diffstat (limited to 'shlab-handout/myint.c')
-rw-r--r--shlab-handout/myint.c36
1 files changed, 0 insertions, 36 deletions
diff --git a/shlab-handout/myint.c b/shlab-handout/myint.c
deleted file mode 100644
index ea5bee1..0000000
--- a/shlab-handout/myint.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * myint.c - Another handy routine for testing your tiny shell
- *
- * usage: myint <n>
- * Sleeps for <n> seconds and sends SIGINT to itself.
- *
- */
-#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;
- pid_t pid;
-
- if (argc != 2) {
- fprintf(stderr, "Usage: %s <n>\n", argv[0]);
- exit(0);
- }
- secs = atoi(argv[1]);
-
- for (i=0; i < secs; i++)
- sleep(1);
-
- pid = getpid();
-
- if (kill(pid, SIGINT) < 0)
- fprintf(stderr, "kill (int) error");
-
- exit(0);
-
-}