From 7fd62bfb6557364bdac3f75660112dc722915792 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Wed, 19 Dec 2018 21:19:38 +0100 Subject: 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 Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu --- tshark.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tshark.c') 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) { -- cgit v1.2.3