projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
aarch64, or1k: define rseq syscall number following linux v4.19
[musl]
/
src
/
locale
/
langinfo.c
diff --git
a/src/locale/langinfo.c
b/src/locale/langinfo.c
index
a1ada24
..
1477309
100644
(file)
--- a/
src/locale/langinfo.c
+++ b/
src/locale/langinfo.c
@@
-1,7
+1,6
@@
#include <locale.h>
#include <langinfo.h>
#include "locale_impl.h"
#include <locale.h>
#include <langinfo.h>
#include "locale_impl.h"
-#include "libc.h"
static const char c_time[] =
"Sun\0" "Mon\0" "Tue\0" "Wed\0" "Thu\0" "Fri\0" "Sat\0"
static const char c_time[] =
"Sun\0" "Mon\0" "Tue\0" "Wed\0" "Thu\0" "Fri\0" "Sat\0"
@@
-33,27
+32,31
@@
char *__nl_langinfo_l(nl_item item, locale_t loc)
int idx = item & 65535;
const char *str;
int idx = item & 65535;
const char *str;
- if (item == CODESET) return "UTF-8";
+ if (item == CODESET) return loc->cat[LC_CTYPE] ? "UTF-8" : "ASCII";
+
+ /* _NL_LOCALE_NAME extension */
+ if (idx == 65535 && cat < LC_ALL)
+ return loc->cat[cat] ? (char *)loc->cat[cat]->name : "C";
switch (cat) {
case LC_NUMERIC:
switch (cat) {
case LC_NUMERIC:
- if (idx > 1) return
NULL
;
+ if (idx > 1) return
""
;
str = c_numeric;
break;
case LC_TIME:
str = c_numeric;
break;
case LC_TIME:
- if (idx > 0x31) return
NULL
;
+ if (idx > 0x31) return
""
;
str = c_time;
break;
case LC_MONETARY:
str = c_time;
break;
case LC_MONETARY:
- if (idx > 0) return
NULL
;
+ if (idx > 0) return
""
;
str = "";
break;
case LC_MESSAGES:
str = "";
break;
case LC_MESSAGES:
- if (idx > 3) return
NULL
;
+ if (idx > 3) return
""
;
str = c_messages;
break;
default:
str = c_messages;
break;
default:
- return
NULL
;
+ return
""
;
}
for (; idx; idx--, str++) for (; *str; str++);
}
for (; idx; idx--, str++) for (; *str; str++);