Skip to content

Commit ba0ce36

Browse files
committed
gpujpegtool: option to print version
1 parent 28f08ff commit ba0ce36

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ print_help(void)
8080
" -a --alpha encode/decode alpha channel (otherwise stripped)\n"
8181
" -N --native create native JPEG (Adobe RGB for RGB, SPIFF for Y709;\n"
8282
" may be incompatible with some decoders;\n"
83-
" works also for decoding)\n");
83+
" works also for decoding)\n"
84+
" -V --version print GPUJPEG version\n"
85+
);
8486
printf("recognized raw input/output file extensions: rgb, yuv, pnm... (use`gpujpegtool exts` for the full list)\n");
8587
}
8688

@@ -287,12 +289,13 @@ main(int argc, char *argv[])
287289
{"use-opengl", no_argument, 0, 'o' },
288290
{"info", required_argument, 0, 'I' },
289291
{"native", no_argument, 0, 'N' },
292+
{"version", no_argument, 0, 'V' },
290293
{0}
291294
};
292295
int ch = '\0';
293296
int optindex = 0;
294297
char* pos = 0;
295-
while ( (ch = getopt_long(argc, argv, "CLRahvD:s:f:c:q:r:g::i::edn:oI:NS::", longopts, &optindex)) != -1 ) {
298+
while ( (ch = getopt_long(argc, argv, "CLRahvD:s:f:c:q:r:g::i::edn:oI:NS::V", longopts, &optindex)) != -1 ) {
296299
switch (ch) {
297300
case 'a':
298301
opts.keep_alpha = true;
@@ -398,6 +401,8 @@ main(int argc, char *argv[])
398401
case 'N':
399402
opts.native_file_format = true;
400403
break;
404+
case 'V':
405+
return 0; // already printed, just exit
401406
case '?':
402407
return -1;
403408
default:

0 commit comments

Comments
 (0)