diff options
| author | _ov4 <ov4@ov4.org> | 2026-08-11 10:33:39 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-08-11 10:33:39 +0000 |
| commit | 9d8cd99dfa156fa48801aa8bc7821c62d023fe80 (patch) | |
| tree | ff51e3196dabd1a928962f64a2a05006b5c7f1b3 /myspin.c | |
| parent | 3658a796b6013d2129c0895e9cb994fcdc9662ef (diff) | |
init
Diffstat (limited to 'myspin.c')
| -rw-r--r-- | myspin.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/myspin.c b/myspin.c new file mode 100644 index 0000000..08c3e0c --- /dev/null +++ b/myspin.c @@ -0,0 +1,24 @@ +/* + * myspin.c - A handy program for testing your tiny shell + * + * usage: myspin <n> + * Sleeps for <n> seconds in 1-second chunks. + * + */ +#include <stdio.h> +#include <unistd.h> +#include <stdlib.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]); + for (i=0; i < secs; i++) + sleep(1); + exit(0); +} |
