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:
parent
a469ae41a2
commit
c083462a63
@ -40,7 +40,7 @@ int parse_arguments(const int argc, const char *const *const argv,
|
|||||||
for (int i = 1, pos = 0; i < argc; ++i)
|
for (int i = 1, pos = 0; i < argc; ++i)
|
||||||
if (argv[i][0] == '-') {
|
if (argv[i][0] == '-') {
|
||||||
size_t l = strlen(argv[i]);
|
size_t l = strlen(argv[i]);
|
||||||
if (l < 2)
|
if (l == 1)
|
||||||
return 99;
|
return 99;
|
||||||
if (argv[i][1] == 'h' || (argv[i][1] == '-' && l > 2 && argv[i][2] == 'h'))
|
if (argv[i][1] == 'h' || (argv[i][1] == '-' && l > 2 && argv[i][2] == 'h'))
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user