Skip to content

Commit a171bb1

Browse files
authored
tac: don't print version number in usage string
* If I type a bad option I want to see the correct options, not the program version * As done in other scripts using getopts(), support --version option by adding a VERSION_MESSAGE() function
1 parent b30249e commit a171bb1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bin/tac

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ print while <$fh>;
6060
exit EX_FAILURE if $fh->get_error;
6161
exit EX_SUCCESS;
6262

63-
sub usage {
63+
sub VERSION_MESSAGE {
6464
warn "$Program version $VERSION\n";
65+
exit 0;
66+
}
67+
68+
sub usage {
6569
warn "usage: $Program [-Bbr] [-s separator] [-S bytes] [file...]\n";
6670
exit EX_FAILURE;
6771
}

0 commit comments

Comments
 (0)