Blame lib/strings.in.h

Packit 33f14e
/* A substitute <strings.h>.
Packit 33f14e
Packit 33f14e
   Copyright (C) 2007-2017 Free Software Foundation, Inc.
Packit 33f14e
Packit 33f14e
   This program is free software; you can redistribute it and/or modify
Packit 33f14e
   it under the terms of the GNU General Public License as published by
Packit 33f14e
   the Free Software Foundation; either version 3, or (at your option)
Packit 33f14e
   any later version.
Packit 33f14e
Packit 33f14e
   This program is distributed in the hope that it will be useful,
Packit 33f14e
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 33f14e
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 33f14e
   GNU General Public License for more details.
Packit 33f14e
Packit 33f14e
   You should have received a copy of the GNU General Public License
Packit 33f14e
   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
Packit 33f14e
Packit 33f14e
#ifndef _@GUARD_PREFIX@_STRINGS_H
Packit 33f14e
Packit 33f14e
#if __GNUC__ >= 3
Packit 33f14e
@PRAGMA_SYSTEM_HEADER@
Packit 33f14e
#endif
Packit 33f14e
@PRAGMA_COLUMNS@
Packit 33f14e
Packit 33f14e
/* Minix 3.1.8 has a bug: <sys/types.h> must be included before <strings.h>.
Packit 33f14e
   But avoid namespace pollution on glibc systems.  */
Packit 33f14e
#if defined __minix && !defined __GLIBC__
Packit 33f14e
# include <sys/types.h>
Packit 33f14e
#endif
Packit 33f14e
Packit 33f14e
/* The include_next requires a split double-inclusion guard.  */
Packit 33f14e
#if @HAVE_STRINGS_H@
Packit 33f14e
# @INCLUDE_NEXT@ @NEXT_STRINGS_H@
Packit 33f14e
#endif
Packit 33f14e
Packit 33f14e
#ifndef _@GUARD_PREFIX@_STRINGS_H
Packit 33f14e
#define _@GUARD_PREFIX@_STRINGS_H
Packit 33f14e
Packit 33f14e
#if ! @HAVE_DECL_STRNCASECMP@
Packit 33f14e
/* Get size_t.  */
Packit 33f14e
# include <stddef.h>
Packit 33f14e
#endif
Packit 33f14e
Packit 33f14e
Packit 33f14e
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
Packit 33f14e
Packit 33f14e
/* The definition of _GL_ARG_NONNULL is copied here.  */
Packit 33f14e
Packit 33f14e
/* The definition of _GL_WARN_ON_USE is copied here.  */
Packit 33f14e
Packit 33f14e
#ifdef __cplusplus
Packit 33f14e
extern "C" {
Packit 33f14e
#endif
Packit 33f14e
Packit 33f14e
Packit 33f14e
  /* Find the index of the least-significant set bit.  */
Packit 33f14e
#if @GNULIB_FFS@
Packit 33f14e
# if !@HAVE_FFS@
Packit 33f14e
_GL_FUNCDECL_SYS (ffs, int, (int i));
Packit 33f14e
# endif
Packit 33f14e
_GL_CXXALIAS_SYS (ffs, int, (int i));
Packit 33f14e
_GL_CXXALIASWARN (ffs);
Packit 33f14e
#elif defined GNULIB_POSIXCHECK
Packit 33f14e
# undef ffs
Packit 33f14e
# if HAVE_RAW_DECL_FFS
Packit 33f14e
_GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module");
Packit 33f14e
# endif
Packit 33f14e
#endif
Packit 33f14e
Packit 33f14e
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
Packit 33f14e
   greater than zero if S1 is lexicographically less than, equal to or greater
Packit 33f14e
   than S2.
Packit 33f14e
   Note: This function does not work in multibyte locales.  */
Packit 33f14e
#if ! @HAVE_STRCASECMP@
Packit 33f14e
extern int strcasecmp (char const *s1, char const *s2)
Packit 33f14e
     _GL_ARG_NONNULL ((1, 2));
Packit 33f14e
#endif
Packit 33f14e
#if defined GNULIB_POSIXCHECK
Packit 33f14e
/* strcasecmp() does not work with multibyte strings:
Packit 33f14e
   POSIX says that it operates on "strings", and "string" in POSIX is defined
Packit 33f14e
   as a sequence of bytes, not of characters.   */
Packit 33f14e
# undef strcasecmp
Packit 33f14e
# if HAVE_RAW_DECL_STRCASECMP
Packit 33f14e
_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character "
Packit 33f14e
                 "strings in multibyte locales - "
Packit 33f14e
                 "use mbscasecmp if you care about "
Packit 33f14e
                 "internationalization, or use c_strcasecmp , "
Packit 33f14e
                 "gnulib module c-strcase) if you want a locale "
Packit 33f14e
                 "independent function");
Packit 33f14e
# endif
Packit 33f14e
#endif
Packit 33f14e
Packit 33f14e
/* Compare no more than N bytes of strings S1 and S2, ignoring case,
Packit 33f14e
   returning less than, equal to or greater than zero if S1 is
Packit 33f14e
   lexicographically less than, equal to or greater than S2.
Packit 33f14e
   Note: This function cannot work correctly in multibyte locales.  */
Packit 33f14e
#if ! @HAVE_DECL_STRNCASECMP@
Packit 33f14e
extern int strncasecmp (char const *s1, char const *s2, size_t n)
Packit 33f14e
     _GL_ARG_NONNULL ((1, 2));
Packit 33f14e
#endif
Packit 33f14e
#if defined GNULIB_POSIXCHECK
Packit 33f14e
/* strncasecmp() does not work with multibyte strings:
Packit 33f14e
   POSIX says that it operates on "strings", and "string" in POSIX is defined
Packit 33f14e
   as a sequence of bytes, not of characters.  */
Packit 33f14e
# undef strncasecmp
Packit 33f14e
# if HAVE_RAW_DECL_STRNCASECMP
Packit 33f14e
_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
Packit 33f14e
                 "strings in multibyte locales - "
Packit 33f14e
                 "use mbsncasecmp or mbspcasecmp if you care about "
Packit 33f14e
                 "internationalization, or use c_strncasecmp , "
Packit 33f14e
                 "gnulib module c-strcase) if you want a locale "
Packit 33f14e
                 "independent function");
Packit 33f14e
# endif
Packit 33f14e
#endif
Packit 33f14e
Packit 33f14e
Packit 33f14e
#ifdef __cplusplus
Packit 33f14e
}
Packit 33f14e
#endif
Packit 33f14e
Packit 33f14e
#endif /* _@GUARD_PREFIX@_STRING_H */
Packit 33f14e
#endif /* _@GUARD_PREFIX@_STRING_H */