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