Witness: enum witness_interface_state
[metze/wireshark/wip.git] / capture_opts.c
index 51b8be74ccd08a36081a77fd3bd121bbf9e704b0..4ab473a5700db2d2da7e1a6302089335f16ce313 100644 (file)
@@ -25,6 +25,7 @@
 #include "config.h"
 
 #include <stdio.h>
+#include <stdlib.h>
 
 #ifdef HAVE_LIBPCAP
 
@@ -64,7 +65,7 @@ capture_opts_init(capture_options *capture_opts)
   capture_opts->default_options.cfilter         = NULL;
   capture_opts->default_options.has_snaplen     = FALSE;
   capture_opts->default_options.snaplen         = WTAP_MAX_PACKET_SIZE;
-  capture_opts->default_options.linktype        = -1;
+  capture_opts->default_options.linktype        = -1; /* use interface default */
   capture_opts->default_options.promisc_mode    = TRUE;
 #if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
   capture_opts->default_options.buffer_size     = DEFAULT_CAPTURE_BUFFER_SIZE;
@@ -97,6 +98,7 @@ capture_opts_init(capture_options *capture_opts)
   capture_opts->show_info                       = TRUE;
   capture_opts->quit_after_cap                  = getenv("WIRESHARK_QUIT_AFTER_CAPTURE") ? TRUE : FALSE;
   capture_opts->restart                         = FALSE;
+  capture_opts->orig_save_file                  = NULL;
 
   capture_opts->multi_files_on                  = FALSE;
   capture_opts->has_file_duration               = FALSE;
@@ -109,7 +111,7 @@ capture_opts_init(capture_options *capture_opts)
   capture_opts->has_autostop_packets            = FALSE;
   capture_opts->autostop_packets                = 0;
   capture_opts->has_autostop_filesize           = FALSE;
-  capture_opts->autostop_filesize               = 1024;             /* 1 MB */
+  capture_opts->autostop_filesize               = 1000;             /* 1 MB */
   capture_opts->has_autostop_duration           = FALSE;
   capture_opts->autostop_duration               = 60;               /* 1 min */
   capture_opts->capture_comment                 = NULL;
@@ -627,6 +629,13 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg_
     int status, snaplen;
 
     switch(opt) {
+    case LONGOPT_NUM_CAP_COMMENT:  /* capture comment */
+        if (capture_opts->capture_comment) {
+            cmdarg_err("--capture-comment can be set only once per file");
+            return 1;
+        }
+        capture_opts->capture_comment = g_strdup(optarg_str_p);
+        break;
     case 'a':        /* autostop criteria */
         if (set_autostop_criterion(capture_opts, optarg_str_p) == FALSE) {
             cmdarg_err("Invalid or unknown -a flag \"%s\"", optarg_str_p);