Having a portable 'locale_t' type is only part of what applications need.
They also need the corresponding functions. The following are specified
by POSIX:
  is*_l
  isw*_l
  nl_langinfo_l
  str*casecmp_l
  strcoll_l
  strerror_l
  strfmon_l
  strftime_l
  strxfrm_l
  tolower_l
  toupper_l
  towctrans_l
  towlower_l
  towupper_l
  wcscasecmp_l
  wcscoll_l
  wcsncasecmp_l
  wcsxfrm_l
  wctrans_l
  wctype_l
  getlocalename_l
  gettext_l

There are many more locale-sensitive functions, from mbrtowc to strtod.
POSIX does not have the corresponding *_l functions for all of there,
because they assumed that the programmer can use uselocale() to get
the same effect. But this does not work portably: Native Windows and
NetBSD platforms don't have uselocale(), and there is no way to implement
uselocale() in Gnulib. (We would have to override *all* locale-sensitive
functions, from mbrtowc over strtod to fprintf. This is not feasible.)

So, in order to fulfil the two use-cases from [1], we'll need many
*_l functions.

[1] https://lists.gnu.org/archive/html/bug-gnulib/2025-02/msg00083.html

Let me start with the LC_CTYPE category and function isalnum_l.


2025-02-14  Bruno Haible  <br...@clisp.org>

        isalnum_l: Add tests.
        * tests/test-isalnum_l.c: New file, based on tests/test-c32isalnum.c.
        * modules/isalnum_l-tests: New file.

        isalnum_l: New module.
        * lib/ctype.in.h: Include <locale.h>.
        (isalnum_l): New declaration.
        * lib/isalnum_l.c: New file.
        * lib/is_l-impl.h: New file.
        * m4/isalnum_l.m4: New file.
        * m4/ctype_h.m4 (gl_CTYPE_H): Test for isalnum_l.
        (gl_CTYPE_H_REQUIRE_DEFAULTS): Initialize GNULIB_ISALNUM_L.
        (gl_CTYPE_H_DEFAULTS): Initialize HAVE_ISALNUM_L.
        * modules/ctype-h (Makefile.am): Substitute GNULIB_ISALNUM_L,
        HAVE_ISALNUM_L.
        * modules/isalnum_l: New file.
        * tests/test-ctype-h-c++.cc: Check declaration of isalnum_l.
        * doc/posix-functions/isalnum_l.texi: Mention the new module.

>From eb6c37868f593b61b3924b28901cf0c20510aa15 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Fri, 14 Feb 2025 06:17:24 +0100
Subject: [PATCH 1/2] isalnum_l: New module.

* lib/ctype.in.h: Include <locale.h>.
(isalnum_l): New declaration.
* lib/isalnum_l.c: New file.
* lib/is_l-impl.h: New file.
* m4/isalnum_l.m4: New file.
* m4/ctype_h.m4 (gl_CTYPE_H): Test for isalnum_l.
(gl_CTYPE_H_REQUIRE_DEFAULTS): Initialize GNULIB_ISALNUM_L.
(gl_CTYPE_H_DEFAULTS): Initialize HAVE_ISALNUM_L.
* modules/ctype-h (Makefile.am): Substitute GNULIB_ISALNUM_L,
HAVE_ISALNUM_L.
* modules/isalnum_l: New file.
* tests/test-ctype-h-c++.cc: Check declaration of isalnum_l.
* doc/posix-functions/isalnum_l.texi: Mention the new module.
---
 ChangeLog                          | 17 ++++++++++
 doc/posix-functions/isalnum_l.texi |  9 +++---
 lib/ctype.in.h                     | 35 ++++++++++++++++++++
 lib/is_l-impl.h                    | 52 ++++++++++++++++++++++++++++++
 lib/isalnum_l.c                    | 31 ++++++++++++++++++
 m4/ctype_h.m4                      |  8 +++--
 m4/isalnum_l.m4                    | 23 +++++++++++++
 modules/ctype-h                    |  2 ++
 modules/isalnum_l                  | 33 +++++++++++++++++++
 tests/test-ctype-h-c++.cc          |  4 +++
 10 files changed, 207 insertions(+), 7 deletions(-)
 create mode 100644 lib/is_l-impl.h
 create mode 100644 lib/isalnum_l.c
 create mode 100644 m4/isalnum_l.m4
 create mode 100644 modules/isalnum_l

diff --git a/ChangeLog b/ChangeLog
index 56a0f20744..6e9c103bad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2025-02-14  Bruno Haible  <br...@clisp.org>
+
+	isalnum_l: New module.
+	* lib/ctype.in.h: Include <locale.h>.
+	(isalnum_l): New declaration.
+	* lib/isalnum_l.c: New file.
+	* lib/is_l-impl.h: New file.
+	* m4/isalnum_l.m4: New file.
+	* m4/ctype_h.m4 (gl_CTYPE_H): Test for isalnum_l.
+	(gl_CTYPE_H_REQUIRE_DEFAULTS): Initialize GNULIB_ISALNUM_L.
+	(gl_CTYPE_H_DEFAULTS): Initialize HAVE_ISALNUM_L.
+	* modules/ctype-h (Makefile.am): Substitute GNULIB_ISALNUM_L,
+	HAVE_ISALNUM_L.
+	* modules/isalnum_l: New file.
+	* tests/test-ctype-h-c++.cc: Check declaration of isalnum_l.
+	* doc/posix-functions/isalnum_l.texi: Mention the new module.
+
 2025-02-14  Bruno Haible  <br...@clisp.org>
 
 	freelocale: Allow non-POSIX prototype on macOS.
diff --git a/doc/posix-functions/isalnum_l.texi b/doc/posix-functions/isalnum_l.texi
index c56bdcd1f3..36c0223697 100644
--- a/doc/posix-functions/isalnum_l.texi
+++ b/doc/posix-functions/isalnum_l.texi
@@ -4,15 +4,16 @@
 
 POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/isalnum_l.html}
 
-Gnulib module: ---
+Gnulib module: isalnum_l
+@mindex isalnum_l
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+FreeBSD 6.0, NetBSD 5.0, OpenBSD 6.0, Minix 3.1.8, AIX 5.1, HP-UX 11, Solaris 11.3, Cygwin 1.7.x, mingw, MSVC 14, Android 4.4.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-FreeBSD 6.0, NetBSD 5.0, OpenBSD 6.0, Minix 3.1.8, AIX 5.1, HP-UX 11, Solaris 11.3, Cygwin 1.7.x, mingw, MSVC 14, Android 4.4.
 @end itemize
diff --git a/lib/ctype.in.h b/lib/ctype.in.h
index 13cfe60ffd..1ca6437c82 100644
--- a/lib/ctype.in.h
+++ b/lib/ctype.in.h
@@ -29,6 +29,19 @@
 #endif
 @PRAGMA_COLUMNS@
 
+/* On Solaris 11 OmniOS, we cannot include <locale.h> until after <wchar.h> has
+   been entirely included.  That is because
+     - <locale.h> includes <xlocale.h>, which makes use of the mbstate_t type.
+     - <wchar.h> includes <iso/wchar_iso.h>, which includes <ctype.h> *before*
+       defining mbstate_t, WEOF, etc.  */
+#if defined __sun && defined _ISO_WCHAR_ISO_H && !defined WEOF
+/* We're in the middle of including <iso/wchar_iso.h>.
+   Include just the original <ctype.h>.  */
+
+#@INCLUDE_NEXT@ @NEXT_CTYPE_H@
+
+#else
+
 /* Include the original <ctype.h>.  */
 /* The include_next requires a split double-inclusion guard.  */
 #@INCLUDE_NEXT@ @NEXT_CTYPE_H@
@@ -41,10 +54,31 @@
  #error "Please include config.h first."
 #endif
 
+#if @GNULIB_ISALNUM_L@
+/* Get locale_t.  */
+# include <locale.h>
+#endif
+
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
 /* The definition of _GL_WARN_ON_USE is copied here.  */
 
+/* Return non-zero if c is alphanumeric.  */
+#if @GNULIB_ISALNUM_L@
+# if !@HAVE_ISALNUM_L@
+_GL_FUNCDECL_SYS (isalnum_l, int, (int c, locale_t locale),
+                                  _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (isalnum_l, int, (int c, locale_t locale));
+_GL_CXXALIASWARN (isalnum_l);
+#elif defined GNULIB_POSIXCHECK
+# undef isalnum_l
+# if HAVE_RAW_DECL_ISALNUM_L
+_GL_WARN_ON_USE (isalnum_l, "isalnum_l is unportable - "
+                 "use gnulib module isalnum_l for portability");
+# endif
+#endif
+
 /* Return non-zero if c is a blank, i.e. a space or tab character.  */
 #if @GNULIB_ISBLANK@
 # if !@HAVE_ISBLANK@
@@ -59,4 +93,5 @@ _GL_WARN_ON_USE (isblank, "isblank is unportable - "
 #endif
 
 #endif /* _@GUARD_PREFIX@_CTYPE_H */
+#endif
 #endif /* _@GUARD_PREFIX@_CTYPE_H */
diff --git a/lib/is_l-impl.h b/lib/is_l-impl.h
new file mode 100644
index 0000000000..27de6de898
--- /dev/null
+++ b/lib/is_l-impl.h
@@ -0,0 +1,52 @@
+/* Test whether a single-byte character belongs to a specific character class.
+   Copyright (C) 2025 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <br...@clisp.org>, 2025.  */
+
+#include <locale.h>
+#include <stdio.h>
+
+int
+FUNC (int c, locale_t locale)
+{
+  struct gl_locale_category_t *plc =
+    &locale->category[gl_log2_lc_mask (LC_CTYPE)];
+  if (plc->is_c_locale)
+    /* Implementation for the "C" locale.  */
+    return C_FUNC (c);
+#if HAVE_WINDOWS_LOCALE_T
+# ifdef __MINGW32__
+  /* mingw mistreats EOF by casting the argument to 'unsigned char'.
+     <https://sourceforge.net/p/mingw-w64/mingw-w64/ci/b633824ecafdf52a76e6a205e6776b182978720d>  */
+  if (c == EOF)
+    return 0;
+# endif
+  return WINDOWS_FUNC (c, plc->system_locale);
+#else
+  /* Implementation for the global locale.  */
+  {
+    int ret;
+# if HAVE_WORKING_USELOCALE
+    locale_t saved_locale = uselocale (LC_GLOBAL_LOCALE);
+# endif
+    ret = GLOBAL_FUNC (c);
+# if HAVE_WORKING_USELOCALE
+    uselocale (saved_locale);
+# endif
+    return ret;
+  }
+#endif
+}
diff --git a/lib/isalnum_l.c b/lib/isalnum_l.c
new file mode 100644
index 0000000000..aee1d3575a
--- /dev/null
+++ b/lib/isalnum_l.c
@@ -0,0 +1,31 @@
+/* Test whether a single-byte character is alphanumeric.
+   Copyright (C) 2025 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <br...@clisp.org>, 2025.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <ctype.h>
+
+#define FUNC isalnum_l
+#define GLOBAL_FUNC isalnum
+#define C_FUNC(c) \
+  ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9'))
+/* Documentation:
+   <https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/isalnum-iswalnum-isalnum-l-iswalnum-l>  */
+#define WINDOWS_FUNC _isalnum_l
+#include "is_l-impl.h"
diff --git a/m4/ctype_h.m4 b/m4/ctype_h.m4
index 801b4ff687..c97a7b9352 100644
--- a/m4/ctype_h.m4
+++ b/m4/ctype_h.m4
@@ -1,5 +1,5 @@
 # ctype_h.m4
-# serial 9
+# serial 10
 dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -16,7 +16,7 @@ AC_DEFUN_ONCE([gl_CTYPE_H]
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
   gl_WARN_ON_USE_PREPARE([[#include <ctype.h>
-    ]], [isblank])
+    ]], [isalnum_l isblank])
 ])
 
 # gl_CTYPE_MODULE_INDICATOR([modulename])
@@ -36,6 +36,7 @@ AC_DEFUN([gl_CTYPE_MODULE_INDICATOR]
 AC_DEFUN([gl_CTYPE_H_REQUIRE_DEFAULTS],
 [
   m4_defun(GL_MODULE_INDICATOR_PREFIX[_CTYPE_H_MODULE_INDICATOR_DEFAULTS], [
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISALNUM_L])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISBLANK])
   ])
   m4_require(GL_MODULE_INDICATOR_PREFIX[_CTYPE_H_MODULE_INDICATOR_DEFAULTS])
@@ -45,5 +46,6 @@ AC_DEFUN([gl_CTYPE_H_REQUIRE_DEFAULTS]
 AC_DEFUN([gl_CTYPE_H_DEFAULTS],
 [
   dnl Assume proper GNU behavior unless another module says otherwise.
-  HAVE_ISBLANK=1;   AC_SUBST([HAVE_ISBLANK])
+  HAVE_ISALNUM_L=1;   AC_SUBST([HAVE_ISALNUM_L])
+  HAVE_ISBLANK=1;     AC_SUBST([HAVE_ISBLANK])
 ])
diff --git a/m4/isalnum_l.m4 b/m4/isalnum_l.m4
new file mode 100644
index 0000000000..cf613db234
--- /dev/null
+++ b/m4/isalnum_l.m4
@@ -0,0 +1,23 @@
+# isalnum_l.m4
+# serial 1
+dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl This file is offered as-is, without any warranty.
+
+AC_DEFUN([gl_FUNC_ISALNUM_L],
+[
+  AC_REQUIRE([gl_CTYPE_H_DEFAULTS])
+
+  dnl Persuade glibc <ctype.h> to declare isalnum_l().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+  AC_CHECK_FUNCS_ONCE([isalnum_l])
+  if test $ac_cv_func_isalnum_l = no; then
+    HAVE_ISALNUM_L=0
+  fi
+
+  dnl Prerequisites of lib/isalnum_l.c.
+  AC_REQUIRE([gt_FUNC_USELOCALE])
+])
diff --git a/modules/ctype-h b/modules/ctype-h
index ca22800163..a7f04a3621 100644
--- a/modules/ctype-h
+++ b/modules/ctype-h
@@ -30,7 +30,9 @@ ctype.h: ctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
 	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
 	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
 	      -e 's|@''NEXT_CTYPE_H''@|$(NEXT_CTYPE_H)|g' \
+	      -e 's/@''GNULIB_ISALNUM_L''@/$(GNULIB_ISALNUM_L)/g' \
 	      -e 's/@''GNULIB_ISBLANK''@/$(GNULIB_ISBLANK)/g' \
+	      -e 's/@''HAVE_ISALNUM_L''@/$(HAVE_ISALNUM_L)/g' \
 	      -e 's/@''HAVE_ISBLANK''@/$(HAVE_ISBLANK)/g' \
 	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
 	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
diff --git a/modules/isalnum_l b/modules/isalnum_l
new file mode 100644
index 0000000000..f4ce7b8cdd
--- /dev/null
+++ b/modules/isalnum_l
@@ -0,0 +1,33 @@
+Description:
+isalnum_l() function: test whether a single-byte character is alphanumeric.
+
+Files:
+lib/isalnum_l.c
+lib/is_l-impl.h
+m4/isalnum_l.m4
+m4/intl-thread-locale.m4
+
+Depends-on:
+ctype-h
+locale-h
+extensions
+
+configure.ac:
+gl_FUNC_ISALNUM_L
+gl_CONDITIONAL([GL_COND_OBJ_ISALNUM_L], [test $HAVE_ISALNUM_L = 0])
+gl_MODULE_INDICATOR([isalnum_l])
+gl_CTYPE_MODULE_INDICATOR([isalnum_l])
+
+Makefile.am:
+if GL_COND_OBJ_ISALNUM_L
+lib_SOURCES += isalnum_l.c
+endif
+
+Include:
+<ctype.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/tests/test-ctype-h-c++.cc b/tests/test-ctype-h-c++.cc
index 395cc59286..99d6bd43b7 100644
--- a/tests/test-ctype-h-c++.cc
+++ b/tests/test-ctype-h-c++.cc
@@ -24,6 +24,10 @@
 #include "signature.h"
 
 
+#if GNULIB_TEST_ISALNUM_L
+SIGNATURE_CHECK (GNULIB_NAMESPACE::isalnum_l, int, (int, locale-t));
+#endif
+
 #if 0
 SIGNATURE_CHECK (GNULIB_NAMESPACE::isblank, int, (int));
 #endif
-- 
2.43.0

>From e77e5cc840a1f5b1e36947c44edd36cf4332728c Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Fri, 14 Feb 2025 09:01:06 +0100
Subject: [PATCH 2/2] isalnum_l: Add tests.

* tests/test-isalnum_l.c: New file, based on tests/test-c32isalnum.c.
* modules/isalnum_l-tests: New file.
---
 ChangeLog               |   4 ++
 modules/isalnum_l-tests |  16 +++++
 tests/test-isalnum_l.c  | 143 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 163 insertions(+)
 create mode 100644 modules/isalnum_l-tests
 create mode 100644 tests/test-isalnum_l.c

diff --git a/ChangeLog b/ChangeLog
index 6e9c103bad..1e0df76df0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2025-02-14  Bruno Haible  <br...@clisp.org>
 
+	isalnum_l: Add tests.
+	* tests/test-isalnum_l.c: New file, based on tests/test-c32isalnum.c.
+	* modules/isalnum_l-tests: New file.
+
 	isalnum_l: New module.
 	* lib/ctype.in.h: Include <locale.h>.
 	(isalnum_l): New declaration.
diff --git a/modules/isalnum_l-tests b/modules/isalnum_l-tests
new file mode 100644
index 0000000000..2fab4fd61f
--- /dev/null
+++ b/modules/isalnum_l-tests
@@ -0,0 +1,16 @@
+Files:
+tests/test-isalnum_l.c
+tests/signature.h
+tests/macros.h
+m4/musl.m4
+
+Depends-on:
+newlocale
+freelocale
+
+configure.ac:
+gl_MUSL_LIBC
+
+Makefile.am:
+TESTS += test-isalnum_l
+check_PROGRAMS += test-isalnum_l
diff --git a/tests/test-isalnum_l.c b/tests/test-isalnum_l.c
new file mode 100644
index 0000000000..6f18526f5c
--- /dev/null
+++ b/tests/test-isalnum_l.c
@@ -0,0 +1,143 @@
+/* Test of isalnum_l() function.
+   Copyright (C) 2020-2025 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <ctype.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (isalnum_l, int, (int, locale_t));
+
+#include <locale.h>
+#include <stdio.h>
+
+#include "macros.h"
+
+static void
+test_single_locale_common (locale_t locale)
+{
+  int is;
+
+  /* Test EOF.  */
+  is = isalnum_l (EOF, locale);
+  ASSERT (is == 0);
+
+  /* POSIX specifies in
+       <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
+     that
+       - in all locales, the alphanumeric characters include the uppercase and
+         lowercase characters and digits and, consequently, include the A ... Z
+         and a ... z and 0 ... 9 characters.
+       - in the "POSIX" locale (which is usually the same as the "C" locale),
+         the alphanumeric characters include only the ASCII A ... Z and a ... z
+         and 0 ... 9 characters.  */
+  {
+    int c;
+
+    for (c = 0; c < 0x100; c++)
+      switch (c)
+        {
+        case '\t': case '\v': case '\f':
+        case ' ': case '!': case '"': case '#': case '%':
+        case '&': case '\'': case '(': case ')': case '*':
+        case '+': case ',': case '-': case '.': case '/':
+        case '0': case '1': case '2': case '3': case '4':
+        case '5': case '6': case '7': case '8': case '9':
+        case ':': case ';': case '<': case '=': case '>':
+        case '?':
+        case 'A': case 'B': case 'C': case 'D': case 'E':
+        case 'F': case 'G': case 'H': case 'I': case 'J':
+        case 'K': case 'L': case 'M': case 'N': case 'O':
+        case 'P': case 'Q': case 'R': case 'S': case 'T':
+        case 'U': case 'V': case 'W': case 'X': case 'Y':
+        case 'Z':
+        case '[': case '\\': case ']': case '^': case '_':
+        case 'a': case 'b': case 'c': case 'd': case 'e':
+        case 'f': case 'g': case 'h': case 'i': case 'j':
+        case 'k': case 'l': case 'm': case 'n': case 'o':
+        case 'p': case 'q': case 'r': case 's': case 't':
+        case 'u': case 'v': case 'w': case 'x': case 'y':
+        case 'z': case '{': case '|': case '}': case '~':
+          /* c is in the ISO C "basic character set".  */
+          is = isalnum_l ((unsigned char) c, locale);
+          switch (c)
+            {
+            case '0': case '1': case '2': case '3': case '4':
+            case '5': case '6': case '7': case '8': case '9':
+            case 'A': case 'B': case 'C': case 'D': case 'E':
+            case 'F': case 'G': case 'H': case 'I': case 'J':
+            case 'K': case 'L': case 'M': case 'N': case 'O':
+            case 'P': case 'Q': case 'R': case 'S': case 'T':
+            case 'U': case 'V': case 'W': case 'X': case 'Y':
+            case 'Z':
+            case 'a': case 'b': case 'c': case 'd': case 'e':
+            case 'f': case 'g': case 'h': case 'i': case 'j':
+            case 'k': case 'l': case 'm': case 'n': case 'o':
+            case 'p': case 'q': case 'r': case 's': case 't':
+            case 'u': case 'v': case 'w': case 'x': case 'y':
+            case 'z':
+              ASSERT (is != 0);
+              break;
+            default:
+              ASSERT (is == 0);
+              break;
+            }
+          break;
+        }
+  }
+}
+
+int
+main ()
+{
+  {
+    locale_t locale = newlocale (LC_ALL_MASK, "C", NULL);
+    ASSERT (locale != NULL);
+
+    test_single_locale_common (locale);
+
+    freelocale (locale);
+  }
+#if !MUSL_LIBC /* musl libc has no unibyte locales */
+  {
+# if defined _WIN32 && !defined __CYGWIN__
+    locale_t locale = newlocale (LC_ALL_MASK, "French_France.1252", NULL);
+# else
+    locale_t locale = newlocale (LC_ALL_MASK, "fr_FR.ISO-8859-1", NULL);
+    if (locale == NULL)
+      locale = newlocale (LC_ALL_MASK, "fr_FR.ISO8859-1", NULL);
+# endif
+    if (locale != NULL)
+      {
+        test_single_locale_common (locale);
+
+        /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
+        int is;
+
+        /* U+00D7 MULTIPLICATION SIGN */
+        is = isalnum_l ((unsigned char) '\327', locale);
+        ASSERT (is == 0);
+        /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
+        is = isalnum_l ((unsigned char) '\330', locale);
+        ASSERT (is != 0);
+
+        freelocale (locale);
+      }
+  }
+#endif
+
+  return test_exit_status;
+}
-- 
2.43.0

Reply via email to