* m4/include_next.m4 (gl_INCLUDE_NEXT): Define and AC_SUBST
[pspp] / lib / string_.h
index 14e781730bc84434c1d06eb804b796d5065c561c..bfb22b0ebc40948d16d92c036ba05cadce39f204 100644 (file)
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #ifndef _GL_STRING_H
-#define _GL_STRING_H
 
-#include @ABSOLUTE_STRING_H@
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_STRING_H@
+
+#ifndef _GL_STRING_H
+#define _GL_STRING_H
 
 
 /* The definition of GL_LINK_WARNING is copied here.  */
@@ -38,7 +41,7 @@ extern void *memmem (void const *__haystack, size_t __haystack_len,
 #elif defined GNULIB_POSIXCHECK
 # undef memmem
 # define memmem(a,al,b,bl) \
-    (GL_LINK_WARNING ("memmem is unportable - "\
+    (GL_LINK_WARNING ("memmem is unportable - " \
                       "use gnulib module memmem for portability"), \
      memmem (a, al, b, bl))
 #endif
@@ -53,7 +56,7 @@ extern void *mempcpy (void *restrict __dest, void const *restrict __src,
 #elif defined GNULIB_POSIXCHECK
 # undef mempcpy
 # define mempcpy(a,b,n) \
-    (GL_LINK_WARNING ("mempcpy is unportable - "\
+    (GL_LINK_WARNING ("mempcpy is unportable - " \
                       "use gnulib module mempcpy for portability"), \
      mempcpy (a, b, n))
 #endif
@@ -66,7 +69,7 @@ extern void *memrchr (void const *, int, size_t);
 #elif defined GNULIB_POSIXCHECK
 # undef memrchr
 # define memrchr(a,b,c) \
-    (GL_LINK_WARNING ("memrchr is unportable - "\
+    (GL_LINK_WARNING ("memrchr is unportable - " \
                       "use gnulib module memrchr for portability"), \
      memrchr (a, b, c))
 #endif
@@ -79,7 +82,7 @@ extern char *stpcpy (char *restrict __dst, char const *restrict __src);
 #elif defined GNULIB_POSIXCHECK
 # undef stpcpy
 # define stpcpy(a,b) \
-    (GL_LINK_WARNING ("stpcpy is unportable - "\
+    (GL_LINK_WARNING ("stpcpy is unportable - " \
                       "use gnulib module stpcpy for portability"), \
      stpcpy (a, b))
 #endif
@@ -95,7 +98,7 @@ extern char *stpncpy (char *restrict __dst, char const *restrict __src,
 #elif defined GNULIB_POSIXCHECK
 # undef stpncpy
 # define stpncpy(a,b,n) \
-    (GL_LINK_WARNING ("stpncpy is unportable - "\
+    (GL_LINK_WARNING ("stpncpy is unportable - " \
                       "use gnulib module stpncpy for portability"), \
      stpncpy (a, b, n))
 #endif
@@ -114,7 +117,7 @@ extern int strcasecmp (char const *s1, char const *s2);
 # undef strcasecmp
 # define strcasecmp(a,b) \
     (GL_LINK_WARNING ("strcasecmp cannot work correctly on character strings " \
-                      "in multibyte locales - "\
+                      "in multibyte locales - " \
                       "use mbscasecmp if you care about " \
                       "internationalization, or use c_strcasecmp (from " \
                       "gnulib module c-strcase) if you want a locale " \
@@ -136,7 +139,7 @@ extern int strncasecmp (char const *s1, char const *s2, size_t n);
 # undef strncasecmp
 # define strncasecmp(a,b,n) \
     (GL_LINK_WARNING ("strncasecmp cannot work correctly on character " \
-                      "strings in multibyte locales - "\
+                      "strings in multibyte locales - " \
                       "use mbsncasecmp or mbspcasecmp if you care about " \
                       "internationalization, or use c_strncasecmp (from " \
                       "gnulib module c-strcase) if you want a locale " \
@@ -150,7 +153,7 @@ extern int strncasecmp (char const *s1, char const *s2, size_t n);
 # undef strchr
 # define strchr(s,c) \
     (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
-                      "in some multibyte locales - "\
+                      "in some multibyte locales - " \
                       "use mbschr if you care about internationalization"), \
      strchr (s, c))
 #endif
@@ -163,7 +166,7 @@ extern char *strchrnul (char const *__s, int __c_in);
 #elif defined GNULIB_POSIXCHECK
 # undef strchrnul
 # define strchrnul(a,b) \
-    (GL_LINK_WARNING ("strchrnul is unportable - "\
+    (GL_LINK_WARNING ("strchrnul is unportable - " \
                       "use gnulib module strchrnul for portability"), \
      strchrnul (a, b))
 #endif
@@ -176,7 +179,7 @@ extern char *strdup (char const *__s);
 #elif defined GNULIB_POSIXCHECK
 # undef strdup
 # define strdup(a) \
-    (GL_LINK_WARNING ("strdup is unportable - "\
+    (GL_LINK_WARNING ("strdup is unportable - " \
                       "use gnulib module strdup for portability"), \
      strdup (a))
 #endif
@@ -186,14 +189,14 @@ extern char *strdup (char const *__s);
 # if ! @HAVE_STRNDUP@
 #  undef strndup
 #  define strndup rpl_strndup
-#  if ! @HAVE_DECL_STRNDUP@
+# endif
+# if ! @HAVE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@
 extern char *strndup (char const *__string, size_t __n);
-#  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strndup
 # define strndup(a,n) \
-    (GL_LINK_WARNING ("strndup is unportable - "\
+    (GL_LINK_WARNING ("strndup is unportable - " \
                       "use gnulib module strndup for portability"), \
      strndup (a, n))
 #endif
@@ -208,7 +211,7 @@ extern size_t strnlen (char const *__string, size_t __maxlen);
 #elif defined GNULIB_POSIXCHECK
 # undef strnlen
 # define strnlen(a,n) \
-    (GL_LINK_WARNING ("strnlen is unportable - "\
+    (GL_LINK_WARNING ("strnlen is unportable - " \
                       "use gnulib module strnlen for portability"), \
      strnlen (a, n))
 #endif
@@ -221,7 +224,7 @@ extern size_t strnlen (char const *__string, size_t __maxlen);
 # undef strcspn
 # define strcspn(s,a) \
     (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
-                      "in multibyte locales - "\
+                      "in multibyte locales - " \
                       "use mbscspn if you care about internationalization"), \
      strcspn (s, a))
 #endif
@@ -239,14 +242,14 @@ extern char *strpbrk (char const *__s, char const *__accept);
 #  undef strpbrk
 #  define strpbrk(s,a) \
      (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
-                       "in multibyte locales - "\
+                       "in multibyte locales - " \
                        "use mbspbrk if you care about internationalization"), \
       strpbrk (s, a))
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strpbrk
 # define strpbrk(s,a) \
-    (GL_LINK_WARNING ("strpbrk is unportable - "\
+    (GL_LINK_WARNING ("strpbrk is unportable - " \
                       "use gnulib module strpbrk for portability"), \
      strpbrk (s, a))
 #endif
@@ -257,7 +260,7 @@ extern char *strpbrk (char const *__s, char const *__accept);
 # undef strspn
 # define strspn(s,a) \
     (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
-                      "in multibyte locales - "\
+                      "in multibyte locales - " \
                       "use mbsspn if you care about internationalization"), \
      strspn (s, a))
 #endif
@@ -268,7 +271,7 @@ extern char *strpbrk (char const *__s, char const *__accept);
 # undef strrchr
 # define strrchr(s,c) \
     (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
-                      "in some multibyte locales - "\
+                      "in some multibyte locales - " \
                       "use mbsrchr if you care about internationalization"), \
      strrchr (s, c))
 #endif
@@ -297,14 +300,14 @@ extern char *strsep (char **restrict __stringp, char const *restrict __delim);
 #  undef strsep
 #  define strsep(s,d) \
      (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
-                       "in multibyte locales - "\
+                       "in multibyte locales - " \
                        "use mbssep if you care about internationalization"), \
       strsep (s, d))
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strsep
 # define strsep(s,d) \
-    (GL_LINK_WARNING ("strsep is unportable - "\
+    (GL_LINK_WARNING ("strsep is unportable - " \
                       "use gnulib module strsep for portability"), \
      strsep (s, d))
 #endif
@@ -317,7 +320,7 @@ extern char *strsep (char **restrict __stringp, char const *restrict __delim);
 # undef strstr
 # define strstr(a,b) \
     (GL_LINK_WARNING ("strstr cannot work correctly on character strings " \
-                      "in most multibyte locales - "\
+                      "in most multibyte locales - " \
                       "use mbsstr if you care about internationalization"), \
      strstr (a, b))
 #endif
@@ -334,7 +337,7 @@ extern char *strcasestr (const char *haystack, const char *needle);
 # undef strcasestr
 # define strcasestr(a,b) \
     (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
-                      "in multibyte locales - "\
+                      "in multibyte locales - " \
                       "use mbscasestr if you care about " \
                       "internationalization, or use c-strcasestr if you want " \
                       "a locale independent function"), \
@@ -372,14 +375,14 @@ extern char *strtok_r (char *restrict s, char const *restrict delim,
 #  undef strtok_r
 #  define strtok_r(s,d,p) \
      (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
-                       "in multibyte locales - "\
+                       "in multibyte locales - " \
                        "use mbstok_r if you care about internationalization"), \
       strtok_r (s, d, p))
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtok_r
 # define strtok_r(s,d,p) \
-    (GL_LINK_WARNING ("strtok_r is unportable - "\
+    (GL_LINK_WARNING ("strtok_r is unportable - " \
                       "use gnulib module strtok_r for portability"), \
      strtok_r (s, d, p))
 #endif
@@ -394,6 +397,12 @@ extern char *strtok_r (char *restrict s, char const *restrict delim,
 extern size_t mbslen (const char *string);
 #endif
 
+#if @GNULIB_MBSNLEN@
+/* Return the number of multibyte characters in the character string starting
+   at STRING and ending at STRING + LEN.  */
+extern size_t mbsnlen (const char *string, size_t len);
+#endif
+
 #if @GNULIB_MBSCHR@
 /* Locate the first single-byte character C in the character string STRING,
    and return a pointer to it.  Return NULL if C is not found in STRING.
@@ -535,4 +544,5 @@ extern char * mbstok_r (char *string, const char *delim, char **save_ptr);
 }
 #endif
 
-#endif
+#endif /* _GL_STRING_H */
+#endif /* _GL_STRING_H */