aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2012-11-29 00:32:39 +0000
committerGerald Combs <gerald@wireshark.org>2012-11-29 00:32:39 +0000
commitbd19dcd8bff25a03596baf087a937b77d729ba8a (patch)
tree9cd6c209486126211f58a89202e06344738c086f /tshark.c
parent40a22181105ebbd52315408274b0d735fb40ffc0 (diff)
Add an add_hosts_file routine that adds a "hosts" path to an array and
use it in tshark.c instead of read_hosts_file. This lets us use "-H" multiple times. Make read_hosts_file static. svn path=/trunk/; revision=46273
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/tshark.c b/tshark.c
index 951fcb7804..b25badcf5a 100644
--- a/tshark.c
+++ b/tshark.c
@@ -889,7 +889,6 @@ main(int argc, char *argv[])
volatile int out_file_type = WTAP_FILE_PCAP;
#endif
volatile gboolean out_file_name_res = FALSE;
- gchar *hosts_file = NULL;
gchar *volatile cf_name = NULL;
gchar *rfilter = NULL;
#ifdef HAVE_PCAP_OPEN_DEAD
@@ -1277,7 +1276,11 @@ main(int argc, char *argv[])
}
break;
case 'H': /* Read address to name mappings from a hosts file */
- hosts_file = optarg;
+ if (! add_hosts_file(optarg))
+ {
+ cmdarg_err("Can't read host entries from \"%s\"", optarg);
+ return 1;
+ }
out_file_name_res = TRUE;
break;
@@ -1842,16 +1845,6 @@ main(int argc, char *argv[])
g_assert_not_reached();
}
- /* Read in the hosts file after cf_open() (which calls init_dissection()
- * which resets the name database).
- */
- if (hosts_file) {
- if (! read_hosts_file(hosts_file)) {
- cmdarg_err("Can't read host entries from \"%s\"", hosts_file);
- return 1;
- }
- }
-
/* Process the packets in the file */
TRY {
#ifdef HAVE_LIBPCAP