TFshark requires a file to be specified.
It's not a capture program, so you can't say "capture on this interface"; you need a file to read. Change-Id: I8498001e06974ecd4678a48ac7b17f6fc60f7911 Reviewed-on: https://code.wireshark.org/review/25890 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
0347538758
commit
e090683aff
20
tfshark.c
20
tfshark.c
|
@ -79,6 +79,7 @@
|
|||
#endif
|
||||
|
||||
#define INVALID_OPTION 1
|
||||
#define NO_FILE_SPECIFIED 1
|
||||
#define INIT_ERROR 2
|
||||
#define INVALID_FILTER 2
|
||||
#define OPEN_ERROR 2
|
||||
|
@ -818,12 +819,16 @@ main(int argc, char *argv[])
|
|||
goto clean_exit;
|
||||
}
|
||||
|
||||
/* If no capture filter or display filter has been specified, and there are
|
||||
still command-line arguments, treat them as the tokens of a capture
|
||||
filter (if no "-r" flag was specified) or a display filter (if a "-r"
|
||||
flag was specified. */
|
||||
/* We require a -r flag specifying a file to read. */
|
||||
if (cf_name == NULL) {
|
||||
cmdarg_err("A file to read must be specified with \"-r\".");
|
||||
exit_status = NO_FILE_SPECIFIED;
|
||||
goto clean_exit;
|
||||
}
|
||||
|
||||
/* If no display filter has been specified, and there are still command-
|
||||
line arguments, treat them as the tokens of a display filter. */
|
||||
if (optind < argc) {
|
||||
if (cf_name != NULL) {
|
||||
if (dfilter != NULL) {
|
||||
cmdarg_err("Display filters were specified both with \"-d\" "
|
||||
"and with additional command-line arguments.");
|
||||
|
@ -832,7 +837,6 @@ main(int argc, char *argv[])
|
|||
}
|
||||
dfilter = get_args_as_string(argc, argv, optind);
|
||||
}
|
||||
}
|
||||
|
||||
/* if "-q" wasn't specified, we should print packet information */
|
||||
if (!quiet)
|
||||
|
@ -941,9 +945,8 @@ main(int argc, char *argv[])
|
|||
we're using any taps that need dissection. */
|
||||
do_dissection = print_packet_info || rfcode || dfcode || tap_listeners_require_dissection();
|
||||
|
||||
if (cf_name) {
|
||||
/*
|
||||
* We're reading a capture file.
|
||||
* Read the file.
|
||||
*/
|
||||
|
||||
/* TODO: if tfshark is ever changed to give the user a choice of which
|
||||
|
@ -983,7 +986,6 @@ main(int argc, char *argv[])
|
|||
read some packets; however, we exit with an error status. */
|
||||
exit_status = 2;
|
||||
}
|
||||
}
|
||||
|
||||
g_free(cf_name);
|
||||
|
||||
|
|
Loading…
Reference in New Issue