Add command-line argument to request the version to a number of the utilities.
[metze/wireshark/wip.git] / capinfos.c
index 811f5af8bd81799475a0e35b5aba4780d35f5780..e43fa049b5e49f01539f18b23c657ca2c9a85c9d 100644 (file)
@@ -991,6 +991,16 @@ process_cap_file(wtap *wth, const char *filename)
   return status;
 }
 
+static void
+print_version(FILE *output)
+{
+  fprintf(output, "Capinfos %s"
+#ifdef GITVERSION
+      " (" GITVERSION " from " GITBRANCH ")"
+#endif
+      "\n", VERSION);
+}
+
 static void
 usage(gboolean is_error)
 {
@@ -1004,11 +1014,7 @@ usage(gboolean is_error)
     output = stderr;
   }
 
-  fprintf(output, "Capinfos %s"
-#ifdef GITVERSION
-      " (" GITVERSION " from " GITBRANCH ")"
-#endif
-      "\n", VERSION);
+  print_version(output);
   fprintf(output, "Prints various information (infos) about capture files.\n");
   fprintf(output, "See http://www.wireshark.org for more information.\n");
   fprintf(output, "\n");
@@ -1352,6 +1358,11 @@ main(int argc, char *argv[])
         exit(0);
         break;
 
+      case 'v':
+        print_version(stdout);
+        exit(0);
+        break;
+
       case '?':              /* Bad flag - print usage message */
         usage(TRUE);
         exit(1);