mailing list of musl libc
 help / color / mirror / code / Atom feed
0b130e7c8e404042af74ea026e0b86e9e50e754d blob 1525 bytes (raw)

 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
 
#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"
	"Sunday\0" "Monday\0" "Tuesday\0" "Wednesday\0"
	"Thursday\0" "Friday\0" "Saturday\0"
	"Jan\0" "Feb\0" "Mar\0" "Apr\0" "May\0" "Jun\0"
	"Jul\0" "Aug\0" "Sep\0" "Oct\0" "Nov\0" "Dec\0"
	"January\0"   "February\0" "March\0"    "April\0"
	"May\0"       "June\0"     "July\0"     "August\0"
	"September\0" "October\0"  "November\0" "December\0"
	"AM\0" "PM\0"
	"%a %b %e %T %Y\0"
	"%m/%d/%y\0"
	"%H:%M:%S\0"
	"%I:%M:%S %p\0"
	"\0"
	"%m/%d/%y\0"
	"0123456789"
	"%a %b %e %T %Y\0"
	"%H:%M:%S";

static const char c_messages[] = "^[yY]\0" "^[nN]";
static const char c_numeric[] = ".\0" "";

char *__nl_langinfo_l(nl_item item, locale_t loc)
{
	int cat = item >> 16;
	int idx = item & 65535;
	const char *str;

	if (item == CODESET) return loc->ctype_utf8 ? "UTF-8" : "ASCII+8BIT";
	
	switch (cat) {
	case LC_NUMERIC:
		if (idx > 1) return NULL;
		str = c_numeric;
		break;
	case LC_TIME:
		if (idx > 0x31) return NULL;
		str = c_time;
		break;
	case LC_MONETARY:
		if (idx > 0) return NULL;
		str = "";
		break;
	case LC_MESSAGES:
		if (idx > 1) return NULL;
		str = c_messages;
		break;
	default:
		return NULL;
	}

	for (; idx; idx--, str++) for (; *str; str++);
	return (char *)str;
}

char *__nl_langinfo(nl_item item)
{
	return __nl_langinfo_l(item, CURRENT_LOCALE);
}

weak_alias(__nl_langinfo, nl_langinfo);
weak_alias(__nl_langinfo_l, nl_langinfo_l);
debug log:

solving 0b130e7 ...
found 0b130e7 in https://inbox.vuxu.org/musl/20140703071318.GA10117@brightrain.aerifal.cx/
found 13abf45 in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 13abf45b8859a6a7a7d6f5f071dbfc8a13dc8a3e	src/locale/langinfo.c

applying [1/1] https://inbox.vuxu.org/musl/20140703071318.GA10117@brightrain.aerifal.cx/
diff --git a/src/locale/langinfo.c b/src/locale/langinfo.c
index 13abf45..0b130e7 100644

Checking patch src/locale/langinfo.c...
Applied patch src/locale/langinfo.c cleanly.

index at:
100644 0b130e7c8e404042af74ea026e0b86e9e50e754d	src/locale/langinfo.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).