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