Rename capture_opts_trim_iface() to

capture_opts_default_iface_if_necessary(), to reflect what it actually
does.

svn path=/trunk/; revision=49491
This commit is contained in:
Guy Harris 2013-05-22 04:49:31 +00:00
parent 9f11d6cd44
commit 1ca63098ac
6 changed files with 20 additions and 12 deletions

View File

@ -928,9 +928,12 @@ capture_opts_trim_ring_num_files(capture_options *capture_opts)
#endif
}
/*
* If no interface was specified explicitly, pick a default.
*/
int
capture_opts_trim_iface(capture_options *capture_opts, const char *capture_device)
capture_opts_default_iface_if_necessary(capture_options *capture_opts,
const char *capture_device)
{
int status;

View File

@ -252,9 +252,10 @@ capture_opts_trim_snaplen(capture_options *capture_opts, int snaplen_min);
extern void
capture_opts_trim_ring_num_files(capture_options *capture_opts);
/* trim the interface entry */
/* pick default interface if none was specified */
extern int
capture_opts_trim_iface(capture_options *capture_opts, const char *capture_device);
capture_opts_default_iface_if_necessary(capture_options *capture_opts,
const char *capture_device);
extern void
collect_ifaces(capture_options *capture_opts);

View File

@ -4716,7 +4716,7 @@ main(int argc, char *argv[])
* "-L", "-d", and capturing act on a particular interface, so we have to
* have an interface; if none was specified, pick a default.
*/
status = capture_opts_trim_iface(&global_capture_opts, NULL);
status = capture_opts_default_iface_if_necessary(&global_capture_opts, NULL);
if (status != 0) {
/* cmdarg_err() already called .... */
exit_main(status);

View File

@ -1937,11 +1937,11 @@ main(int argc, char *argv[])
}
} else {
/* No capture file specified, so we're supposed to do a live capture
(or get a list of link-layer types for a live capture device);
or get a list of link-layer types for a live capture device;
do we have support for live captures? */
#ifdef HAVE_LIBPCAP
/* trim the interface name and exit if that failed */
exit_status = capture_opts_trim_iface(&global_capture_opts,
/* if no interface was specified, pick a default */
exit_status = capture_opts_default_iface_if_necessary(&global_capture_opts,
((prefs_p->capture_device) && (*prefs_p->capture_device != '\0')) ? get_if_name(prefs_p->capture_device) : NULL);
if (exit_status != 0)
return exit_status;

View File

@ -2848,8 +2848,10 @@ main(int argc, char *argv[])
}
if (start_capture || list_link_layer_types) {
/* Did the user specify an interface to use? */
status = capture_opts_trim_iface(&global_capture_opts,
/* We're supposed to do a live capture or get a list of link-layer
types for a live capture device; if the user didn't specify an
interface to use, pick a default. */
status = capture_opts_default_iface_if_necessary(&global_capture_opts,
((prefs_p->capture_device) && (*prefs_p->capture_device != '\0')) ? get_if_name(prefs_p->capture_device) : NULL);
if (status != 0) {
exit(status);

View File

@ -905,8 +905,10 @@ int main(int argc, char *argv[])
// }
// if (start_capture || list_link_layer_types) {
// /* Did the user specify an interface to use? */
// status = capture_opts_trim_iface(&global_capture_opts,
// /* We're supposed to do a live capture or get a list of link-layer
// types for a live capture device; if the user didn't specify an
// interface to use, pick a default. */
// status = capture_opts_default_iface_if_necessary(&global_capture_opts,
// (prefs_p->capture_device) ? get_if_name(prefs_p->capture_device) : NULL);
// if (status != 0) {
// exit(status);