+2025-02-16 Bruno Haible <bruno@clisp.org>
+
+ strings-h: Don't declare strcasecmp, strncasecmp without the module.
+ * lib/strings.in.h (strcasecmp): Don't declare if module 'strcasecmp' is
+ not present.
+ (strncasecmp): Don't declare if module 'strncasecmp' is not present.
+ * m4/strings_h.m4 (gl_STRINGS_H_REQUIRE_DEFAULTS): Initialize
+ GNULIB_STRCASECMP, GNULIB_STRNCASECMP.
+ * modules/strings-h (Makefile.am): Substitute GNULIB_STRCASECMP,
+ GNULIB_STRNCASECMP.
+
2025-02-16 Bruno Haible <bruno@clisp.org>
strcasecmp, strncasecmp: New modules.
#endif
- /* Find the index of the least-significant set bit. */
#if @GNULIB_FFS@
+/* Find the index of the least-significant set bit. */
# if !@HAVE_FFS@
_GL_FUNCDECL_SYS (ffs, int, (int i), );
# endif
# endif
#endif
+#if @GNULIB_STRCASECMP@
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
greater than zero if S1 is lexicographically less than, equal to or greater
than S2.
Note: This function does not work in multibyte locales. */
-#if ! @HAVE_STRCASECMP@
+# if ! @HAVE_STRCASECMP@
extern int strcasecmp (char const *s1, char const *s2)
_GL_ARG_NONNULL ((1, 2));
-#endif
-#if defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
/* strcasecmp() does not work with multibyte strings:
POSIX says that it operates on "strings", and "string" in POSIX is defined
as a sequence of bytes, not of characters. */
# endif
#endif
+#if @GNULIB_STRNCASECMP@
/* Compare no more than N bytes of strings S1 and S2, ignoring case,
returning less than, equal to or greater than zero if S1 is
lexicographically less than, equal to or greater than S2.
Note: This function cannot work correctly in multibyte locales. */
-#if ! @HAVE_DECL_STRNCASECMP@
+# if ! @HAVE_DECL_STRNCASECMP@
extern int strncasecmp (char const *s1, char const *s2, size_t n)
_GL_ARG_NONNULL ((1, 2));
-#endif
-#if defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
/* strncasecmp() does not work with multibyte strings:
POSIX says that it operates on "strings", and "string" in POSIX is defined
as a sequence of bytes, not of characters. */
# strings_h.m4
-# serial 9
+# serial 10
dnl Copyright (C) 2007, 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,
[
m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS], [
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASECMP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCASECMP])
])
m4_require(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS])
AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
-e 's/@''GNULIB_FFS''@/$(GNULIB_FFS)/g' \
+ -e 's/@''GNULIB_STRCASECMP''@/$(GNULIB_STRCASECMP)/g' \
+ -e 's/@''GNULIB_STRNCASECMP''@/$(GNULIB_STRNCASECMP)/g' \
-e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \
-e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
-e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \