diff options
author | Nikias Bassen | 2020-06-05 17:06:39 +0200 |
---|---|---|
committer | Nikias Bassen | 2020-06-05 17:06:39 +0200 |
commit | e64fbba33a3ca1c3194fb93322feb1b19169878c (patch) | |
tree | 57fc59309c0738c363820ccada53a542a2b478ee /tools/plistutil.c | |
parent | d237e7125a6b19226598f4e53ae1455cff13f149 (diff) | |
download | libplist-e64fbba33a3ca1c3194fb93322feb1b19169878c.tar.gz libplist-e64fbba33a3ca1c3194fb93322feb1b19169878c.tar.bz2 |
plistutil: Fix option parsing
Diffstat (limited to 'tools/plistutil.c')
-rw-r--r-- | tools/plistutil.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/tools/plistutil.c b/tools/plistutil.c index e439d13..9c503b7 100644 --- a/tools/plistutil.c +++ b/tools/plistutil.c @@ -84,8 +84,7 @@ static options_t *parse_arguments(int argc, char *argv[]) i++; continue; } - - if (!strcmp(argv[i], "--outfile") || !strcmp(argv[i], "-o")) + else if (!strcmp(argv[i], "--outfile") || !strcmp(argv[i], "-o")) { if ((i + 1) == argc) { @@ -96,8 +95,7 @@ static options_t *parse_arguments(int argc, char *argv[]) i++; continue; } - - if (!strcmp(argv[i], "--format") || !strcmp(argv[i], "-f")) + else if (!strcmp(argv[i], "--format") || !strcmp(argv[i], "-f")) { if ((i + 1) == argc) { @@ -116,14 +114,18 @@ static options_t *parse_arguments(int argc, char *argv[]) i++; continue; } - - if (!strcmp(argv[i], "--debug") || !strcmp(argv[i], "-d")) + else if (!strcmp(argv[i], "--debug") || !strcmp(argv[i], "-d")) { options->debug = 1; } - - if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) + else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) + { + free(options); + return NULL; + } + else { + printf("ERROR: Invalid option '%s'\n", argv[i]); free(options); return NULL; } |