]> Savannah Git Hosting - gnulib.git/commitdiff
strcasecmp, strncasecmp: New modules.
authorBruno Haible <bruno@clisp.org>
Sun, 16 Feb 2025 11:21:53 +0000 (12:21 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 16 Feb 2025 12:45:35 +0000 (13:45 +0100)
* modules/strcasecmp: New file.
* modules/strncasecmp: New file.
* modules/strcase: Merely depend on strcasecmp, strncasecmp.
* m4/strcasecmp.m4: New file, based on m4/strcase.m4.
* m4/strncasecmp.m4: New file, based on m4/strcase.m4.
* m4/strcase.m4: Remove file.
* lib/strings.in.h (strcasecmp, strncasecmp): Fix typo in warning
message.
* lib/strcasecmp.c: Improve comment.
* lib/strncasecmp.c: Likewise.
* doc/posix-functions/strcasecmp.texi: Mention module strcasecmp, not
module strcase.
* doc/posix-functions/strncasecmp.texi: Mention module strncasecmp, not
module strcase.
* doc/strings.texi (Comparison of string APIs): Reference modules
strcasecmp, strncasecmp.
* modules/argp (Depends-on): Add strcasecmp. Remove strcase.
* modules/strcasestr-simple (Depends-on): Add strncasecmp. Remove
strcase.
* modules/strptime (Depends-on): Likewise.

16 files changed:
ChangeLog
doc/posix-functions/strcasecmp.texi
doc/posix-functions/strncasecmp.texi
doc/strings.texi
lib/strcasecmp.c
lib/strings.in.h
lib/strncasecmp.c
m4/strcase.m4 [deleted file]
m4/strcasecmp.m4 [new file with mode: 0644]
m4/strncasecmp.m4 [new file with mode: 0644]
modules/argp
modules/strcase
modules/strcasecmp [new file with mode: 0644]
modules/strcasestr-simple
modules/strncasecmp [new file with mode: 0644]
modules/strptime

index 53bb4370732ddbcd29770d7d759bbaa7bb15bfc5..37255b17eaf1e45d9912c2d43752f61234cc495d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2025-02-16  Bruno Haible  <bruno@clisp.org>
+
+       strcasecmp, strncasecmp: New modules.
+       * modules/strcasecmp: New file.
+       * modules/strncasecmp: New file.
+       * modules/strcase: Merely depend on strcasecmp, strncasecmp.
+       * m4/strcasecmp.m4: New file, based on m4/strcase.m4.
+       * m4/strncasecmp.m4: New file, based on m4/strcase.m4.
+       * m4/strcase.m4: Remove file.
+       * lib/strings.in.h (strcasecmp, strncasecmp): Fix typo in warning
+       message.
+       * lib/strcasecmp.c: Improve comment.
+       * lib/strncasecmp.c: Likewise.
+       * doc/posix-functions/strcasecmp.texi: Mention module strcasecmp, not
+       module strcase.
+       * doc/posix-functions/strncasecmp.texi: Mention module strncasecmp, not
+       module strcase.
+       * doc/strings.texi (Comparison of string APIs): Reference modules
+       strcasecmp, strncasecmp.
+       * modules/argp (Depends-on): Add strcasecmp. Remove strcase.
+       * modules/strcasestr-simple (Depends-on): Add strncasecmp. Remove
+       strcase.
+       * modules/strptime (Depends-on): Likewise.
+
 2025-02-16  Bruno Haible  <bruno@clisp.org>
 
        ctype-h: Make ctype.h self-contained again (regr. 2025-02-14).
index 2de26616b2cc16a385ee40d2ab5b9374195d2fe8..af640589d9b23b2afbe39481b9aab294f5d73f2f 100644 (file)
@@ -4,8 +4,8 @@
 
 POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/strcasecmp.html}
 
-Gnulib module: strcase
-@mindex strcase
+Gnulib module: strcasecmp
+@mindex strcasecmp
 
 Portability problems fixed by Gnulib:
 @itemize
index 5273870215ff7eefc629d4ccfd4e2dd95604ba32..1fc9e0307a920f5d49dd7b4c3366c3686a8afef6 100644 (file)
@@ -4,8 +4,8 @@
 
 POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/strncasecmp.html}
 
-Gnulib module: strcase
-@mindex strcase
+Gnulib module: strncasecmp
+@mindex strncasecmp
 
 Portability problems fixed by Gnulib:
 @itemize
index 0493233ba0b67827772fa15c804a0e422c365e59..a33067f1f8192a905097329bee21010643fe9dea 100644 (file)
@@ -324,11 +324,12 @@ and in Gnulib.
 @mindex mbs_startswith
 @mindex stpcpy
 @mindex stpncpy
-@mindex strcase
+@mindex strcasecmp
 @mindex strcasestr
 @mindex strcspn
 @mindex strdup
 @mindex string-desc
+@mindex strncasecmp
 @mindex strncat
 @mindex strndup
 @mindex strnlen
index 27329368ad4c12ec5bd71f8dad7638a597ddbb14..fe21a6d5b3d1ec70c782082ca59f9bbdb5ed19ab 100644 (file)
@@ -1,4 +1,4 @@
-/* Case-insensitive string comparison function.
+/* Case-insensitive string comparison function for unibyte locales.
    Copyright (C) 1998-1999, 2005-2007, 2009-2025 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
index b09f3eed8915e4fab9469477fef0518b71c55791..f99b7c95e8afa7fe5f88a8c80851a5bbb059a0a5 100644 (file)
@@ -89,8 +89,8 @@ extern int strcasecmp (char const *s1, char const *s2)
 _GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character "
                  "strings in multibyte locales - "
                  "use mbscasecmp if you care about "
-                 "internationalization, or use c_strcasecmp "
-                 "gnulib module c-strcase) if you want a locale "
+                 "internationalization, or use c_strcasecmp "
+                 "(gnulib module c-strcase) if you want a locale "
                  "independent function");
 # endif
 #endif
@@ -112,8 +112,8 @@ extern int strncasecmp (char const *s1, char const *s2, size_t n)
 _GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
                  "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 "
+                 "internationalization, or use c_strncasecmp "
+                 "(gnulib module c-strcase) if you want a locale "
                  "independent function");
 # endif
 #endif
index 815843859a1a0499b37edd7324c3b41ad0d4f98d..7a0115d05022205b8268437c3ce7056f225dcc93 100644 (file)
@@ -1,4 +1,4 @@
-/* strncasecmp.c -- case insensitive string comparator
+/* Case-insensitive string comparison function for unibyte locales.
    Copyright (C) 1998-1999, 2005-2007, 2009-2025 Free Software Foundation, Inc.
 
    This file is free software: you can redistribute it and/or modify
diff --git a/m4/strcase.m4 b/m4/strcase.m4
deleted file mode 100644 (file)
index ecb2c91..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# strcase.m4
-# serial 12
-dnl Copyright (C) 2002, 2005-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_STRCASE],
-[
-  gl_FUNC_STRCASECMP
-  gl_FUNC_STRNCASECMP
-])
-
-AC_DEFUN([gl_FUNC_STRCASECMP],
-[
-  AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
-  AC_CHECK_FUNCS([strcasecmp])
-  if test $ac_cv_func_strcasecmp = no; then
-    HAVE_STRCASECMP=0
-  fi
-])
-
-AC_DEFUN([gl_FUNC_STRNCASECMP],
-[
-  AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
-  AC_CHECK_FUNCS([strncasecmp])
-  if test $ac_cv_func_strncasecmp = yes; then
-    HAVE_STRNCASECMP=1
-  else
-    HAVE_STRNCASECMP=0
-  fi
-  AC_CHECK_DECLS([strncasecmp])
-  if test $ac_cv_have_decl_strncasecmp = no; then
-    HAVE_DECL_STRNCASECMP=0
-  fi
-])
-
-# Prerequisites of lib/strcasecmp.c.
-AC_DEFUN([gl_PREREQ_STRCASECMP], [
-  :
-])
-
-# Prerequisites of lib/strncasecmp.c.
-AC_DEFUN([gl_PREREQ_STRNCASECMP], [
-  :
-])
diff --git a/m4/strcasecmp.m4 b/m4/strcasecmp.m4
new file mode 100644 (file)
index 0000000..0bbcc5e
--- /dev/null
@@ -0,0 +1,21 @@
+# strcasecmp.m4
+# serial 1
+dnl Copyright (C) 2002-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_STRCASECMP],
+[
+  AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
+  AC_CHECK_FUNCS([strcasecmp])
+  if test $ac_cv_func_strcasecmp = no; then
+    HAVE_STRCASECMP=0
+  fi
+])
+
+# Prerequisites of lib/strcasecmp.c.
+AC_DEFUN([gl_PREREQ_STRCASECMP], [
+  :
+])
diff --git a/m4/strncasecmp.m4 b/m4/strncasecmp.m4
new file mode 100644 (file)
index 0000000..d27a4a0
--- /dev/null
@@ -0,0 +1,27 @@
+# strncasecmp.m4
+# serial 1
+dnl Copyright (C) 2002-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_STRNCASECMP],
+[
+  AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
+  AC_CHECK_FUNCS([strncasecmp])
+  if test $ac_cv_func_strncasecmp = yes; then
+    HAVE_STRNCASECMP=1
+  else
+    HAVE_STRNCASECMP=0
+  fi
+  AC_CHECK_DECLS([strncasecmp])
+  if test $ac_cv_have_decl_strncasecmp = no; then
+    HAVE_DECL_STRNCASECMP=0
+  fi
+])
+
+# Prerequisites of lib/strncasecmp.c.
+AC_DEFUN([gl_PREREQ_STRNCASECMP], [
+  :
+])
index 8b4e3e297b81cd0ff961780253d569a55e1e8cef..caff9430cb5b2d01cdaab99862a82da58ba8266b 100644 (file)
@@ -28,7 +28,7 @@ sysexits-h
 malloc-gnu
 mempcpy
 strndup
-strcase
+strcasecmp
 extensions
 vsnprintf
 sleep
index 4d90a042a5b6941217dc95fc215a4a587c265f9d..91bdd02d399c505ffa4bfa1a313974547c092b45 100644 (file)
@@ -1,32 +1,15 @@
 Description:
-Case-insensitive string comparison functions.
+Case-insensitive string comparison functions for unibyte locales.
 
 Files:
-lib/strcasecmp.c
-lib/strncasecmp.c
-m4/strcase.m4
 
 Depends-on:
-strings-h
+strcasecmp
+strncasecmp
 
 configure.ac:
-gl_STRCASE
-gl_CONDITIONAL([GL_COND_OBJ_STRCASECMP], [test $HAVE_STRCASECMP = 0])
-AM_COND_IF([GL_COND_OBJ_STRCASECMP], [
-  gl_PREREQ_STRCASECMP
-])
-gl_CONDITIONAL([GL_COND_OBJ_STRNCASECMP], [test $HAVE_STRNCASECMP = 0])
-AM_COND_IF([GL_COND_OBJ_STRNCASECMP], [
-  gl_PREREQ_STRNCASECMP
-])
 
 Makefile.am:
-if GL_COND_OBJ_STRCASECMP
-lib_SOURCES += strcasecmp.c
-endif
-if GL_COND_OBJ_STRNCASECMP
-lib_SOURCES += strncasecmp.c
-endif
 
 Include:
 <strings.h>
diff --git a/modules/strcasecmp b/modules/strcasecmp
new file mode 100644 (file)
index 0000000..b226990
--- /dev/null
@@ -0,0 +1,30 @@
+Description:
+Case-insensitive string comparison function for unibyte locales.
+
+Files:
+lib/strcasecmp.c
+m4/strcasecmp.m4
+
+Depends-on:
+strings-h
+
+configure.ac:
+gl_FUNC_STRCASECMP
+gl_CONDITIONAL([GL_COND_OBJ_STRCASECMP], [test $HAVE_STRCASECMP = 0])
+AM_COND_IF([GL_COND_OBJ_STRCASECMP], [
+  gl_PREREQ_STRCASECMP
+])
+
+Makefile.am:
+if GL_COND_OBJ_STRCASECMP
+lib_SOURCES += strcasecmp.c
+endif
+
+Include:
+<strings.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
index 050bd81903eb861c0f4782f82eda4dce172a0a07..f944425ff0b3bbf0b5ce26c5b28bbecf21b11fef 100644 (file)
@@ -9,7 +9,7 @@ m4/strcasestr.m4
 Depends-on:
 string-h
 bool
-strcase
+strncasecmp
 memchr
 memcmp
 extensions
diff --git a/modules/strncasecmp b/modules/strncasecmp
new file mode 100644 (file)
index 0000000..5fca265
--- /dev/null
@@ -0,0 +1,30 @@
+Description:
+Case-insensitive string comparison function for unibyte locales.
+
+Files:
+lib/strncasecmp.c
+m4/strncasecmp.m4
+
+Depends-on:
+strings-h
+
+configure.ac:
+gl_FUNC_STRNCASECMP
+gl_CONDITIONAL([GL_COND_OBJ_STRNCASECMP], [test $HAVE_STRNCASECMP = 0])
+AM_COND_IF([GL_COND_OBJ_STRNCASECMP], [
+  gl_PREREQ_STRNCASECMP
+])
+
+Makefile.am:
+if GL_COND_OBJ_STRNCASECMP
+lib_SOURCES += strncasecmp.c
+endif
+
+Include:
+<strings.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
index 9ebb97e2fe1417706b1862ca5ce4e0034000d0fb..67296f76c8d8d3273144324351d5772c7f498183 100644 (file)
@@ -11,7 +11,7 @@ time-h
 extensions
 sys_time-h      [test $HAVE_STRPTIME = 0]
 string-h        [test $HAVE_STRPTIME = 0]
-strcase         [test $HAVE_STRPTIME = 0]
+strncasecmp     [test $HAVE_STRPTIME = 0]
 bool            [test $HAVE_STRPTIME = 0]
 time_r          [test $HAVE_STRPTIME = 0]