* modules/c-strcasecmp: New file.
* modules/c-strncasecmp: New file.
* modules/c-strcase: Merely depend on c-strcasecmp, c-strncasecmp.
* lib/strings.in.h (strcasecmp, strncasecmp): Update warning message.
* tests/test-c-strcasecmp.sh: New file, based on
tests/test-c-strcase.sh.
* tests/test-c-strncasecmp.sh: New file, based on
tests/test-c-strcase.sh.
* tests/test-c-strcase.sh: Remove file.
* modules/c-strcasecmp-tests: New file.
* modules/c-strncasecmp-tests: New file.
* modules/c-strcase-tests: Remove file.
* doc/c-strcasecmp.texi: New file, based on doc/c-strcase.texi.
* doc/c-strncasecmp.texi: New file, based on doc/c-strcase.texi.
* doc/c-strcase.texi: Remove file.
* doc/c-locale.texi: Include c-strcasecmp.texi and c-strncasecmp.texi
separately.
* modules/c-strcaseeq (Depends-on): Add c-strcasecmp. Remove c-strcase.
* modules/iconv_open (Depends-on): Likewise.
* modules/nl_langinfo-tests (Depends-on): Likewise.
* modules/propername (Depends-on): Likewise.
* modules/propername-lite (Depends-on): Likewise.
* modules/striconv (Depends-on): Likewise.
* modules/striconveh (Depends-on): Likewise.
* modules/striconveha (Depends-on): Likewise.
* modules/c-strcasestr (Depends-on): Add c-strncasecmp. Remove
c-strcase.
+2025-02-16 Bruno Haible <bruno@clisp.org>
+
+ c-strcasecmp, c-strncasecmp: New modules.
+ * modules/c-strcasecmp: New file.
+ * modules/c-strncasecmp: New file.
+ * modules/c-strcase: Merely depend on c-strcasecmp, c-strncasecmp.
+ * lib/strings.in.h (strcasecmp, strncasecmp): Update warning message.
+ * tests/test-c-strcasecmp.sh: New file, based on
+ tests/test-c-strcase.sh.
+ * tests/test-c-strncasecmp.sh: New file, based on
+ tests/test-c-strcase.sh.
+ * tests/test-c-strcase.sh: Remove file.
+ * modules/c-strcasecmp-tests: New file.
+ * modules/c-strncasecmp-tests: New file.
+ * modules/c-strcase-tests: Remove file.
+ * doc/c-strcasecmp.texi: New file, based on doc/c-strcase.texi.
+ * doc/c-strncasecmp.texi: New file, based on doc/c-strcase.texi.
+ * doc/c-strcase.texi: Remove file.
+ * doc/c-locale.texi: Include c-strcasecmp.texi and c-strncasecmp.texi
+ separately.
+ * modules/c-strcaseeq (Depends-on): Add c-strcasecmp. Remove c-strcase.
+ * modules/iconv_open (Depends-on): Likewise.
+ * modules/nl_langinfo-tests (Depends-on): Likewise.
+ * modules/propername (Depends-on): Likewise.
+ * modules/propername-lite (Depends-on): Likewise.
+ * modules/striconv (Depends-on): Likewise.
+ * modules/striconveh (Depends-on): Likewise.
+ * modules/striconveha (Depends-on): Likewise.
+ * modules/c-strcasestr (Depends-on): Add c-strncasecmp. Remove
+ c-strcase.
+
2025-02-16 Bruno Haible <bruno@clisp.org>
strings-h: Don't declare strcasecmp, strncasecmp without the module.
@menu
* c-ctype::
-* c-strcase::
* c-strcaseeq::
+* c-strcasecmp::
+* c-strncasecmp::
* c-strcasestr::
* c-strstr::
* c-strtod::
@subsubsection c-ctype
@include c-ctype.texi
-@node c-strcase
-@subsubsection c-strcase
-@include c-strcase.texi
-
@node c-strcaseeq
@subsubsection c-strcaseeq
@include c-strcaseeq.texi
+@node c-strcasecmp
+@subsubsection c-strcasecmp
+@include c-strcasecmp.texi
+
+@node c-strncasecmp
+@subsubsection c-strncasecmp
+@include c-strncasecmp.texi
+
@node c-strcasestr
@subsubsection c-strcasestr
@include c-strcasestr.texi
--- /dev/null
+@c Documentation of gnulib module 'c-strcasecmp'.
+
+@c Copyright (C) 2008--2025 Free Software Foundation, Inc.
+
+@c Permission is granted to copy, distribute and/or modify this document
+@c under the terms of the GNU Free Documentation License, Version 1.3 or
+@c any later version published by the Free Software Foundation; with no
+@c Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
+@c copy of the license is at <https://www.gnu.org/licenses/fdl-1.3.en.html>.
+
+@mindex c-strcasecmp
+The @code{c-strcasecmp} module contains a case-insensitive string comparison
+function operating on single-byte character strings, like the functions in
+@code{<strings.h>}, that operate as if the locale encoding was ASCII.
+(The "C" locale on many systems has the locale encoding "ASCII".)
+
+The function is:
+@smallexample
+extern int c_strcasecmp (const char *s1, const char *s2);
+@end smallexample
+
+For case conversion here, only ASCII characters are considered to be
+upper case or lower case.
+
+Note: The function @code{strcasecmp} from @code{<strings.h>}
+supports only unibyte locales;
+@mindex mbscasecmp
+for multibyte locales,
+you need the function @code{mbscasecmp}.
-@c Documentation of gnulib module 'c-strcase'.
+@c Documentation of gnulib module 'c-strncasecmp'.
@c Copyright (C) 2008--2025 Free Software Foundation, Inc.
@c Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
@c copy of the license is at <https://www.gnu.org/licenses/fdl-1.3.en.html>.
-@mindex c-strcase
-The @code{c-strcase} module contains case-insensitive string comparison
-functions operating on single-byte character strings, like the functions in
+@mindex c-strncasecmp
+The @code{c-strncasecmp} module contains a case-insensitive string comparison
+function operating on single-byte character strings, like the functions in
@code{<strings.h>}, that operate as if the locale encoding was ASCII.
(The "C" locale on many systems has the locale encoding "ASCII".)
-The functions are:
+The function is:
@smallexample
-extern int c_strcasecmp (const char *s1, const char *s2);
extern int c_strncasecmp (const char *s1, const char *s2, size_t n);
@end smallexample
For case conversion here, only ASCII characters are considered to be
upper case or lower case.
-Note: The functions @code{strcasecmp}, @code{strncasecmp} from
-@code{<strings.h>} support only unibyte locales;
-@mindex mbscasecmp
+Note: The function @code{strncasecmp} from @code{<strings.h>}
+supports only unibyte locales;
@mindex mbsncasecmp
@mindex mbspcasecmp
for multibyte locales,
-you need the functions @code{mbscasecmp}, @code{mbsncasecmp},
-@code{mbspcasecmp}.
+you need the function @code{mbsncasecmp} or @code{mbspcasecmp}.
"strings in multibyte locales - "
"use mbscasecmp if you care about "
"internationalization, or use c_strcasecmp "
- "(gnulib module c-strcase) if you want a locale "
+ "(gnulib module c-strcasecmp) if you want a locale "
"independent function");
# endif
#endif
"strings in multibyte locales - "
"use mbsncasecmp or mbspcasecmp if you care about "
"internationalization, or use c_strncasecmp "
- "(gnulib module c-strcase) if you want a locale "
+ "(gnulib module c-strncasecmp) if you want a locale "
"independent function");
# endif
#endif
Case-insensitive string comparison functions in C locale.
Files:
-lib/c-strcase.h
-lib/c-strcasecmp.c
-lib/c-strncasecmp.c
Depends-on:
-c-ctype
+c-strcasecmp
+c-strncasecmp
configure.ac:
Makefile.am:
-lib_SOURCES += c-strcase.h c-strcasecmp.c c-strncasecmp.c
Include:
"c-strcase.h"
--- /dev/null
+Description:
+Case-insensitive string comparison functions in C locale.
+
+Files:
+lib/c-strcase.h
+lib/c-strcasecmp.c
+
+Depends-on:
+c-ctype
+
+configure.ac:
+
+Makefile.am:
+lib_SOURCES += c-strcasecmp.c
+
+Include:
+"c-strcase.h"
+
+License:
+LGPLv2+
+
+Maintainer:
+all
--- /dev/null
+Files:
+tests/test-c-strcasecmp.sh
+tests/test-c-strcasecmp.c
+tests/macros.h
+m4/locale-fr.m4
+m4/locale-tr.m4
+m4/codeset.m4
+
+Depends-on:
+c-ctype
+setlocale
+
+configure.ac:
+gt_LOCALE_FR
+gt_LOCALE_TR_UTF8
+
+Makefile.am:
+TESTS += test-c-strcasecmp.sh
+TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
+check_PROGRAMS += test-c-strcasecmp
+test_c_strcasecmp_LDADD = $(LDADD) $(SETLOCALE_LIB)
lib/c-strcaseeq.h
Depends-on:
-c-strcase
+c-strcasecmp
c-ctype
configure.ac:
Depends-on:
c-ctype
-c-strcase
+c-strncasecmp
bool
memchr
memcmp
--- /dev/null
+Description:
+Case-insensitive string comparison functions in C locale.
+
+Files:
+lib/c-strcase.h
+lib/c-strncasecmp.c
+
+Depends-on:
+c-ctype
+
+configure.ac:
+
+Makefile.am:
+lib_SOURCES += c-strncasecmp.c
+
+Include:
+"c-strcase.h"
+
+License:
+LGPLv2+
+
+Maintainer:
+all
Files:
-tests/test-c-strcase.sh
-tests/test-c-strcasecmp.c
+tests/test-c-strncasecmp.sh
tests/test-c-strncasecmp.c
tests/macros.h
m4/locale-fr.m4
gt_LOCALE_TR_UTF8
Makefile.am:
-TESTS += test-c-strcase.sh
+TESTS += test-c-strncasecmp.sh
TESTS_ENVIRONMENT += LOCALE_FR='@LOCALE_FR@' LOCALE_TR_UTF8='@LOCALE_TR_UTF8@'
-check_PROGRAMS += test-c-strcasecmp test-c-strncasecmp
-test_c_strcasecmp_LDADD = $(LDADD) $(SETLOCALE_LIB)
+check_PROGRAMS += test-c-strncasecmp
test_c_strncasecmp_LDADD = $(LDADD) $(SETLOCALE_LIB)
iconv-h
iconv
c-ctype [test $REPLACE_ICONV_OPEN = 1]
-c-strcase [test $REPLACE_ICONV_OPEN = 1]
+c-strcasecmp [test $REPLACE_ICONV_OPEN = 1]
stdint-h [test $REPLACE_ICONV_UTF = 1]
unistr/u8-mbtoucr [test $REPLACE_ICONV_UTF = 1]
unistr/u8-uctomb [test $REPLACE_ICONV_UTF = 1]
m4/musl.m4
Depends-on:
-c-strcase
+c-strcasecmp
c-strcasestr
setlocale
thread
mbuiter
iconv
localcharset
-c-strcase
+c-strcasecmp
xstriconv
xalloc
gettext-h
Depends-on:
localcharset
-c-strcase
+c-strcasecmp
gettext-h
configure.ac:
iconv_open
free-posix
strdup
-c-strcase
+c-strcasecmp
configure.ac:
if test $gl_cond_libtool = false; then
unistr/u8-uctomb
free-posix
strdup
-c-strcase
+c-strcasecmp
c-strcaseeq
memmove
striconveh
malloca
strdup
-c-strcase
+c-strcasecmp
configure.ac:
--- /dev/null
+#!/bin/sh
+
+# Test in the C locale.
+${CHECKER} ./test-c-strcasecmp${EXEEXT} || exit 1
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR != none; then
+ LC_ALL=$LOCALE_FR ${CHECKER} ./test-c-strcasecmp${EXEEXT} locale || exit 1
+fi
+
+# Test in a Turkish UTF-8 locale.
+: "${LOCALE_TR_UTF8=tr_TR.UTF-8}"
+if test $LOCALE_TR_UTF8 != none; then
+ LC_ALL=$LOCALE_TR_UTF8 ${CHECKER} ./test-c-strcasecmp${EXEEXT} locale || exit 1
+fi
+
+exit 0
#!/bin/sh
# Test in the C locale.
-${CHECKER} ./test-c-strcasecmp${EXEEXT} || exit 1
${CHECKER} ./test-c-strncasecmp${EXEEXT} || exit 1
# Test in an ISO-8859-1 or ISO-8859-15 locale.
: "${LOCALE_FR=fr_FR}"
if test $LOCALE_FR != none; then
- LC_ALL=$LOCALE_FR ${CHECKER} ./test-c-strcasecmp${EXEEXT} locale || exit 1
LC_ALL=$LOCALE_FR ${CHECKER} ./test-c-strncasecmp${EXEEXT} locale || exit 1
fi
# Test in a Turkish UTF-8 locale.
: "${LOCALE_TR_UTF8=tr_TR.UTF-8}"
if test $LOCALE_TR_UTF8 != none; then
- LC_ALL=$LOCALE_TR_UTF8 ${CHECKER} ./test-c-strcasecmp${EXEEXT} locale || exit 1
LC_ALL=$LOCALE_TR_UTF8 ${CHECKER} ./test-c-strncasecmp${EXEEXT} locale || exit 1
fi