diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | output.c | 21 |
3 files changed, 23 insertions, 1 deletions
@@ -74,3 +74,4 @@ myspin mysplit mystop tsh +output @@ -11,7 +11,7 @@ CXX = g++ CXXFLAGS = -std=c++17 -Wall -Wno-write-strings -O2 CC = gcc CFLAGS = -Wall -O2 -FILES = $(TSH) ./myspin ./mysplit ./mystop ./myint +FILES = $(TSH) ./myspin ./mysplit ./mystop ./myint ./output all: $(FILES) diff --git a/output.c b/output.c new file mode 100644 index 0000000..bba2760 --- /dev/null +++ b/output.c @@ -0,0 +1,21 @@ +#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++) + { + printf("%d\n", i); + fflush(stdout); + sleep(1); + } + exit(0); +} |
