aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2010-05-07 19:24:32 +0000
committerGuy Harris <guy@alum.mit.edu>2010-05-07 19:24:32 +0000
commit077ff72ac19c4c48a47f914615f3ddc50b086c72 (patch)
tree2489e60d99c5ab28316218fa2841a88a89fe8a18 /tshark.c
parent66f101f10fd9f48d543060f16f8f66de2de62a67 (diff)
As with the list of data link types, so with the list of interfaces; move
the code to print the machine-readable format into dumpcap, and have the code in capture_opts.c just print the human-readable format. svn path=/trunk/; revision=32714
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/tshark.c b/tshark.c
index 3ed559c92d..f4802bcb64 100644
--- a/tshark.c
+++ b/tshark.c
@@ -757,6 +757,8 @@ main(int argc, char *argv[])
gboolean list_link_layer_types = FALSE;
gboolean start_capture = FALSE;
int status;
+ GList *if_list;
+ gchar *err_str;
#else
gboolean capture_option_specified = FALSE;
#endif
@@ -1046,8 +1048,23 @@ main(int argc, char *argv[])
#endif
case 'D': /* Print a list of capture devices and exit */
#ifdef HAVE_LIBPCAP
- status = capture_opts_list_interfaces(FALSE);
- exit(status);
+ if_list = capture_interface_list(&err, &err_str);
+ if (if_list == NULL) {
+ switch (err) {
+ case CANT_GET_INTERFACE_LIST:
+ cmdarg_err("%s", err_str);
+ g_free(err_str);
+ break;
+
+ case NO_INTERFACES_FOUND:
+ cmdarg_err("There are no interfaces on which a capture can be done");
+ break;
+ }
+ exit(2);
+ }
+ capture_opts_print_interfaces(if_list);
+ free_interface_list(if_list);
+ exit(0);
#else
capture_option_specified = TRUE;
arg_error = TRUE;