Skip to content

Commit 631c916

Browse files
committed
Add -V flag to print application version
Signed-off-by: Igor Shishkin <[email protected]>
1 parent 0829c73 commit 631c916

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/pixz.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ static void usage(const char *msg) {
4444
" -t Don't assume input is in tar format\n"
4545
" -k Keep original input (do not remove it)\n"
4646
" -c ignored\n"
47+
" -V Print version and exit\n"
4748
" -h Print this help\n"
4849
"\n"
4950
"pixz %s\n"
@@ -56,6 +57,11 @@ static void usage(const char *msg) {
5657
exit(0);
5758
}
5859

60+
static void version() {
61+
fprintf(stderr, "pixz %s\n", PACKAGE_VERSION);
62+
exit(0);
63+
}
64+
5965
int main(int argc, char **argv) {
6066
uint32_t level = LZMA_PRESET_DEFAULT;
6167
bool tar = true;
@@ -80,6 +86,7 @@ int main(int argc, char **argv) {
8086
case 'k': keep_input = true; break;
8187
case 'h': usage(NULL); break;
8288
case 'e': extreme = true; break;
89+
case 'V': version(); break;
8390
case 'f':
8491
optdbl = strtod(optarg, &optend);
8592
if (*optend || optdbl <= 0)

0 commit comments

Comments
 (0)