merge from guile master
[bpt/guile.git] / lib / strings.in.h
1 /* A substitute <strings.h>.
2
3 Copyright (C) 2007 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 Lesser 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 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser 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 _GL_STRINGS_H
20
21 /* The include_next requires a split double-inclusion guard. */
22 #@INCLUDE_NEXT@ @NEXT_STRINGS_H@
23
24 #ifndef _GL_STRINGS_H
25 #define _GL_STRINGS_H
26
27
28 /* The definition of GL_LINK_WARNING is copied here. */
29
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35
36 /* Compare strings S1 and S2, ignoring case, returning less than, equal to or
37 greater than zero if S1 is lexicographically less than, equal to or greater
38 than S2.
39 Note: This function does not work in multibyte locales. */
40 #if ! @HAVE_STRCASECMP@
41 extern int strcasecmp (char const *s1, char const *s2);
42 #endif
43 #if defined GNULIB_POSIXCHECK
44 /* strcasecmp() does not work with multibyte strings:
45 POSIX says that it operates on "strings", and "string" in POSIX is defined
46 as a sequence of bytes, not of characters. */
47 # undef strcasecmp
48 # define strcasecmp(a,b) \
49 (GL_LINK_WARNING ("strcasecmp cannot work correctly on character strings " \
50 "in multibyte locales - " \
51 "use mbscasecmp if you care about " \
52 "internationalization, or use c_strcasecmp (from " \
53 "gnulib module c-strcase) if you want a locale " \
54 "independent function"), \
55 strcasecmp (a, b))
56 #endif
57
58 /* Compare no more than N bytes of strings S1 and S2, ignoring case,
59 returning less than, equal to or greater than zero if S1 is
60 lexicographically less than, equal to or greater than S2.
61 Note: This function cannot work correctly in multibyte locales. */
62 #if ! @HAVE_DECL_STRNCASECMP@
63 extern int strncasecmp (char const *s1, char const *s2, size_t n);
64 #endif
65 #if defined GNULIB_POSIXCHECK
66 /* strncasecmp() does not work with multibyte strings:
67 POSIX says that it operates on "strings", and "string" in POSIX is defined
68 as a sequence of bytes, not of characters. */
69 # undef strncasecmp
70 # define strncasecmp(a,b,n) \
71 (GL_LINK_WARNING ("strncasecmp cannot work correctly on character " \
72 "strings in multibyte locales - " \
73 "use mbsncasecmp or mbspcasecmp if you care about " \
74 "internationalization, or use c_strncasecmp (from " \
75 "gnulib module c-strcase) if you want a locale " \
76 "independent function"), \
77 strncasecmp (a, b, n))
78 #endif
79
80
81 #ifdef __cplusplus
82 }
83 #endif
84
85 #endif /* _GL_STRING_H */
86 #endif /* _GL_STRING_H */