Changeset 60 for python/trunk/Modules/_localemodule.c
- Timestamp:
- Oct 22, 2010, 10:46:09 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk/Modules/_localemodule.c
r2 r60 40 40 #define WIN32_LEAN_AND_MEAN 41 41 #include <windows.h> 42 #endif 43 44 #if defined(__KLIBC__) 45 #define INCL_DOS 46 #define INCL_DOSERRORS 47 #include <os2.h> 42 48 #endif 43 49 … … 445 451 #endif 446 452 453 #if defined(__KLIBC__) 454 static PyObject* 455 PyLocale_getdefaultlocale(PyObject* self) 456 { 457 char encoding[100]; 458 char locale[100]; 459 ULONG cp[3]; 460 ULONG cplen; 461 462 strcpy( locale, ""); 463 if (getenv("LANG")) 464 strcpy( locale, getenv("LANG")); 465 466 strcpy( encoding, ""); 467 if (DosQueryCp (sizeof (cp), cp, &cplen) == NO_ERROR) 468 PyOS_snprintf(encoding, sizeof(encoding), "CP%u", cp[0]); 469 470 return Py_BuildValue("ss", locale, encoding); 471 } 472 #endif 473 447 474 #ifdef HAVE_LANGINFO_H 448 475 #define LANGINFO(X) {#X, X} … … 690 717 {"strxfrm", (PyCFunction) PyLocale_strxfrm, 691 718 METH_VARARGS, strxfrm__doc__}, 692 #if defined(MS_WINDOWS) || defined(__APPLE__) 719 #if defined(MS_WINDOWS) || defined(__APPLE__) || defined(__KLIBC__) 693 720 {"_getdefaultlocale", (PyCFunction) PyLocale_getdefaultlocale, METH_NOARGS}, 694 721 #endif
Note:
See TracChangeset
for help on using the changeset viewer.