diff options
author | Guy Harris <guy@alum.mit.edu> | 2001-08-21 06:39:18 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2001-08-21 06:39:18 +0000 |
commit | 9d601c6799ca74f398d5df8dc0144f74084f546b (patch) | |
tree | a006906797b6fd55a738b1c3e653f46a2a15ce31 /epan/resolv.c | |
parent | aacb4d90f0ef62557d0fa370c5bfcafe89c466a0 (diff) | |
download | wireshark-9d601c6799ca74f398d5df8dc0144f74084f546b.tar.gz wireshark-9d601c6799ca74f398d5df8dc0144f74084f546b.tar.bz2 wireshark-9d601c6799ca74f398d5df8dc0144f74084f546b.zip |
On Windows, use the directory in which the binary resides as the
directory in which global data files are stored. If an installed binary
is being run, that's the correct directory for them; if a build-tree
binary is being run, the "manuf" file will be there, and you can put
other data files there as well, if necessary.
Do the same with plugins, except that, if there's no
"plugins\\{version}" subdirectory of that directory, fall back on the
default installation directory, so you at least have a place where you
can put plugins for use by build-tree binaries. (Should we, instead,
have the Windows build procedure create a subdirectory of the "plugins"
source directory, with the plugin version number as its name, and copy
the plugins there, so you'd use the build-tree plugin binaries?)
Move "test_for_directory()" out of "util.c" and into
"epan/filesystem.c", with the other file system access portability
wrappers and convenience routines. Fix "util.h" not to declare it - or
other routines moved to "epan/filesystem.c" a while ago.
svn path=/trunk/; revision=3858
Diffstat (limited to 'epan/resolv.c')
-rw-r--r-- | epan/resolv.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/epan/resolv.c b/epan/resolv.c index 3f056f2ec5..aab6507658 100644 --- a/epan/resolv.c +++ b/epan/resolv.c @@ -1,7 +1,7 @@ /* resolv.c * Routines for network object lookup * - * $Id: resolv.c,v 1.11 2001/06/07 22:07:02 guy Exp $ + * $Id: resolv.c,v 1.12 2001/08/21 06:39:16 guy Exp $ * * Laurent Deniel <deniel@worldnet.fr> * @@ -83,9 +83,14 @@ #include "prefs.h" +/* + * XXX - on Windows, do "/etc/ethers" and "/etc/ipxnets" exist, perhaps in + * some other directory, or should we instead look for them in the Ethereal + * installation directory, treating them as Ethereal-specific files? + */ #define EPATH_ETHERS "/etc/ethers" #define EPATH_IPXNETS "/etc/ipxnets" -#define EPATH_MANUF DATAFILE_DIR "/manuf" +#define ENAME_MANUF "manuf" #define EPATH_PERSONAL_ETHERS ".ethereal/ethers" /* with "$HOME/" prefix */ #define EPATH_PERSONAL_IPXNETS ".ethereal/ipxnets" /* with "$HOME/" prefix */ @@ -173,7 +178,6 @@ gchar *g_ethers_path = EPATH_ETHERS; gchar *g_pethers_path = NULL; /* "$HOME"/EPATH_PERSONAL_ETHERS */ gchar *g_ipxnets_path = EPATH_IPXNETS; gchar *g_pipxnets_path = NULL; /* "$HOME"/EPATH_PERSONAL_IPXNETS */ -gchar *g_manuf_path = EPATH_MANUF; /* may only be changed before the */ /* first resolving call */ /* @@ -624,6 +628,7 @@ static hashmanuf_t *manuf_name_lookup(const guint8 *addr) static void initialize_ethers(void) { ether_t *eth; + char *manuf_path; /* Set g_pethers_path here, but don't actually do anything * with it. It's used in get_ethbyname() and get_ethbyaddr() @@ -637,7 +642,14 @@ static void initialize_ethers(void) /* manuf hash table initialization */ - set_ethent(g_manuf_path); + /* Compute the pathname of the manuf file */ + manuf_path = (gchar *) g_malloc(strlen(get_datafile_dir()) + + strlen(ENAME_MANUF) + 2); + sprintf(manuf_path, "%s%c%s", get_datafile_dir(), G_DIR_SEPARATOR, + ENAME_MANUF); + + /* Read it and initialize the hash table */ + set_ethent(manuf_path); while ((eth = get_ethent(0))) { add_manuf_name(eth->addr, eth->name); @@ -645,6 +657,8 @@ static void initialize_ethers(void) end_ethent(); + g_free(manuf_path); + } /* initialize_ethers */ static hashether_t *add_eth_name(const guint8 *addr, const guchar *name) |