Fix various typos and spelling errors.
[obnox/wireshark/wip.git] / capture_opts.c
index 23297b60eb7d7b083bc2e4b74a06d6d6f71d59d3..793477c99770639500bff7c227d2ac847a6847e9 100644 (file)
@@ -85,6 +85,7 @@ capture_opts_init(capture_options *capture_opts, void *cf)
   capture_opts->linktype                = -1;               /* the default linktype */
   capture_opts->saving_to_file          = FALSE;
   capture_opts->save_file               = NULL;
+  capture_opts->group_read_access       = FALSE;
   capture_opts->use_pcapng              = FALSE;            /* the default is pcap */
   capture_opts->real_time_mode          = TRUE;
   capture_opts->show_info               = TRUE;
@@ -159,6 +160,7 @@ capture_opts_log(const char *log_domain, GLogLevelFlags log_level, capture_optio
     g_log(log_domain, log_level, "LinkType           : %d", capture_opts->linktype);
     g_log(log_domain, log_level, "SavingToFile       : %u", capture_opts->saving_to_file);
     g_log(log_domain, log_level, "SaveFile           : %s", (capture_opts->save_file) ? capture_opts->save_file : "");
+    g_log(log_domain, log_level, "GroupReadAccess    : %u", capture_opts->group_read_access);
     g_log(log_domain, log_level, "Fileformat         : %s", (capture_opts->use_pcapng) ? "PCAPNG" : "PCAP");
     g_log(log_domain, log_level, "RealTimeMode       : %u", capture_opts->real_time_mode);
     g_log(log_domain, log_level, "ShowInfo           : %u", capture_opts->show_info);
@@ -267,7 +269,7 @@ get_ring_arguments(capture_options *capture_opts, const char *arg)
 
   if (strcmp(arg,"files") == 0) {
     capture_opts->has_ring_num_files = TRUE;
-    capture_opts->ring_num_files = get_natural_int(p, "number of ring buffer files");
+    capture_opts->ring_num_files = get_positive_int(p, "number of ring buffer files");
   } else if (strcmp(arg,"filesize") == 0) {
     capture_opts->has_autostop_filesize = TRUE;
     capture_opts->autostop_filesize = get_positive_int(p, "ring buffer filesize");
@@ -530,6 +532,9 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg_
 #endif
         status = capture_opts_output_to_pipe(capture_opts->save_file, &capture_opts->output_to_pipe);
         return status;
+    case 'g':        /* enable group read access on the capture file(s) */
+        capture_opts->group_read_access = TRUE;
+        break;
     case 'y':        /* Set the pcap data link type */
         capture_opts->linktype = linktype_name_to_val(optarg_str_p);
         if (capture_opts->linktype == -1) {
@@ -604,10 +609,15 @@ void capture_opts_trim_snaplen(capture_options *capture_opts, int snaplen_min)
 void capture_opts_trim_ring_num_files(capture_options *capture_opts)
 {
   /* Check the value range of the ring_num_files parameter */
-  if (capture_opts->ring_num_files > RINGBUFFER_MAX_NUM_FILES)
+  if (capture_opts->ring_num_files > RINGBUFFER_MAX_NUM_FILES) {
+    cmdarg_err("Too many ring buffer files (%u). Reducing to %u.\n", capture_opts->ring_num_files, RINGBUFFER_MAX_NUM_FILES);
     capture_opts->ring_num_files = RINGBUFFER_MAX_NUM_FILES;
+  } else if (capture_opts->ring_num_files > RINGBUFFER_WARN_NUM_FILES) {
+    cmdarg_err("%u is a lot of ring buffer files.\n", capture_opts->ring_num_files);
+  }
 #if RINGBUFFER_MIN_NUM_FILES > 0
   else if (capture_opts->ring_num_files < RINGBUFFER_MIN_NUM_FILES)
+    cmdarg_err("Too few ring buffer files (%u). Increasing to %u.\n", capture_opts->ring_num_files, RINGBUFFER_MIN_NUM_FILES);
     capture_opts->ring_num_files = RINGBUFFER_MIN_NUM_FILES;
 #endif
 }