#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
#include "osdefs.h"
#include <sys/types.h>
-#include <sys/stat.h>
#include <string.h>
#if HAVE_UNISTD_H
}
-#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 */
{
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;
#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 */