From dac5b0a7de38f0584cc27ff188bdf9f0813ddefb Mon Sep 17 00:00:00 2001 From: Sparchatus Date: Wed, 23 Mar 2022 10:23:33 +0000 Subject: [PATCH] Added catch command to hello.c --- usr/hello/hello.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/usr/hello/hello.c b/usr/hello/hello.c index 7da2450..34d9357 100644 --- a/usr/hello/hello.c +++ b/usr/hello/hello.c @@ -15,17 +15,30 @@ #include +#include +#include #include +#define HELLO_CATCH_COMMAND "catch" + int main(int argc, char *argv[]) { - printf("Hello, world! from userspace\n"); + printf("Hello, world!\n"); printf("argv:\n"); for(int i = 0; i < argc; ++i) { printf(" %d -> %s\n", i, argv[i]); } + // if we receive the catch command, RUN! + if (argc > 1 && !strncmp(argv[1], HELLO_CATCH_COMMAND, sizeof(HELLO_CATCH_COMMAND))) { + while(1) { + printf("Catch me if you can!\n"); + // wait for 1 second + sleep(1); + } + } + return EXIT_SUCCESS; }