mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Put conditional S_ISDIR definition(s) into pyport.h.
This commit is contained in:
		
							parent
							
								
									e00dde2087
								
							
						
					
					
						commit
						f9836ba4fe
					
				
					 4 changed files with 14 additions and 14 deletions
				
			
		|  | @ -150,6 +150,19 @@ typedef unsigned LONG_LONG Py_uintptr_t; | ||||||
| #include <stat.h> | #include <stat.h> | ||||||
| #endif | #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 | #ifdef __cplusplus | ||||||
| /* Move this down here since some C++ #include's don't like to be included
 | /* Move this down here since some C++ #include's don't like to be included
 | ||||||
|  |  | ||||||
|  | @ -5,7 +5,6 @@ | ||||||
| #include "osdefs.h" | #include "osdefs.h" | ||||||
| 
 | 
 | ||||||
| #include <sys/types.h> | #include <sys/types.h> | ||||||
| #include <sys/stat.h> |  | ||||||
| #include <string.h> | #include <string.h> | ||||||
| 
 | 
 | ||||||
| #if HAVE_UNISTD_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 | static int | ||||||
| isfile(char *filename)		/* Is file, not directory */ | isfile(char *filename)		/* Is file, not directory */ | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -592,7 +592,7 @@ builtin_execfile(PyObject *self, PyObject *args) | ||||||
| 	exists = 0; | 	exists = 0; | ||||||
| 	/* Test for existence or directory. */ | 	/* Test for existence or directory. */ | ||||||
| 	if (!stat(filename, &s)) { | 	if (!stat(filename, &s)) { | ||||||
| 		if ((s.st_mode & S_IFMT) == S_IFDIR) | 		if (S_ISDIR(s.st_mode)) | ||||||
| 			errno = EISDIR; | 			errno = EISDIR; | ||||||
| 		else | 		else | ||||||
| 			exists = 1; | 			exists = 1; | ||||||
|  |  | ||||||
|  | @ -28,10 +28,6 @@ | ||||||
| #define S_IFMT (S_IFDIR|S_IFCHR|S_IFREG) | #define S_IFMT (S_IFDIR|S_IFCHR|S_IFREG) | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #ifndef S_ISDIR |  | ||||||
| #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| extern time_t PyOS_GetLastModificationTime(char *, FILE *); | extern time_t PyOS_GetLastModificationTime(char *, FILE *); | ||||||
| 						/* In getmtime.c */ | 						/* In getmtime.c */ | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Martin v. Löwis
						Martin v. Löwis