Skip to content

Commit

Permalink
Add a --version option to output just version
Browse files Browse the repository at this point in the history
  • Loading branch information
philwhineray committed Nov 15, 2015
1 parent 84a06f6 commit 0eadf37
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions iprange.c
Original file line number Diff line number Diff line change
Expand Up @@ -2320,6 +2320,9 @@ static void usage(const char *me) {
" -v\n"
" be verbose on stderr\n"
"\n"
" --version\n"
" print version\n"
"\n"
" --help\n"
" -h\n"
" print this message\n"
Expand Down Expand Up @@ -2358,6 +2361,19 @@ static void usage(const char *me) {
exit(1);
}


/* ----------------------------------------------------------------------------
* version()
*
* print version for the user
*
*/

static void version() {
fprintf(stdout, "%s\n", VERSION);
exit(1);
}

#define MODE_COMBINE 1
#define MODE_COMPARE 2
#define MODE_COMPARE_FIRST 3
Expand Down Expand Up @@ -2521,6 +2537,9 @@ int main(int argc, char **argv) {
strncpy(histogram_dir, argv[++i], FILENAME_MAX);
}
*/
else if(!strcmp(argv[i], "--version")) {
version();
}
else if(!strcmp(argv[i], "--help")
|| !strcmp(argv[i], "-h")) {
usage(argv[0]);
Expand Down

0 comments on commit 0eadf37

Please sign in to comment.