Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4d1b3b9

Browse files
committed
Added DJGPP version of check_case(), by Pit Scrorpion (Hans Nowak).
(BTW, the Mac version was by Jack Jansen.)
1 parent b666c15 commit 4d1b3b9

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Python/import.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,34 @@ check_case(char *buf, int len, int namelen, char *name)
10051005
}
10061006
#endif /* macintosh */
10071007

1008+
#ifdef DJGPP
1009+
static int
1010+
check_case(char *buf, int len, int namelen, char *name)
1011+
{
1012+
struct ffblk ffblk;
1013+
int done;
1014+
1015+
if (getenv("PYTHONCASEOK") != NULL)
1016+
return 1;
1017+
done = findfirst(buf, &ffblk, FA_ARCH|FA_RDONLY|FA_HIDDEN);
1018+
if (done) {
1019+
PyErr_Format(PyExc_NameError,
1020+
"Can't find file for module %.100s\n(filename %.300s)",
1021+
name, buf);
1022+
return 0;
1023+
}
1024+
1025+
if (strncmp(ffblk.ff_name, name, namelen) != 0) {
1026+
strcpy(buf+len-namelen, ffblk.ff_name);
1027+
PyErr_Format(PyExc_NameError,
1028+
"Case mismatch for module name %.100s\n(filename %.300s)",
1029+
name, buf);
1030+
return 0;
1031+
}
1032+
return 1;
1033+
}
1034+
#endif
1035+
10081036
#endif CHECK_IMPORT_CASE
10091037

10101038
#ifdef HAVE_STAT

0 commit comments

Comments
 (0)