aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-04-05 16:42:35 -0700
committerGuy Harris <guy@alum.mit.edu>2015-04-05 23:43:01 +0000
commitd4bfa9c43b05ccbdef212f55fb56b73a5033e5f6 (patch)
tree50d7e2029b9a8f002cd2e808bdf695a76a1173db /tshark.c
parent24af6eeeea3828bbf4e41ad70377aabc3f26252e (diff)
Have a common routine for constructing strings listing interfaces.
We have a bunch of duplicated code to make those lists; make a common routine for that. (dumpcap currently doesn't use it, as the routine in question uses a routine in libui, which dumpcap doesn't use. We should probably fix that.) Change-Id: I9058bf3320d420b8713e90743618972da1d1c6ed Reviewed-on: https://code.wireshark.org/review/7934 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/tshark.c b/tshark.c
index acc87e7b37..445d6ce624 100644
--- a/tshark.c
+++ b/tshark.c
@@ -2418,7 +2418,7 @@ capture(void)
{
gboolean ret;
guint i;
- GString *str = g_string_new("");
+ GString *str;
#ifdef USE_TSHARK_SELECT
fd_set readfds;
#endif
@@ -2477,30 +2477,7 @@ capture(void)
global_capture_opts.ifaces = g_array_remove_index(global_capture_opts.ifaces, i);
g_array_insert_val(global_capture_opts.ifaces, i, interface_opts);
}
-#ifdef _WIN32
- if (global_capture_opts.ifaces->len < 2)
-#else
- if (global_capture_opts.ifaces->len < 4)
-#endif
- {
- for (i = 0; i < global_capture_opts.ifaces->len; i++) {
- interface_options interface_opts;
-
- interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, i);
- if (i > 0) {
- if (global_capture_opts.ifaces->len > 2) {
- g_string_append_printf(str, ",");
- }
- g_string_append_printf(str, " ");
- if (i == global_capture_opts.ifaces->len - 1) {
- g_string_append_printf(str, "and ");
- }
- }
- g_string_append_printf(str, "'%s'", interface_opts.descr);
- }
- } else {
- g_string_append_printf(str, "%u interfaces", global_capture_opts.ifaces->len);
- }
+ str = get_iface_list_string(&global_capture_opts, IFLIST_QUOTE_IF_DESCRIPTION);
if (really_quiet == FALSE)
fprintf(stderr, "Capturing on %s\n", str->str);
fflush(stderr);