From 40f10de9f5d81bcded62f80bd2931e43a6bb4ee1 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Mon, 9 Aug 2021 22:15:19 +0200 Subject: [PATCH] fix: help unknown option --- discspan.c | 7 +++++-- help.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/discspan.c b/discspan.c index f22e73d..fce4b6b 100644 --- a/discspan.c +++ b/discspan.c @@ -29,7 +29,7 @@ param_t readArgument(int argc, char *argv[]) const unsigned long long cd = 734003200; int c = 0; - while ((c = getopt(argc, argv, ":59bcf:i:o:")) != -1) { + while ((c = getopt(argc, argv, ":59bcf:hi:o:")) != -1) { switch (c) { case 'i': parameter.input = optarg; @@ -53,6 +53,9 @@ param_t readArgument(int argc, char *argv[]) parameter.split = atoll(optarg); break; case 'h': + useage(); + exit(0); + break; default: printf("WARNUNG: Parameter -%c unbekannt!\n", optopt); break; @@ -88,7 +91,7 @@ int main(int argc, char *argv[]) if (parameter.input == NULL || parameter.output == NULL || parameter.split < 2048) { - usage(); + useage(); exit(1); } diff --git a/help.c b/help.c index 3ca1895..32d11f1 100644 --- a/help.c +++ b/help.c @@ -1,7 +1,7 @@ #include #include "help.h" -void usage() +void useage() { printf("\nUsage: discspan