]> granicus.if.org Git - python/commitdiff
Put conditional S_ISDIR definition(s) into pyport.h.
authorMartin v. Löwis <martin@v.loewis.de>
Wed, 8 Aug 2001 10:28:06 +0000 (10:28 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Wed, 8 Aug 2001 10:28:06 +0000 (10:28 +0000)
Include/pyport.h
Modules/getpath.c
Python/bltinmodule.c
Python/import.c

index 35d871303153118b8a8a4c4d826e5a5a123d8e96..e9dc8128617f2f821af3efdf8b8777e5faf51950 100644 (file)
@@ -150,6 +150,19 @@ typedef unsigned LONG_LONG Py_uintptr_t;
 #include <stat.h>
 #endif
 
+#if defined(PYCC_VACPP)
+/* VisualAge C/C++ Failed to Define MountType Field in sys/stat.h */
+#define S_IFMT (S_IFDIR|S_IFCHR|S_IFREG)
+#endif
+
+#ifndef S_ISREG
+#define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
+#endif
+
+#ifndef S_ISDIR
+#define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR)
+#endif
+
 
 #ifdef __cplusplus
 /* Move this down here since some C++ #include's don't like to be included
index 2fd8f7513bb3b842c52bfb60d8bd0222e5ae1fb6..76bc320aed1c369087730c78c419294faa5d19ed 100644 (file)
@@ -5,7 +5,6 @@
 #include "osdefs.h"
 
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <string.h>
 
 #if HAVE_UNISTD_H
@@ -138,14 +137,6 @@ reduce(char *dir)
 }
 
 
-#ifndef S_ISREG
-#define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
-#endif
-
-#ifndef S_ISDIR
-#define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR)
-#endif
-
 static int
 isfile(char *filename)         /* Is file, not directory */
 {
index 8f5a9325a53ede0bf952d7fb2ccca3d3e6b03cb2..fa6816279dfd5d3052bf4a5d5dd629eddadbc7d1 100644 (file)
@@ -592,7 +592,7 @@ builtin_execfile(PyObject *self, PyObject *args)
        exists = 0;
        /* Test for existence or directory. */
        if (!stat(filename, &s)) {
-               if ((s.st_mode & S_IFMT) == S_IFDIR)
+               if (S_ISDIR(s.st_mode))
                        errno = EISDIR;
                else
                        exists = 1;
index 8e08164d98e7e442bca91b37adb15a58a9bf9725..c5234ace617c5d08945c59a1b2b880bddcf928b6 100644 (file)
 #define S_IFMT (S_IFDIR|S_IFCHR|S_IFREG)
 #endif
 
-#ifndef S_ISDIR
-#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
-#endif
-
 extern time_t PyOS_GetLastModificationTime(char *, FILE *);
                                                /* In getmtime.c */