[Python-checkins] CVS: python/dist/src/Python import.c,2.168,2.169

Tim Peters tim_one@users.sourceforge.net
Thu, 01 Mar 2001 00:47:31 -0800


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv15124/python/dist/src/python

Modified Files:
	import.c 
Log Message:
More fiddling w/ the new-fangled Mac import code.


Index: import.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/import.c,v
retrieving revision 2.168
retrieving revision 2.169
diff -C2 -r2.168 -r2.169
*** import.c	2001/03/01 06:33:32	2.168
--- import.c	2001/03/01 08:47:29	2.169
***************
*** 1112,1118 ****
  	DIR *dirp;
  	struct dirent *dp;
! 	char pathname[MAX_PATH + 1];
  	const int pathlen = len - namelen - 1; /* don't want trailing SEP */
  
  	/* Copy the path component into pathname; substitute "." if empty */
  	if (pathlen <= 0) {
--- 1112,1121 ----
  	DIR *dirp;
  	struct dirent *dp;
! 	char pathname[MAXPATHLEN + 1];
  	const int pathlen = len - namelen - 1; /* don't want trailing SEP */
  
+ 	if (getenv("PYTHONCASEOK") != NULL)
+ 		return 1;
+ 
  	/* Copy the path component into pathname; substitute "." if empty */
  	if (pathlen <= 0) {
***************
*** 1121,1125 ****
  	}
  	else {
! 		assert(pathlen <= MAX_PATH);
  		memcpy(pathname, buf, pathlen);
  		pathname[pathlen] = '\0';
--- 1124,1128 ----
  	}
  	else {
! 		assert(pathlen <= MAXPATHLEN);
  		memcpy(pathname, buf, pathlen);
  		pathname[pathlen] = '\0';
***************
*** 1129,1136 ****
  	if (dirp) {
  		while ((dp = readdir(dirp)) != NULL) {
  #ifdef _DIRENT_HAVE_D_NAMELEN
! 			const int thislen = dp->d_namlen;
  #else
! 			const int thislen = strlen(dp->d_name);
  #endif
  			if (thislen == namelen && !strcmp(dp->d_name, name)) {
--- 1132,1140 ----
  	if (dirp) {
  		while ((dp = readdir(dirp)) != NULL) {
+ 			const int thislen =
  #ifdef _DIRENT_HAVE_D_NAMELEN
! 						dp->d_namlen;
  #else
! 						strlen(dp->d_name);
  #endif
  			if (thislen == namelen && !strcmp(dp->d_name, name)) {
***************
*** 1139,1144 ****
  			}
  		}
  	}
- 	(void)closedir(dirp);
  	return 0 ; /* Not found */
  
--- 1143,1148 ----
  			}
  		}
+ 		(void)closedir(dirp);
  	}
  	return 0 ; /* Not found */