Commit e64fbba3 authored by Nikias Bassen's avatar Nikias Bassen

plistutil: Fix option parsing

parent d237e712
...@@ -84,8 +84,7 @@ static options_t *parse_arguments(int argc, char *argv[]) ...@@ -84,8 +84,7 @@ static options_t *parse_arguments(int argc, char *argv[])
i++; i++;
continue; continue;
} }
else if (!strcmp(argv[i], "--outfile") || !strcmp(argv[i], "-o"))
if (!strcmp(argv[i], "--outfile") || !strcmp(argv[i], "-o"))
{ {
if ((i + 1) == argc) if ((i + 1) == argc)
{ {
...@@ -96,8 +95,7 @@ static options_t *parse_arguments(int argc, char *argv[]) ...@@ -96,8 +95,7 @@ static options_t *parse_arguments(int argc, char *argv[])
i++; i++;
continue; continue;
} }
else if (!strcmp(argv[i], "--format") || !strcmp(argv[i], "-f"))
if (!strcmp(argv[i], "--format") || !strcmp(argv[i], "-f"))
{ {
if ((i + 1) == argc) if ((i + 1) == argc)
{ {
...@@ -116,14 +114,18 @@ static options_t *parse_arguments(int argc, char *argv[]) ...@@ -116,14 +114,18 @@ static options_t *parse_arguments(int argc, char *argv[])
i++; i++;
continue; continue;
} }
else if (!strcmp(argv[i], "--debug") || !strcmp(argv[i], "-d"))
if (!strcmp(argv[i], "--debug") || !strcmp(argv[i], "-d"))
{ {
options->debug = 1; options->debug = 1;
} }
else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h"))
if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
free(options);
return NULL;
}
else
{ {
printf("ERROR: Invalid option '%s'\n", argv[i]);
free(options); free(options);
return NULL; return NULL;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment