blob: 73db6b4b98519fdf3852bda6a8c78f552775cb87 [file] [log] [blame] [raw]
Add support of C.<encoding> LANG variable in C library, such as C.UTF-8.
Backported from FreeBSD base r340144.
diff -ru --exclude-from freebsd-src-diff-exclude-names /var/tmp/freebsd-10.3-src/usr/src/lib/libc/locale/collate.c freebsd-10.3/usr/src/lib/libc/locale/collate.c
--- /var/tmp/freebsd-10.3-src/usr/src/lib/libc/locale/collate.c 2016-03-25 09:09:54.000000000 +0800
+++ freebsd-10.3/usr/src/lib/libc/locale/collate.c 2018-12-12 18:35:33.576434994 +0800
@@ -89,7 +89,8 @@
void *
__collate_load(const char *encoding, locale_t unused)
{
- if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0) {
+ if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0 ||
+ strncmp(encoding, "C.", 2) == 0) {
return &__xlocale_C_collate;
}
struct xlocale_collate *table = calloc(sizeof(struct xlocale_collate), 1);
Only in freebsd-10.3/usr/src/lib/libc/locale: collate.c.rej
diff -ru --exclude-from freebsd-src-diff-exclude-names /var/tmp/freebsd-10.3-src/usr/src/lib/libc/locale/ldpart.c freebsd-10.3/usr/src/lib/libc/locale/ldpart.c
--- /var/tmp/freebsd-10.3-src/usr/src/lib/libc/locale/ldpart.c 2016-03-25 09:09:54.000000000 +0800
+++ freebsd-10.3/usr/src/lib/libc/locale/ldpart.c 2018-12-12 18:35:33.577429226 +0800
@@ -61,7 +61,8 @@
size_t namesize, bufsize;
/* 'name' must be already checked. */
- if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) {
+ if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0 ||
+ strncmp(name, "C.", 2) == 0) {
*using_locale = 0;
return (_LDP_CACHE);
}