aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-12-19 21:19:38 +0100
committerPeter Wu <peter@lekensteyn.nl>2018-12-19 21:50:54 +0000
commit7fd62bfb6557364bdac3f75660112dc722915792 (patch)
tree93886c40a84e3ce617320622b07ded7cb5bbe9cd /tshark.c
parentf6fb8c876f4fc91f97e4bdca8241dda05795b44a (diff)
tshark: handle option -c when ENABLE_PCAP=OFF
Option '-c' is not only a capture option, it also affects offline reads as documented in the tshark manual. Fixes failing tests since v2.9.1rc0-18-g5bf37f63a8 ("text2pcap: allow to set interface name"). Change-Id: Iffe4fd60f62766282e1a8b02a942673ba4e605f0 Reviewed-on: https://code.wireshark.org/review/31130 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tshark.c b/tshark.c
index e02b61b663..1187050ac9 100644
--- a/tshark.c
+++ b/tshark.c
@@ -703,6 +703,7 @@ real_main(int argc, char *argv[])
gchar *err_str;
#else
gboolean capture_option_specified = FALSE;
+ int max_packet_count = 0;
#endif
gboolean quiet = FALSE;
#ifdef PCAP_NG_DEFAULT
@@ -1091,6 +1092,8 @@ real_main(int argc, char *argv[])
* file.
*/
output_file_name = g_strdup(optarg);
+ } else if (opt == 'c') {
+ max_packet_count = get_positive_int(optarg, "packet count");
} else {
capture_option_specified = TRUE;
arg_error = TRUE;
@@ -2021,7 +2024,7 @@ real_main(int argc, char *argv[])
global_capture_opts.has_autostop_packets ? global_capture_opts.autostop_packets : 0,
global_capture_opts.has_autostop_filesize ? global_capture_opts.autostop_filesize : 0);
#else
- success = process_cap_file(&cfile, output_file_name, out_file_type, out_file_name_res, 0, 0);
+ success = process_cap_file(&cfile, output_file_name, out_file_type, out_file_name_res, max_packet_count, 0);
#endif
}
CATCH(OutOfMemoryError) {