提交 5600088d 编写于 作者: R Rich Felker

fix nl_langinfo to actually use the existing, correct internal version

上级 3910e933
#include <locale.h> #include <locale.h>
#include <langinfo.h> #include <langinfo.h>
#include "libc.h"
static const char c_time[] = static const char c_time[] =
"Sun\0" "Mon\0" "Tue\0" "Wed\0" "Thu\0" "Fri\0" "Sat\0" "Sun\0" "Mon\0" "Tue\0" "Wed\0" "Thu\0" "Fri\0" "Sat\0"
...@@ -24,7 +25,7 @@ static const char c_time[] = ...@@ -24,7 +25,7 @@ static const char c_time[] =
static const char c_messages[] = "^[yY]\0" "^[nN]"; static const char c_messages[] = "^[yY]\0" "^[nN]";
static const char c_numeric[] = ".\0" ""; static const char c_numeric[] = ".\0" "";
const char *__langinfo(nl_item item) char *__langinfo(nl_item item)
{ {
int cat = item >> 16; int cat = item >> 16;
int idx = item & 65535; int idx = item & 65535;
...@@ -54,5 +55,7 @@ const char *__langinfo(nl_item item) ...@@ -54,5 +55,7 @@ const char *__langinfo(nl_item item)
} }
for (; idx; idx--, str++) for (; *str; str++); for (; idx; idx--, str++) for (; *str; str++);
return str; return (char *)str;
} }
weak_alias(__langinfo, nl_langinfo);
#include <langinfo.h>
// FIXME: other items
char *nl_langinfo(nl_item item)
{
switch (item) {
case CODESET:
return "UTF-8";
default:
return "";
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册