break;
}
}
- argc -= optind;
- argv += optind;
- if (argc >= 1) {
- if (cf_name != NULL) {
+ if (!arg_error) {
+ argc -= optind;
+ argv += optind;
+ if (argc >= 1) {
+ if (cf_name != NULL) {
+ /*
+ * Input file name specified with "-r" *and* specified as a regular
+ * command-line argument.
+ */
+ cmdarg_err("File name specified both with -r and regular argument");
+ arg_error = TRUE;
+ } else {
+ /*
+ * Input file name not specified with "-r", and a command-line argument
+ * was specified; treat it as the input file name.
+ *
+ * Yes, this is different from tshark, where non-flag command-line
+ * arguments are a filter, but this works better on GUI desktops
+ * where a command can be specified to be run to open a particular
+ * file - yes, you could have "-r" as the last part of the command,
+ * but that's a bit ugly.
+ */
+ cf_name = g_strdup(argv[0]);
+ }
+ argc--;
+ argv++;
+ }
+
+ if (argc != 0) {
/*
- * Input file name specified with "-r" *and* specified as a regular
- * command-line argument.
+ * Extra command line arguments were specified; complain.
*/
- cmdarg_err("File name specified both with -r and regular argument");
+ cmdarg_err("Invalid argument: %s", argv[0]);
arg_error = TRUE;
- } else {
- /*
- * Input file name not specified with "-r", and a command-line argument
- * was specified; treat it as the input file name.
- *
- * Yes, this is different from tshark, where non-flag command-line
- * arguments are a filter, but this works better on GUI desktops
- * where a command can be specified to be run to open a particular
- * file - yes, you could have "-r" as the last part of the command,
- * but that's a bit ugly.
- */
- cf_name = g_strdup(argv[0]);
}
- argc--;
- argv++;
- }
-
- if (argc != 0) {
- /*
- * Extra command line arguments were specified; complain.
- */
- cmdarg_err("Invalid argument: %s", argv[0]);
- arg_error = TRUE;
}
-
if (arg_error) {
#ifndef HAVE_LIBPCAP
if (capture_option_specified) {