1 /* A substitute <strings.h>.
3 Copyright (C) 2007-2011 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 #ifndef _@GUARD_PREFIX@_STRINGS_H
22 @PRAGMA_SYSTEM_HEADER@
26 /* Minix 3.1.8 has a bug: <sys/types.h> must be included before <strings.h>.
27 But avoid namespace pollution on glibc systems. */
28 #if defined __minix && !defined __GLIBC__
29 # include <sys/types.h>
32 /* The include_next requires a split double-inclusion guard. */
34 # @INCLUDE_NEXT@ @NEXT_STRINGS_H@
37 #ifndef _@GUARD_PREFIX@_STRINGS_H
38 #define _@GUARD_PREFIX@_STRINGS_H
40 #if ! @HAVE_DECL_STRNCASECMP@
46 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
48 /* The definition of _GL_ARG_NONNULL is copied here. */
50 /* The definition of _GL_WARN_ON_USE is copied here. */
57 /* Find the index of the least-significant set bit. */
60 _GL_FUNCDECL_SYS (ffs, int, (int i));
62 _GL_CXXALIAS_SYS (ffs, int, (int i));
63 _GL_CXXALIASWARN (ffs);
64 #elif defined GNULIB_POSIXCHECK
66 # if HAVE_RAW_DECL_FFS
67 _GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module");
71 /* Compare strings S1 and S2, ignoring case, returning less than, equal to or
72 greater than zero if S1 is lexicographically less than, equal to or greater
74 Note: This function does not work in multibyte locales. */
75 #if ! @HAVE_STRCASECMP@
76 extern int strcasecmp (char const *s1, char const *s2)
77 _GL_ARG_NONNULL ((1, 2));
79 #if defined GNULIB_POSIXCHECK
80 /* strcasecmp() does not work with multibyte strings:
81 POSIX says that it operates on "strings", and "string" in POSIX is defined
82 as a sequence of bytes, not of characters. */
84 # if HAVE_RAW_DECL_STRCASECMP
85 _GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character "
86 "strings in multibyte locales - "
87 "use mbscasecmp if you care about "
88 "internationalization, or use c_strcasecmp , "
89 "gnulib module c-strcase) if you want a locale "
90 "independent function");
94 /* Compare no more than N bytes of strings S1 and S2, ignoring case,
95 returning less than, equal to or greater than zero if S1 is
96 lexicographically less than, equal to or greater than S2.
97 Note: This function cannot work correctly in multibyte locales. */
98 #if ! @HAVE_DECL_STRNCASECMP@
99 extern int strncasecmp (char const *s1, char const *s2, size_t n)
100 _GL_ARG_NONNULL ((1, 2));
102 #if defined GNULIB_POSIXCHECK
103 /* strncasecmp() does not work with multibyte strings:
104 POSIX says that it operates on "strings", and "string" in POSIX is defined
105 as a sequence of bytes, not of characters. */
107 # if HAVE_RAW_DECL_STRNCASECMP
108 _GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
109 "strings in multibyte locales - "
110 "use mbsncasecmp or mbspcasecmp if you care about "
111 "internationalization, or use c_strncasecmp , "
112 "gnulib module c-strcase) if you want a locale "
113 "independent function");
122 #endif /* _@GUARD_PREFIX@_STRING_H */
123 #endif /* _@GUARD_PREFIX@_STRING_H */