getcwd-lgpl: fix m4 to match relaxed test for BSD
[gnulib.git] / lib / strings.in.h
1 /* A substitute <strings.h>.
2
3    Copyright (C) 2007-2011 Free Software Foundation, Inc.
4
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)
8    any later version.
9
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.
14
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.  */
18
19 #ifndef _@GUARD_PREFIX@_STRINGS_H
20
21 #if __GNUC__ >= 3
22 @PRAGMA_SYSTEM_HEADER@
23 #endif
24 @PRAGMA_COLUMNS@
25
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>
30 #endif
31
32 /* The include_next requires a split double-inclusion guard.  */
33 #@INCLUDE_NEXT@ @NEXT_STRINGS_H@
34
35 #ifndef _@GUARD_PREFIX@_STRINGS_H
36 #define _@GUARD_PREFIX@_STRINGS_H
37
38
39 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
40
41 /* The definition of _GL_ARG_NONNULL is copied here.  */
42
43 /* The definition of _GL_WARN_ON_USE is copied here.  */
44
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48
49
50   /* Find the index of the least-significant set bit.  */
51 #if @GNULIB_FFS@
52 # if !@HAVE_FFS@
53 _GL_FUNCDECL_SYS (ffs, int, (int i));
54 # endif
55 _GL_CXXALIAS_SYS (ffs, int, (int i));
56 _GL_CXXALIASWARN (ffs);
57 #elif defined GNULIB_POSIXCHECK
58 # undef ffs
59 # if HAVE_RAW_DECL_FFS
60 _GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module");
61 # endif
62 #endif
63
64 /* Compare strings S1 and S2, ignoring case, returning less than, equal to or
65    greater than zero if S1 is lexicographically less than, equal to or greater
66    than S2.
67    Note: This function does not work in multibyte locales.  */
68 #if ! @HAVE_STRCASECMP@
69 extern int strcasecmp (char const *s1, char const *s2)
70      _GL_ARG_NONNULL ((1, 2));
71 #endif
72 #if defined GNULIB_POSIXCHECK
73 /* strcasecmp() does not work with multibyte strings:
74    POSIX says that it operates on "strings", and "string" in POSIX is defined
75    as a sequence of bytes, not of characters.   */
76 # undef strcasecmp
77 # if HAVE_RAW_DECL_STRCASECMP
78 _GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character "
79                  "strings in multibyte locales - "
80                  "use mbscasecmp if you care about "
81                  "internationalization, or use c_strcasecmp , "
82                  "gnulib module c-strcase) if you want a locale "
83                  "independent function");
84 # endif
85 #endif
86
87 /* Compare no more than N bytes of strings S1 and S2, ignoring case,
88    returning less than, equal to or greater than zero if S1 is
89    lexicographically less than, equal to or greater than S2.
90    Note: This function cannot work correctly in multibyte locales.  */
91 #if ! @HAVE_DECL_STRNCASECMP@
92 extern int strncasecmp (char const *s1, char const *s2, size_t n)
93      _GL_ARG_NONNULL ((1, 2));
94 #endif
95 #if defined GNULIB_POSIXCHECK
96 /* strncasecmp() does not work with multibyte strings:
97    POSIX says that it operates on "strings", and "string" in POSIX is defined
98    as a sequence of bytes, not of characters.  */
99 # undef strncasecmp
100 # if HAVE_RAW_DECL_STRNCASECMP
101 _GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
102                  "strings in multibyte locales - "
103                  "use mbsncasecmp or mbspcasecmp if you care about "
104                  "internationalization, or use c_strncasecmp , "
105                  "gnulib module c-strcase) if you want a locale "
106                  "independent function");
107 # endif
108 #endif
109
110
111 #ifdef __cplusplus
112 }
113 #endif
114
115 #endif /* _@GUARD_PREFIX@_STRING_H */
116 #endif /* _@GUARD_PREFIX@_STRING_H */