diff options
| author | 2020-06-05 17:07:14 +0200 | |
|---|---|---|
| committer | 2020-06-05 17:07:14 +0200 | |
| commit | d417d386f875bd81cad539c4e089d6670b06ee4d (patch) | |
| tree | 6417764092df48aa891abf00e5d9a0db87a8f014 | |
| parent | e64fbba33a3ca1c3194fb93322feb1b19169878c (diff) | |
| download | libplist-d417d386f875bd81cad539c4e089d6670b06ee4d.tar.gz libplist-d417d386f875bd81cad539c4e089d6670b06ee4d.tar.bz2 | |
plistutil: Add new "--version" option to output version information
| -rw-r--r-- | tools/plistutil.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/plistutil.c b/tools/plistutil.c index 9c503b7..736e3e7 100644 --- a/tools/plistutil.c +++ b/tools/plistutil.c | |||
| @@ -58,6 +58,7 @@ static void print_usage(int argc, char *argv[]) | |||
| 58 | printf(" -o, --outfile FILE Optional FILE to convert to or stdout if - or not used\n"); | 58 | printf(" -o, --outfile FILE Optional FILE to convert to or stdout if - or not used\n"); |
| 59 | printf(" -f, --format [bin|xml] Force output format, regardless of input type\n"); | 59 | printf(" -f, --format [bin|xml] Force output format, regardless of input type\n"); |
| 60 | printf(" -d, --debug Enable extended debug output\n"); | 60 | printf(" -d, --debug Enable extended debug output\n"); |
| 61 | printf(" -v, --version Print version information\n"); | ||
| 61 | printf("\n"); | 62 | printf("\n"); |
| 62 | printf("Homepage: <" PACKAGE_URL ">\n"); | 63 | printf("Homepage: <" PACKAGE_URL ">\n"); |
| 63 | printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n"); | 64 | printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n"); |
| @@ -123,6 +124,11 @@ static options_t *parse_arguments(int argc, char *argv[]) | |||
| 123 | free(options); | 124 | free(options); |
| 124 | return NULL; | 125 | return NULL; |
| 125 | } | 126 | } |
| 127 | else if (!strcmp(argv[i], "--version") || !strcmp(argv[i], "-v")) | ||
| 128 | { | ||
| 129 | printf("plistutil %s\n", PACKAGE_VERSION); | ||
| 130 | exit(EXIT_SUCCESS); | ||
| 131 | } | ||
| 126 | else | 132 | else |
| 127 | { | 133 | { |
| 128 | printf("ERROR: Invalid option '%s'\n", argv[i]); | 134 | printf("ERROR: Invalid option '%s'\n", argv[i]); |
