summaryrefslogtreecommitdiff
path: root/reordercap.c
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss.ws@gmail.com>2014-06-20 14:48:27 -0400
committerGuy Harris <guy@alum.mit.edu>2014-06-21 01:05:02 +0000
commit3773a7561c79e3545fca664c2a25cf2312de0ada (patch)
tree083e9fda037f4811ebe3cf7aa9564ee57df33c9b /reordercap.c
parentc11ae8ac827afa50ef226ebaef134f54ac0e532b (diff)
downloadwireshark-3773a7561c79e3545fca664c2a25cf2312de0ada.tar.gz
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 'reordercap.c')
-rw-r--r--reordercap.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/reordercap.c b/reordercap.c
index ce563bea72..7b107fa329 100644
--- a/reordercap.c
+++ b/reordercap.c
@@ -38,8 +38,21 @@
#include "wsutil/wsgetopt.h"
#endif
+#include "version.h"
+
+static void
+print_version(FILE *output)
+{
+ fprintf(output, "Reordercap %s"
+#ifdef GITVERSION
+ " (" GITVERSION " from " GITBRANCH ")"
+#endif
+ "\n", VERSION);
+}
+
/* Show command-line usage */
-static void usage(gboolean is_error)
+static void
+usage(gboolean is_error)
{
FILE *output;
@@ -50,11 +63,7 @@ static void usage(gboolean is_error)
output = stderr;
}
- fprintf(output, "Reordercap %s"
-#ifdef GITVERSION
- " (" GITVERSION " from " GITBRANCH ")"
-#endif
- "\n", VERSION);
+ print_version(output);
fprintf(output, "Reorder timestamps of input file frames into output file.\n");
fprintf(output, "See http://www.wireshark.org for more information.\n");
fprintf(output, "\n");
@@ -155,7 +164,8 @@ frames_compare(gconstpointer a, gconstpointer b)
/********************************************************************/
/* Main function. */
/********************************************************************/
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
{
wtap *wth = NULL;
wtap_dumper *pdh = NULL;
@@ -179,7 +189,7 @@ int main(int argc, char *argv[])
char *outfile;
/* Process the options first */
- while ((opt = getopt(argc, argv, "hn")) != -1) {
+ while ((opt = getopt(argc, argv, "hnv")) != -1) {
switch (opt) {
case 'n':
write_output_regardless = FALSE;
@@ -187,6 +197,9 @@ int main(int argc, char *argv[])
case 'h':
usage(FALSE);
exit(0);
+ case 'v':
+ print_version(stdout);
+ exit(0);
case '?':
usage(TRUE);
exit(1);