Actually, argv[i] cannot has a length of 0, so let's compare here against 1, meaning there was just a '-' was passed.

This commit is contained in:
Alexander Andreev 2024-05-19 05:23:47 +04:00
parent a469ae41a2
commit c083462a63
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34

View File

@ -40,7 +40,7 @@ int parse_arguments(const int argc, const char *const *const argv,
for (int i = 1, pos = 0; i < argc; ++i)
if (argv[i][0] == '-') {
size_t l = strlen(argv[i]);
if (l < 2)
if (l == 1)
return 99;
if (argv[i][1] == 'h' || (argv[i][1] == '-' && l > 2 && argv[i][2] == 'h'))
return 1;