annotate lib/strings.in.h @ 273:88bbffa404ea 2.5 2.5

Updated version for release
author lost
date Sun, 16 Aug 2009 17:18:11 +0000
parents d5392bb5da3c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
272
d5392bb5da3c Added generated files
lost
parents:
diff changeset
1 /* A substitute <strings.h>.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
2
d5392bb5da3c Added generated files
lost
parents:
diff changeset
3 Copyright (C) 2007-2008 Free Software Foundation, Inc.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
4
d5392bb5da3c Added generated files
lost
parents:
diff changeset
5 This program is free software; you can redistribute it and/or modify
d5392bb5da3c Added generated files
lost
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
d5392bb5da3c Added generated files
lost
parents:
diff changeset
7 the Free Software Foundation; either version 3, or (at your option)
d5392bb5da3c Added generated files
lost
parents:
diff changeset
8 any later version.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
9
d5392bb5da3c Added generated files
lost
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
d5392bb5da3c Added generated files
lost
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
d5392bb5da3c Added generated files
lost
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d5392bb5da3c Added generated files
lost
parents:
diff changeset
13 GNU General Public License for more details.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
14
d5392bb5da3c Added generated files
lost
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
d5392bb5da3c Added generated files
lost
parents:
diff changeset
16 along with this program; if not, write to the Free Software Foundation,
d5392bb5da3c Added generated files
lost
parents:
diff changeset
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
d5392bb5da3c Added generated files
lost
parents:
diff changeset
18
d5392bb5da3c Added generated files
lost
parents:
diff changeset
19 #ifndef _GL_STRINGS_H
d5392bb5da3c Added generated files
lost
parents:
diff changeset
20
d5392bb5da3c Added generated files
lost
parents:
diff changeset
21 #if __GNUC__ >= 3
d5392bb5da3c Added generated files
lost
parents:
diff changeset
22 @PRAGMA_SYSTEM_HEADER@
d5392bb5da3c Added generated files
lost
parents:
diff changeset
23 #endif
d5392bb5da3c Added generated files
lost
parents:
diff changeset
24
d5392bb5da3c Added generated files
lost
parents:
diff changeset
25 /* The include_next requires a split double-inclusion guard. */
d5392bb5da3c Added generated files
lost
parents:
diff changeset
26 #@INCLUDE_NEXT@ @NEXT_STRINGS_H@
d5392bb5da3c Added generated files
lost
parents:
diff changeset
27
d5392bb5da3c Added generated files
lost
parents:
diff changeset
28 #ifndef _GL_STRINGS_H
d5392bb5da3c Added generated files
lost
parents:
diff changeset
29 #define _GL_STRINGS_H
d5392bb5da3c Added generated files
lost
parents:
diff changeset
30
d5392bb5da3c Added generated files
lost
parents:
diff changeset
31
d5392bb5da3c Added generated files
lost
parents:
diff changeset
32 /* The definition of GL_LINK_WARNING is copied here. */
d5392bb5da3c Added generated files
lost
parents:
diff changeset
33
d5392bb5da3c Added generated files
lost
parents:
diff changeset
34
d5392bb5da3c Added generated files
lost
parents:
diff changeset
35 #ifdef __cplusplus
d5392bb5da3c Added generated files
lost
parents:
diff changeset
36 extern "C" {
d5392bb5da3c Added generated files
lost
parents:
diff changeset
37 #endif
d5392bb5da3c Added generated files
lost
parents:
diff changeset
38
d5392bb5da3c Added generated files
lost
parents:
diff changeset
39
d5392bb5da3c Added generated files
lost
parents:
diff changeset
40 /* Compare strings S1 and S2, ignoring case, returning less than, equal to or
d5392bb5da3c Added generated files
lost
parents:
diff changeset
41 greater than zero if S1 is lexicographically less than, equal to or greater
d5392bb5da3c Added generated files
lost
parents:
diff changeset
42 than S2.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
43 Note: This function does not work in multibyte locales. */
d5392bb5da3c Added generated files
lost
parents:
diff changeset
44 #if ! @HAVE_STRCASECMP@
d5392bb5da3c Added generated files
lost
parents:
diff changeset
45 extern int strcasecmp (char const *s1, char const *s2);
d5392bb5da3c Added generated files
lost
parents:
diff changeset
46 #endif
d5392bb5da3c Added generated files
lost
parents:
diff changeset
47 #if defined GNULIB_POSIXCHECK
d5392bb5da3c Added generated files
lost
parents:
diff changeset
48 /* strcasecmp() does not work with multibyte strings:
d5392bb5da3c Added generated files
lost
parents:
diff changeset
49 POSIX says that it operates on "strings", and "string" in POSIX is defined
d5392bb5da3c Added generated files
lost
parents:
diff changeset
50 as a sequence of bytes, not of characters. */
d5392bb5da3c Added generated files
lost
parents:
diff changeset
51 # undef strcasecmp
d5392bb5da3c Added generated files
lost
parents:
diff changeset
52 # define strcasecmp(a,b) \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
53 (GL_LINK_WARNING ("strcasecmp cannot work correctly on character strings " \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
54 "in multibyte locales - " \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
55 "use mbscasecmp if you care about " \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
56 "internationalization, or use c_strcasecmp (from " \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
57 "gnulib module c-strcase) if you want a locale " \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
58 "independent function"), \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
59 strcasecmp (a, b))
d5392bb5da3c Added generated files
lost
parents:
diff changeset
60 #endif
d5392bb5da3c Added generated files
lost
parents:
diff changeset
61
d5392bb5da3c Added generated files
lost
parents:
diff changeset
62 /* Compare no more than N bytes of strings S1 and S2, ignoring case,
d5392bb5da3c Added generated files
lost
parents:
diff changeset
63 returning less than, equal to or greater than zero if S1 is
d5392bb5da3c Added generated files
lost
parents:
diff changeset
64 lexicographically less than, equal to or greater than S2.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
65 Note: This function cannot work correctly in multibyte locales. */
d5392bb5da3c Added generated files
lost
parents:
diff changeset
66 #if ! @HAVE_DECL_STRNCASECMP@
d5392bb5da3c Added generated files
lost
parents:
diff changeset
67 extern int strncasecmp (char const *s1, char const *s2, size_t n);
d5392bb5da3c Added generated files
lost
parents:
diff changeset
68 #endif
d5392bb5da3c Added generated files
lost
parents:
diff changeset
69 #if defined GNULIB_POSIXCHECK
d5392bb5da3c Added generated files
lost
parents:
diff changeset
70 /* strncasecmp() does not work with multibyte strings:
d5392bb5da3c Added generated files
lost
parents:
diff changeset
71 POSIX says that it operates on "strings", and "string" in POSIX is defined
d5392bb5da3c Added generated files
lost
parents:
diff changeset
72 as a sequence of bytes, not of characters. */
d5392bb5da3c Added generated files
lost
parents:
diff changeset
73 # undef strncasecmp
d5392bb5da3c Added generated files
lost
parents:
diff changeset
74 # define strncasecmp(a,b,n) \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
75 (GL_LINK_WARNING ("strncasecmp cannot work correctly on character " \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
76 "strings in multibyte locales - " \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
77 "use mbsncasecmp or mbspcasecmp if you care about " \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
78 "internationalization, or use c_strncasecmp (from " \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
79 "gnulib module c-strcase) if you want a locale " \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
80 "independent function"), \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
81 strncasecmp (a, b, n))
d5392bb5da3c Added generated files
lost
parents:
diff changeset
82 #endif
d5392bb5da3c Added generated files
lost
parents:
diff changeset
83
d5392bb5da3c Added generated files
lost
parents:
diff changeset
84
d5392bb5da3c Added generated files
lost
parents:
diff changeset
85 #ifdef __cplusplus
d5392bb5da3c Added generated files
lost
parents:
diff changeset
86 }
d5392bb5da3c Added generated files
lost
parents:
diff changeset
87 #endif
d5392bb5da3c Added generated files
lost
parents:
diff changeset
88
d5392bb5da3c Added generated files
lost
parents:
diff changeset
89 #endif /* _GL_STRING_H */
d5392bb5da3c Added generated files
lost
parents:
diff changeset
90 #endif /* _GL_STRING_H */