From 11fe27f76c63c14b6f88c815b656f3f72d37ea41 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 30 Mar 2023 13:25:20 +0200 Subject: btowc: Fix behaviour in the C locale. * lib/btowc.c: Include (btowc): Use mbrtowc instead of mbtowc when possible. * m4/btowc.m4 (gl_FUNC_BTOWC): Test for the mingw bug in the C locale. Invoke gl_MBRTOWC_C_LOCALE. If mbrtowc is buggy in the C locale, override also btowc. (gl_PREREQ_BTOWC): Test whether mbrtowc exists. * modules/btowc (Files): Add m4/mbrtowc.m4. (Depends-on): Add mbrtowc. * tests/test-btowc.c (main): Add a test of the C locale, based on tests/test-mbrtowc.c. * tests/test-btowc3.sh: New file, based on tests/test-mbrtowc5.sh. * modules/btowc-tests (Files): Add it. (Makefile.am): Test it. * doc/posix-functions/btowc.texi: Mention the two C locale behaviour bugs and that they are worked around. --- tests/test-btowc3.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 tests/test-btowc3.sh (limited to 'tests/test-btowc3.sh') diff --git a/tests/test-btowc3.sh b/tests/test-btowc3.sh new file mode 100755 index 0000000000..ee9e143c1c --- /dev/null +++ b/tests/test-btowc3.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +# Test whether the POSIX locale has encoding errors. +LC_ALL=C \ +${CHECKER} ./test-btowc${EXEEXT} 3 || exit 1 +LC_ALL=POSIX \ +${CHECKER} ./test-btowc${EXEEXT} 3 || exit 1 + +exit 0 -- cgit v1.2.1