[383a00]: src / runtime / ppc-darwin-langinfo.c Maximize Restore History

Download this file

ppc-darwin-langinfo.c    46 lines (39 with data), 1.2 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* This is a minimal nl_langinfo replacement that only handles CODESET.
* By default, it returns UTF-8. It checks if LC_CTYPE or LANG are set, and
* uses LATIN-1 if it finds one set to C, or UTF-8 if it finds one set to
* anything else.
*/
/*
* This software is part of the SBCL system. See the README file for
* more information.
*
* This software is derived from the CMU CL system, which was
* written at Carnegie Mellon University and released into the
* public domain. The software is in the public domain and is
* provided with absolutely no warranty. See the COPYING and CREDITS
* files for more information.
*/
#include <stdlib.h>
#include "ppc-darwin-langinfo.h"
char *nl_langinfo(nl_item item)
{
char *nada = "", *utf8 = "UTF-8", *latin1 = "LATIN-1";
if (item != CODESET) {
return nada;
} else {
char *ctype = getenv ("LC_CTYPE");
if ((ctype != NULL) && (!strcmp(ctype, "C"))) {
return latin1;
} else if (ctype != NULL) {
return utf8;
} else {
char *lang = getenv ("LANG");
if ((lang != NULL) && (!strcmp(lang, "C"))) {
return latin1;
} else {
return utf8;
}
}
}
}