Changeset 3364 for trunk/essentials/dev-lang/python/Python
- Timestamp:
- May 21, 2007, 2:27:53 AM (18 years ago)
- Location:
- trunk/essentials/dev-lang/python/Python
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/essentials/dev-lang/python/Python/dynload_shlib.c
r3225 r3364 21 21 #else 22 22 #if defined(PYOS_OS2) && defined(PYCC_GCC) 23 #ifdef __KLIBC__ 24 #error "kLIBC has dlfcn.h and shouldn't get here!" 25 #endif 23 26 #include "dlfcn.h" 24 27 #endif 25 28 #endif 26 29 27 #if (defined(__OpenBSD__) || defined(__NetBSD__)) && !defined(__ELF__) 30 #if ((defined(__OpenBSD__) || defined(__NetBSD__)) && !defined(__ELF__)) \ 31 || (defined(__OS2__) && defined(__KLIBC__)) 28 32 #define LEAD_UNDERSCORE "_" 29 33 #else … … 37 41 {"module.dll", "rb", C_EXTENSION}, 38 42 #else 39 #if defined(PYOS_OS2) && defined(PYCC_GCC)43 #if (defined(PYOS_OS2) && defined(PYCC_GCC)) || (defined(__OS2__) && defined(__KLIBC__)) 40 44 {".pyd", "rb", C_EXTENSION}, 41 45 {".dll", "rb", C_EXTENSION}, … … 82 86 } 83 87 84 PyOS_snprintf(funcname, sizeof(funcname), 88 PyOS_snprintf(funcname, sizeof(funcname), 85 89 LEAD_UNDERSCORE "init%.200s", shortname); 86 90 … … 114 118 115 119 if (Py_VerboseFlag) 116 PySys_WriteStderr("dlopen(\"%s\", %x);\n", pathname, 120 PySys_WriteStderr("dlopen(\"%s\", %x);\n", pathname, 117 121 dlopenflags); 118 122 … … 123 127 /* As C module use only one name space this is probably not a */ 124 128 /* important limitation */ 125 PyOS_snprintf(pathbuf, sizeof(pathbuf), "python_module_%-.200s", 129 PyOS_snprintf(pathbuf, sizeof(pathbuf), "python_module_%-.200s", 126 130 shortname); 127 131 pathname = pathbuf; -
trunk/essentials/dev-lang/python/Python/import.c
r3225 r3364 1475 1475 #include <dirent.h> 1476 1476 1477 #elif defined(__KLIBC__) 1478 #include <stdlib.h> 1479 1477 1480 #elif defined(PYOS_OS2) 1478 1481 #define INCL_DOS … … 1594 1597 1595 1598 /* OS/2 */ 1599 #elif defined(__KLIBC__) 1600 char canon[MAXPATHLEN+1]; 1601 size_t canonlen; 1602 char *p, *p2; 1603 1604 if (Py_GETENV("PYTHONCASEOK") != NULL) 1605 return 1; 1606 1607 /* This resolves case differences and return and native OS/2 1608 path. Unfortunately, it'll also resolve symbolic links 1609 while of course will screw up a bit... */ 1610 if (!_realrealpath(buf, canon, sizeof(canon))) 1611 return 0; 1612 canonlen = strlen(canon); 1613 if (canonlen < namelen) 1614 return 0; 1615 p = strrchr(canon, SEP); 1616 p2 = strrchr(p ? p : canon, ALTSEP); 1617 if (p2) 1618 p = p2; 1619 1620 return strncmp(p ? p + 1 : canon, name, namelen) == 0; 1621 1596 1622 #elif defined(PYOS_OS2) 1597 1623 HDIR hdir = 1; -
trunk/essentials/dev-lang/python/Python/sysmodule.c
r3225 r3364 1319 1319 /* It's a symlink */ 1320 1320 link[nr] = '\0'; 1321 if ( link[0] == SEP)1321 if (IS_ABSPATH(link)) 1322 1322 argv0 = link; /* Link to absolute path */ 1323 else if ( strchr(link, SEP) == NULL)1323 else if (!HAS_ANYSEP(link)) 1324 1324 ; /* Link without path */ 1325 1325 else { 1326 1326 /* Must join(dirname(argv0), link) */ 1327 1327 char *q = strrchr(argv0, SEP); 1328 #ifdef ALTSEP 1329 char *q2 = strrchr(q ? q : argv0, ALTSEP); 1330 if (q2) 1331 q = q2; 1332 #endif 1333 #ifdef DRVSEP 1334 if (!q && HAS_DRV(argv0)) 1335 q = strchr(argv0, DRVSEP); 1336 #endif 1337 1328 1338 if (q == NULL) 1329 1339 argv0 = link; /* argv0 without path */ … … 1331 1341 /* Must make a copy */ 1332 1342 strcpy(argv0copy, argv0); 1333 q = strrchr(argv0copy, SEP);1343 q = &argv0copy[q - argv0]; 1334 1344 strcpy(q+1, link); 1335 1345 argv0 = argv0copy; … … 1369 1379 #endif 1370 1380 p = strrchr(argv0, SEP); 1381 #ifdef ALTSEP 1382 { 1383 char *p2 = strrchr(p ? p : argv0, ALTSEP); 1384 if (p2 != NULL) 1385 p = p2; 1386 } 1387 #endif 1388 #ifdef DRVSEP 1389 if (p == NULL && HAS_DRV(argv0)) 1390 p = strchr(argv0, DRVSEP); 1391 #endif 1371 1392 } 1372 1393 if (p != NULL) { -
trunk/essentials/dev-lang/python/Python/traceback.c
r3225 r3364 140 140 PyObject *path; 141 141 char *tail = strrchr(filename, SEP); 142 #ifdef ALTSEP 143 char *tail2 = strrchr(filename, ALTSEP); 144 if (!tail || tail2 > tail) 145 tail = tail2; 146 #endif 147 #ifdef DRVSEP 148 if (!tail && HAS_DRV(filename)) 149 tail = strchr(filename, DRVSEP); 150 #endif 142 151 if (tail == NULL) 143 152 tail = filename; … … 164 173 if (strlen(namebuf) != len) 165 174 continue; /* v contains '\0' */ 166 if (len > 0 && namebuf[len-1] != SEP)175 if (len > 0 && IS_SEP(namebuf[len-1])) 167 176 namebuf[len++] = SEP; 168 177 strcpy(namebuf+len, tail);
Note:
See TracChangeset
for help on using the changeset viewer.