simplify argument checking for tshark
authormartink <martink@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 1 Aug 2013 20:44:50 +0000 (20:44 +0000)
committermartink <martink@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 1 Aug 2013 20:44:50 +0000 (20:44 +0000)
if a capture file is read, do all corresponding checks in one place

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

tshark.c

index 30d9aa4102db720b40b0784546a01723d25dab05..fc6090b2632dc031cec5db7f070394d805d63008 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -1596,19 +1596,6 @@ main(int argc, char *argv[])
     return 1;
   }
 
-  /* We don't support capture filters when reading from a capture file
-     (the BPF compiler doesn't support all link-layer types that we
-     support in capture files we read). */
-#ifdef HAVE_LIBPCAP
-  if (cf_name != NULL) {
-    if (global_capture_opts.default_options.cfilter) {
-      cmdarg_err("Only read filters, not capture filters, "
-          "can be specified when reading a capture file.");
-      return 1;
-    }
-  }
-#endif
-
   if (print_hex) {
     if (output_action != WRITE_TEXT) {
       cmdarg_err("Raw packet hex data can only be printed as text or PostScript");
@@ -1655,6 +1642,15 @@ main(int argc, char *argv[])
        * "-r" was specified, so we're reading a capture file.
        * Capture options don't apply here.
        */
+
+      /* We don't support capture filters when reading from a capture file
+         (the BPF compiler doesn't support all link-layer types that we
+         support in capture files we read). */
+      if (global_capture_opts.default_options.cfilter) {
+        cmdarg_err("Only read filters, not capture filters, "
+          "can be specified when reading a capture file.");
+        return 1;
+      }
       if (global_capture_opts.multi_files_on) {
         cmdarg_err("Multiple capture files requested, but "
                    "a capture isn't being done.");