Add monitor mode support to Wireshark *on the command line*; support
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 7 May 2010 01:55:13 +0000 (01:55 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 7 May 2010 01:55:13 +0000 (01:55 +0000)
through the GUI requires more work.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@32706 f5534014-38df-0310-8fa8-9805f1628bb7

gtk/main.c

index dc0755e00a004fdad91b3a275dbfea236a612ce7..528970606b91aee8519a4af1ad80188a62990580 100644 (file)
@@ -2019,16 +2019,25 @@ main(int argc, char *argv[])
 #endif
 #endif
 
-#define OPTSTRING_INIT "a:b:c:C:Df:g:Hhi:jJ:kK:lLm:nN:o:P:pQr:R:Ss:t:u:vw:X:y:z:"
+#ifdef HAVE_LIBPCAP
+#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#define OPTSTRING_B "B:"
+#else
+#define OPTSTRING_B ""
+#endif  /* _WIN32 or HAVE_PCAP_CREATE */
+#else /* HAVE_LIBPCAP */
+#define OPTSTRING_B ""
+#endif  /* HAVE_LIBPCAP */
 
-#if defined HAVE_LIBPCAP && defined HAVE_PCAP_CREATE
-#define OPTSTRING_EXTRA "B:"
+#ifdef HAVE_PCAP_CREATE
+#define OPTSTRING_I "I"
 #else
-#define OPTSTRING_EXTRA ""
+#define OPTSTRING_I ""
 #endif
 
-  char optstring[sizeof(OPTSTRING_INIT) + sizeof(OPTSTRING_EXTRA) - 1] =
-    OPTSTRING_INIT OPTSTRING_EXTRA;
+#define OPTSTRING "a:b:" OPTSTRING_B "c:C:Df:g:Hhi:" OPTSTRING_I "jJ:kK:lLm:nN:o:P:pQr:R:Ss:t:u:vw:X:y:z:"
+
+  static const char optstring[] = OPTSTRING;
 
   /*
    * Get credential information for later use, and drop privileges
@@ -2388,6 +2397,9 @@ main(int argc, char *argv[])
       case 'H':        /* Hide capture info dialog box */
       case 'i':        /* Use interface xxx */
       case 'p':        /* Don't capture in promiscuous mode */
+#ifdef HAVE_PCAP_CREATE
+      case 'I':        /* Capture in monitor mode, if available */
+#endif
       case 'Q':        /* Quit after capture (just capture to file) */
       case 's':        /* Set the snapshot (capture) length */
       case 'S':        /* "Sync" mode: used for following file ala tail -f */