diff --git a/main.c b/main.c index e6c59e2..dc8aebc 100644 --- a/main.c +++ b/main.c @@ -39,9 +39,12 @@ int parse_arguments(const int argc, const char *const *const argv, for (int i = 1, pos = 0; i < argc; ++i) if (argv[i][0] == '-') { - if (argv[i][1] == 'h' || argv[i][2] == 'h') + size_t l = strlen(argv[i]); + if (l < 2) + return 99; + if (argv[i][1] == 'h' || (argv[i][1] == '-' && l > 2 && argv[i][2] == 'h')) return 1; - else if (argv[i][1] == 'v' || argv[i][2] == 'v') + else if (argv[i][1] == 'v' || (argv[i][1] == '-' && l > 2 && argv[i][2] == 'v')) return 2; else return 99;