Print out messages if any of the ring buffer checks fail.
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 21 Dec 2001 20:33:47 +0000 (20:33 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 21 Dec 2001 20:33:47 +0000 (20:33 +0000)
Do the ring buffer checks at the same time other command-line argument
checks are done.

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

gtk/main.c

index d9b9f35abaa51ac8cc73ec5c97c3c4163e17db99..4dcc21a8e5e3bd291abad144cfcd5f2aea8795ef 100644 (file)
@@ -1,6 +1,6 @@
 /* main.c
  *
- * $Id: main.c,v 1.220 2001/12/21 20:18:40 guy Exp $
+ * $Id: main.c,v 1.221 2001/12/21 20:33:47 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -1365,6 +1365,27 @@ main(int argc, char *argv[])
     arg_error = TRUE;
   }
 
+  if (cfile.ringbuffer_on) {
+    /* Ring buffer works only under certain conditions:
+       a) ring buffer does not work with temporary files;
+       b) prefs->capture_real_time and cfile.ringbuffer_on are mutually
+          exclusive - prefs->capture_real_time takes precedence;
+       c) it makes no sense to enable the ring buffer if the maximum
+          file size is set to "infinite". */
+    if (cfile.save_file == NULL) {
+      fprintf(stderr, "ethereal: Ring buffer requested, but capture isn't being saved to a permanent file.\n");
+      cfile.ringbuffer_on = FALSE;
+    }
+    if (prefs->capture_real_time == TRUE) {
+      fprintf(stderr, "ethereal: Ring buffer requested, but an \"Update list of packets in real time\" capture is being done.\n");
+      cfile.ringbuffer_on = FALSE;
+    }
+    if (cfile.autostop_filesize == 0) {
+      fprintf(stderr, "ethereal: Ring buffer requested, but no maximum capture file size was specified.\n");
+      cfile.ringbuffer_on = FALSE;
+    }
+  }
+
 #ifdef WIN32
   /* Load wpcap if possible */
   load_wpcap();
@@ -1438,21 +1459,6 @@ main(int argc, char *argv[])
   else if (cfile.snap < MIN_PACKET_SIZE)
     cfile.snap = MIN_PACKET_SIZE;
   
-  if (cfile.ringbuffer_on == TRUE) {
-    /* Ringbuffer works just under certain conditions: 
-       a) prefs->capture_real_time and cfile.ringbuffer_on are mutially 
-          exclusive. prefs->capture_real_time takes precedence. 
-       b) Ringbuffer does not work with temporary files
-       c) It makes no sense to enable the ringbuffer if the maximum
-           file size is set to infinite */
-    if (prefs->capture_real_time == TRUE ||
-        cfile.save_file == NULL ||
-        cfile.autostop_filesize == 0) {
-      /* turn ringbuffer off */
-      cfile.ringbuffer_on = FALSE;
-    }
-  }
-
   /* Check the value range of the ringbuffer_num_files parameter */
   if (cfile.ringbuffer_num_files < RINGBUFFER_MIN_NUM_FILES)
     cfile.ringbuffer_num_files = RINGBUFFER_MIN_NUM_FILES;