along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+#if defined __DECC && __DECC_VER >= 60000000
+# include_next <string.h>
+#endif
+
#ifndef _GL_STRING_H
#define _GL_STRING_H
-#include @ABSOLUTE_STRING_H@
-
-
-/* GL_LINK_WARNING("literal string") arranges to emit the literal string as
- a linker warning on most glibc systems.
- We use a linker warning rather than a preprocessor warning, because
- #warning cannot be used inside macros. */
-#ifndef GL_LINK_WARNING
- /* This works on platforms with GNU ld and ELF object format.
- Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
- Testing __ELF__ guarantees the ELF object format.
- Testing __GNUC__ is necessary for the compound expression syntax. */
-# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
-# define GL_LINK_WARNING(message) \
- GL_LINK_WARNING1 (__FILE__, __LINE__, message)
-# define GL_LINK_WARNING1(file, line, message) \
- GL_LINK_WARNING2 (file, line, message) /* macroexpand file and line */
-# define GL_LINK_WARNING2(file, line, message) \
- GL_LINK_WARNING3 (file ":" #line ": warning: " message)
-# define GL_LINK_WARNING3(message) \
- ({ static const char warning[sizeof (message)] \
- __attribute__ ((__unused__, \
- __section__ (".gnu.warning"), \
- __aligned__ (1))) \
- = message "\n"; \
- (void)0; \
- })
-# else
-# define GL_LINK_WARNING(message) ((void) 0)
-# endif
+/* This #pragma avoids a warning with "gcc -Wmissing-prototypes" on some
+ mingw systems. */
+#ifdef __GNUC__
+# pragma GCC system_header
#endif
+#if !(defined __DECC && __DECC_VER >= 60000000)
+# include @ABSOLUTE_STRING_H@
+#endif
+
+
+/* The definition of GL_LINK_WARNING is copied here. */
+
#ifdef __cplusplus
extern "C" {
#elif defined GNULIB_POSIXCHECK
# undef memmem
# define memmem(a,al,b,bl) \
- (GL_LINK_WARNING ("memmem is unportable - use gnulib module memmem for portability"), \
+ (GL_LINK_WARNING ("memmem is unportable - " \
+ "use gnulib module memmem for portability"), \
memmem (a, al, b, bl))
#endif
#elif defined GNULIB_POSIXCHECK
# undef mempcpy
# define mempcpy(a,b,n) \
- (GL_LINK_WARNING ("mempcpy is unportable - use gnulib module mempcpy for portability"), \
+ (GL_LINK_WARNING ("mempcpy is unportable - " \
+ "use gnulib module mempcpy for portability"), \
mempcpy (a, b, n))
#endif
#elif defined GNULIB_POSIXCHECK
# undef memrchr
# define memrchr(a,b,c) \
- (GL_LINK_WARNING ("memrchr is unportable - use gnulib module memrchr for portability"), \
+ (GL_LINK_WARNING ("memrchr is unportable - " \
+ "use gnulib module memrchr for portability"), \
memrchr (a, b, c))
#endif
#elif defined GNULIB_POSIXCHECK
# undef stpcpy
# define stpcpy(a,b) \
- (GL_LINK_WARNING ("stpcpy is unportable - use gnulib module stpcpy for portability"), \
+ (GL_LINK_WARNING ("stpcpy is unportable - " \
+ "use gnulib module stpcpy for portability"), \
stpcpy (a, b))
#endif
#elif defined GNULIB_POSIXCHECK
# undef stpncpy
# define stpncpy(a,b,n) \
- (GL_LINK_WARNING ("stpncpy is unportable - use gnulib module stpncpy for portability"), \
+ (GL_LINK_WARNING ("stpncpy is unportable - " \
+ "use gnulib module stpncpy for portability"), \
stpncpy (a, b, n))
#endif
as a sequence of bytes, not of characters. */
# undef strcasecmp
# define strcasecmp(a,b) \
- (GL_LINK_WARNING ("strcasecmp cannot work correctly on character strings in multibyte locales - use mbscasecmp if you care about internationalization, or use c_strcasecmp (from gnulib module c-strcase) if you want a locale independent function"), \
+ (GL_LINK_WARNING ("strcasecmp cannot work correctly on character strings " \
+ "in multibyte locales - " \
+ "use mbscasecmp if you care about " \
+ "internationalization, or use c_strcasecmp (from " \
+ "gnulib module c-strcase) if you want a locale " \
+ "independent function"), \
strcasecmp (a, b))
#endif
as a sequence of bytes, not of characters. */
# undef strncasecmp
# define strncasecmp(a,b,n) \
- (GL_LINK_WARNING ("strncasecmp cannot work correctly on character strings in multibyte locales - don't use it if you care about internationalization; use c_strncasecmp (from gnulib module c-strcase) if you want a locale independent function"), \
+ (GL_LINK_WARNING ("strncasecmp cannot work correctly on character " \
+ "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 " \
+ "independent function"), \
strncasecmp (a, b, n))
#endif
GB18030 and the character to be searched is a digit. */
# undef strchr
# define strchr(s,c) \
- (GL_LINK_WARNING ("strchr cannot work correctly on character strings in some multibyte locales - use mbschr if you care about internationalization"), \
+ (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
+ "in some multibyte locales - " \
+ "use mbschr if you care about internationalization"), \
strchr (s, c))
#endif
#elif defined GNULIB_POSIXCHECK
# undef strchrnul
# define strchrnul(a,b) \
- (GL_LINK_WARNING ("strchrnul is unportable - use gnulib module strchrnul for portability"), \
+ (GL_LINK_WARNING ("strchrnul is unportable - " \
+ "use gnulib module strchrnul for portability"), \
strchrnul (a, b))
#endif
#elif defined GNULIB_POSIXCHECK
# undef strdup
# define strdup(a) \
- (GL_LINK_WARNING ("strdup is unportable - use gnulib module strdup for portability"), \
+ (GL_LINK_WARNING ("strdup is unportable - " \
+ "use gnulib module strdup for portability"), \
strdup (a))
#endif
# 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 - use gnulib module strndup for portability"), \
+ (GL_LINK_WARNING ("strndup is unportable - " \
+ "use gnulib module strndup for portability"), \
strndup (a, n))
#endif
#elif defined GNULIB_POSIXCHECK
# undef strnlen
# define strnlen(a,n) \
- (GL_LINK_WARNING ("strnlen is unportable - use gnulib module strnlen for portability"), \
+ (GL_LINK_WARNING ("strnlen is unportable - " \
+ "use gnulib module strnlen for portability"), \
strnlen (a, n))
#endif
digit. */
# undef strcspn
# define strcspn(s,a) \
- (GL_LINK_WARNING ("strcspn cannot work correctly on character strings in multibyte locales - use mbscspn if you care about internationalization"), \
+ (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
+ "in multibyte locales - " \
+ "use mbscspn if you care about internationalization"), \
strcspn (s, a))
#endif
digit. */
# undef strpbrk
# define strpbrk(s,a) \
- (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings in multibyte locales - use mbspbrk if you care about internationalization"), \
+ (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
+ "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 - use gnulib module strpbrk for portability"), \
+ (GL_LINK_WARNING ("strpbrk is unportable - " \
+ "use gnulib module strpbrk for portability"), \
strpbrk (s, a))
#endif
Even in this simple case, it cannot work with multibyte strings. */
# undef strspn
# define strspn(s,a) \
- (GL_LINK_WARNING ("strspn cannot work correctly on character strings in multibyte locales - use mbsspn if you care about internationalization"), \
+ (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
+ "in multibyte locales - " \
+ "use mbsspn if you care about internationalization"), \
strspn (s, a))
#endif
GB18030 and the character to be searched is a digit. */
# undef strrchr
# define strrchr(s,c) \
- (GL_LINK_WARNING ("strrchr cannot work correctly on character strings in some multibyte locales - use mbsrchr if you care about internationalization"), \
+ (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
+ "in some multibyte locales - " \
+ "use mbsrchr if you care about internationalization"), \
strrchr (s, c))
#endif
# if defined GNULIB_POSIXCHECK
# undef strsep
# define strsep(s,d) \
- (GL_LINK_WARNING ("strsep cannot work correctly on character strings in multibyte locales - use mbssep if you care about internationalization"), \
+ (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
+ "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 - use gnulib module strsep for portability"), \
+ (GL_LINK_WARNING ("strsep is unportable - " \
+ "use gnulib module strsep for portability"), \
strsep (s, d))
#endif
as a sequence of bytes, not of characters. */
# undef strstr
# define strstr(a,b) \
- (GL_LINK_WARNING ("strstr cannot work correctly on character strings in most multibyte locales - use mbsstr if you care about internationalization"), \
+ (GL_LINK_WARNING ("strstr cannot work correctly on character strings " \
+ "in most multibyte locales - " \
+ "use mbsstr if you care about internationalization"), \
strstr (a, b))
#endif
locales. */
# undef strcasestr
# define strcasestr(a,b) \
- (GL_LINK_WARNING ("strcasestr does work correctly on character strings in multibyte locales - use mbscasestr if you care about internationalization, or use c-strcasestr if you want a locale independent function"), \
+ (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
+ "in multibyte locales - " \
+ "use mbscasestr if you care about " \
+ "internationalization, or use c-strcasestr if you want " \
+ "a locale independent function"), \
strcasestr (a, b))
#endif
# if defined GNULIB_POSIXCHECK
# undef strtok_r
# define strtok_r(s,d,p) \
- (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings in multibyte locales - use mbstok_r if you care about internationalization"), \
+ (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
+ "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 - use gnulib module strtok_r for portability"), \
+ (GL_LINK_WARNING ("strtok_r is unportable - " \
+ "use gnulib module strtok_r for portability"), \
strtok_r (s, d, p))
#endif
extern int mbsncasecmp (const char *s1, const char *s2, size_t n);
#endif
+#if @GNULIB_MBSPCASECMP@
+/* Compare the initial segment of the character string STRING consisting of
+ at most mbslen (PREFIX) characters with the character string PREFIX,
+ ignoring case, returning less than, equal to or greater than zero if this
+ initial segment is lexicographically less than, equal to or greater than
+ PREFIX.
+ Note: This function may, in multibyte locales, return 0 if STRING is of
+ smaller length than PREFIX!
+ Unlike strncasecmp(), this function works correctly in multibyte
+ locales. */
+extern char * mbspcasecmp (const char *string, const char *prefix);
+#endif
+
#if @GNULIB_MBSCASESTR@
/* Find the first occurrence of the character string NEEDLE in the character
string HAYSTACK, using case-insensitive comparison.