summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-02-13 23:27:59 (GMT)
committerGuido van Rossum <guido@python.org>1998-02-13 23:27:59 (GMT)
commit4d1b3b921dd63ec20c8f20d4781dfa5adb52b63c (patch)
tree6805a20539f5c44d685c3507c16e6fc1ec3230b7 /Python
parentb666c15c4a211965016059feb08739e2786da30e (diff)
downloadcpython-4d1b3b921dd63ec20c8f20d4781dfa5adb52b63c.zip
cpython-4d1b3b921dd63ec20c8f20d4781dfa5adb52b63c.tar.gz
cpython-4d1b3b921dd63ec20c8f20d4781dfa5adb52b63c.tar.bz2
Added DJGPP version of check_case(), by Pit Scrorpion (Hans Nowak).
(BTW, the Mac version was by Jack Jansen.)
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c
index 8c48547..7917633 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1005,6 +1005,34 @@ check_case(char *buf, int len, int namelen, char *name)
}
#endif /* macintosh */
+#ifdef DJGPP
+static int
+check_case(char *buf, int len, int namelen, char *name)
+{
+ struct ffblk ffblk;
+ int done;
+
+ if (getenv("PYTHONCASEOK") != NULL)
+ return 1;
+ done = findfirst(buf, &ffblk, FA_ARCH|FA_RDONLY|FA_HIDDEN);
+ if (done) {
+ PyErr_Format(PyExc_NameError,
+ "Can't find file for module %.100s\n(filename %.300s)",
+ name, buf);
+ return 0;
+ }
+
+ if (strncmp(ffblk.ff_name, name, namelen) != 0) {
+ strcpy(buf+len-namelen, ffblk.ff_name);
+ PyErr_Format(PyExc_NameError,
+ "Case mismatch for module name %.100s\n(filename %.300s)",
+ name, buf);
+ return 0;
+ }
+ return 1;
+}
+#endif
+
#endif CHECK_IMPORT_CASE
#ifdef HAVE_STAT