aboutsummaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-08-21 06:39:18 +0000
committerGuy Harris <guy@alum.mit.edu>2001-08-21 06:39:18 +0000
commit9d601c6799ca74f398d5df8dc0144f74084f546b (patch)
treea006906797b6fd55a738b1c3e653f46a2a15ce31 /util.c
parentaacb4d90f0ef62557d0fa370c5bfcafe89c466a0 (diff)
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 'util.c')
-rw-r--r--util.c50
1 files changed, 2 insertions, 48 deletions
diff --git a/util.c b/util.c
index e7f23accec..dc078b8793 100644
--- a/util.c
+++ b/util.c
@@ -1,12 +1,11 @@
/* util.c
* Utility routines
*
- * $Id: util.c,v 1.51 2001/04/02 09:53:43 guy Exp $
+ * $Id: util.c,v 1.52 2001/08/21 06:39:15 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
- *
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -90,51 +89,6 @@ typedef int mode_t; /* for win32 */
#endif
/*
- * Given a pathname, return:
- *
- * the errno, if an attempt to "stat()" the file fails;
- *
- * EISDIR, if the attempt succeeded and the file turned out
- * to be a directory;
- *
- * 0, if the attempt succeeded and the file turned out not
- * to be a directory.
- */
-
-/*
- * Visual C++ on Win32 systems doesn't define these. (Old UNIX systems don't
- * define them either.)
- *
- * Visual C++ on Win32 systems doesn't define S_IFIFO, it defines _S_IFIFO.
- */
-#ifndef S_ISREG
-#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
-#endif
-#ifndef S_IFIFO
-#define S_IFIFO _S_IFIFO
-#endif
-#ifndef S_ISFIFO
-#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
-#endif
-#ifndef S_ISDIR
-#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
-#endif
-
-int
-test_for_directory(const char *path)
-{
- struct stat statb;
-
- if (stat(path, &statb) < 0)
- return errno;
-
- if (S_ISDIR(statb.st_mode))
- return EISDIR;
- else
- return 0;
-}
-
-/*
* Collect command-line arguments as a string consisting of the arguments,
* separated by spaces.
*/