summaryrefslogtreecommitdiff
path: root/src/system.h
diff options
context:
space:
mode:
authorAlain Magloire <alainm@rcsm.ee.mcgill.ca>2001-02-08 17:01:32 +0000
committerAlain Magloire <alainm@rcsm.ee.mcgill.ca>2001-02-08 17:01:32 +0000
commite8dbb0dff11e6d78ca088858f09f13dd4953394c (patch)
tree9ff55613c34ca57a0e87ffa5a6eba379c1c06eff /src/system.h
parenta4233d612029527527f41accd8d641d8e85749a0 (diff)
downloadgrep-e8dbb0dff11e6d78ca088858f09f13dd4953394c.tar.gz
Port to MING32
Port to Mingw32, based on suggestions from Christian Groessler <cpg@aladdin.de>. * src/isdir.c: New file, taken from fileutils. * src/Makefile.am (base_sources): Add isdir.c. * src/grep.c (grepfile): Use isdir instead of doing it inline. (grepdir): Suppress ancestor check if the directory's inode and device are both zero, as that occurs only on Mingw32 which doesn't support inode or device. * src/system.h (isdir): New decl. (is_EISDIR): Depend on HAVE_DIR_EACCES_BUG, not D_OK. Use isdir, not access. Problen noted by Gerald Stoller <gerald_stoller@hotmail.com> * src/grep.c (main): POSIX.2 says that -q overrides -l, which in turn overrides the other output options. Fix grep to behave that way.
Diffstat (limited to 'src/system.h')
-rw-r--r--src/system.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/system.h b/src/system.h
index 9d7cea54..99906d8a 100644
--- a/src/system.h
+++ b/src/system.h
@@ -78,14 +78,15 @@ extern char *sys_errlist[];
# define FILESYSTEM_PREFIX_LEN(f) 0
#endif
-/* This assumes _WIN32, like DJGPP, has D_OK. Does it? In what header? */
-#ifdef D_OK
+int isdir PARAMS ((char const *));
+
+#ifdef HAVE_DIR_EACCES_BUG
# ifdef EISDIR
# define is_EISDIR(e, f) \
((e) == EISDIR \
- || ((e) == EACCES && access (f, D_OK) == 0 && ((e) = EISDIR, 1)))
+ || ((e) == EACCES && isdir (f) && ((e) = EISDIR, 1)))
# else
-# define is_EISDIR(e, f) ((e) == EACCES && access (f, D_OK) == 0)
+# define is_EISDIR(e, f) ((e) == EACCES && isdir (f))
# endif
#endif