diff options
author | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2014-06-20 14:48:27 -0400 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-06-21 01:05:02 +0000 |
commit | 3773a7561c79e3545fca664c2a25cf2312de0ada (patch) | |
tree | 083e9fda037f4811ebe3cf7aa9564ee57df33c9b /editcap.c | |
parent | c11ae8ac827afa50ef226ebaef134f54ac0e532b (diff) |
Add command-line argument to request the version to a number of the utilities.
In some cases "-v" was already used so "-V" is the option.
Note that the version information in these utilities is much shorter than what
is presented by the big programs.
As requested by https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5804
Bug: 5804
Change-Id: I35db35a4eace2797afd895f9be7322ef39928480
Reviewed-on: https://code.wireshark.org/review/2489
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'editcap.c')
-rw-r--r-- | editcap.c | 37 |
1 files changed, 24 insertions, 13 deletions
@@ -658,6 +658,16 @@ is_duplicate_rel_time(guint8* fd, guint32 len, const nstime_t *current) { } static void +print_version(FILE *output) +{ + fprintf(output, "Editcap %s" +#ifdef GITVERSION + " (" GITVERSION " from " GITBRANCH ")" +#endif + "\n", VERSION); +} + +static void usage(gboolean is_error) { FILE *output; @@ -667,11 +677,7 @@ usage(gboolean is_error) else output = stderr; - fprintf(output, "Editcap %s" -#ifdef GITVERSION - " (" GITVERSION " from " GITBRANCH ")" -#endif - "\n", VERSION); + print_version(output); fprintf(output, "Edit and/or translate the format of capture files.\n"); fprintf(output, "See http://www.wireshark.org for more information.\n"); fprintf(output, "\n"); @@ -899,7 +905,7 @@ main(int argc, char *argv[]) #endif /* Process the options */ - while ((opt = getopt(argc, argv, "A:B:c:C:dD:E:F:hi:Lrs:S:t:T:vw:")) != -1) { + while ((opt = getopt(argc, argv, "A:B:c:C:dD:E:F:hi:Lrs:S:t:T:vVw:")) != -1) { switch (opt) { case 'A': { @@ -1083,6 +1089,11 @@ main(int argc, char *argv[]) verbose = !verbose; /* Just invert */ break; + case 'V': + print_version(stdout); + exit(0); + break; + case 'w': dup_detect = FALSE; dup_detect_by_time = TRUE; @@ -1297,13 +1308,13 @@ main(int argc, char *argv[]) ts_okay = (phdr->ts.secs >= starttime) && (phdr->ts.secs < stoptime); else ts_okay = FALSE; - } else { - /* - * No selected timeframe, so all packets are "in the - * selected timeframe". - */ - ts_okay = TRUE; - } + } else { + /* + * No selected timeframe, so all packets are "in the + * selected timeframe". + */ + ts_okay = TRUE; + } if (ts_okay && ((!selected(count) && !keep_em) || (selected(count) && keep_em))) { |