Replace the single-byte placeholders for the multi-byte/wide-character
authorstsp <stsp@openbsd.org>
Tue, 27 Jul 2010 16:59:03 +0000 (16:59 +0000)
committerstsp <stsp@openbsd.org>
Tue, 27 Jul 2010 16:59:03 +0000 (16:59 +0000)
commitc9b8e388578364b151696adc10868407025a0045
tree73bcc9b28595fbd3e50335f287ecdc84d56bf8e6
parent4951a6e2a385133e4b7ac8a9e366368b680e1fd4
Replace the single-byte placeholders for the multi-byte/wide-character
conversion interfaces of libc (mbrtowc(3) and friends) with new
implementations that internally call an API based on NetBSD's citrus.
This allows us to support locales with multi-byte character encodings.

Provide two implementations of the citrus-based API: one based on the old
single-byte placeholders for use with our existing single-byte character
locales (C, ISO8859-*, KOI8, CP1251, etc.), and one that provides support
for UTF-8 encoded characters (code based on FreeBSD's implementation).

Install the en_US.UTF-8 ctype locale support file, and allow the UTF-8
ctype locale to be enabled via setlocale(3) (export LC_CTYPE='en_US.UTF-8').

A lot of programs, especially from ports, will now start using UTF-8 if the
UTF-8 locale is enabled. Use at your own risk, and please report any breakage.
Note that ncurses-based programs cannot display UTF-8 right now, this is being
worked on.

To prevent install media growth, add vfprintf(3) and mbrtowc(3) to libstubs.
The mbrtowc stub was copied unchanged from its old single-byte placeholder.
vfprintf.c doesn't need to be copied, just put in .PATH (hint by fgsch@).

Testing by myself, naddy, sthen, nicm, espie, armani, Dmitrij D. Czarkoff.

ok matthieu espie millert sthen nicm deraadt
29 files changed:
distrib/special/libstubs/Makefile
distrib/special/libstubs/mbrtowc_sb.c [new file with mode: 0644]
lib/libc/Makefile.inc
lib/libc/citrus/Makefile.inc [new file with mode: 0644]
lib/libc/citrus/citrus_ctype.c [new file with mode: 0644]
lib/libc/citrus/citrus_ctype.h
lib/libc/citrus/citrus_ctype_local.h
lib/libc/citrus/citrus_none.c [new file with mode: 0644]
lib/libc/citrus/citrus_none.h [new file with mode: 0644]
lib/libc/citrus/citrus_utf8.c [new file with mode: 0644]
lib/libc/citrus/citrus_utf8.h [new file with mode: 0644]
lib/libc/locale/Makefile.inc
lib/libc/locale/btowc.c [new file with mode: 0644]
lib/libc/locale/mblen.c [new file with mode: 0644]
lib/libc/locale/mbrlen.c [new file with mode: 0644]
lib/libc/locale/mbrtowc_sb.c [deleted file]
lib/libc/locale/mbstowcs.c [new file with mode: 0644]
lib/libc/locale/mbtowc.c [new file with mode: 0644]
lib/libc/locale/multibyte.h [new file with mode: 0644]
lib/libc/locale/multibyte_citrus.c [new file with mode: 0644]
lib/libc/locale/multibyte_sb.c [deleted file]
lib/libc/locale/runetable.c
lib/libc/locale/setrunelocale.c
lib/libc/locale/wcscoll.c [new file with mode: 0644]
lib/libc/locale/wcstombs.c [new file with mode: 0644]
lib/libc/locale/wcsxfrm.c [new file with mode: 0644]
lib/libc/locale/wctob.c [new file with mode: 0644]
lib/libc/locale/wctomb.c [new file with mode: 0644]
share/locale/ctype/Makefile