diff options
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 50 |
1 files changed, 2 insertions, 48 deletions
@@ -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. */ |