OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [gnulib/] [string.in.h] - Diff between revs 834 and 842

Only display areas with differences | Details | Blame | View Log

Rev 834 Rev 842
/* A GNU-like <string.h>.
/* A GNU-like <string.h>.
 
 
   Copyright (C) 1995-1996, 2001-2010 Free Software Foundation, Inc.
   Copyright (C) 1995-1996, 2001-2010 Free Software Foundation, Inc.
 
 
   This program is free software; you can redistribute it and/or modify
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3, or (at your option)
   the Free Software Foundation; either version 3, or (at your option)
   any later version.
   any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software Foundation,
   along with this program; if not, write to the Free Software Foundation,
   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 
#ifndef _GL_STRING_H
#ifndef _GL_STRING_H
 
 
/* The include_next requires a split double-inclusion guard.  */
/* The include_next requires a split double-inclusion guard.  */
#@INCLUDE_NEXT@ @NEXT_STRING_H@
#@INCLUDE_NEXT@ @NEXT_STRING_H@
 
 
#ifndef _GL_STRING_H
#ifndef _GL_STRING_H
#define _GL_STRING_H
#define _GL_STRING_H
 
 
 
 
#ifndef __attribute__
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later.  */
/* This feature is available in gcc versions 2.5 and later.  */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
#  define __attribute__(Spec) /* empty */
#  define __attribute__(Spec) /* empty */
# endif
# endif
/* The attribute __pure__ was added in gcc 2.96.  */
/* The attribute __pure__ was added in gcc 2.96.  */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
#  define __pure__ /* empty */
#  define __pure__ /* empty */
# endif
# endif
#endif
#endif
 
 
 
 
/* The definition of GL_LINK_WARNING is copied here.  */
/* The definition of GL_LINK_WARNING is copied here.  */
 
 
 
 
#ifdef __cplusplus
#ifdef __cplusplus
extern "C" {
extern "C" {
#endif
#endif
 
 
 
 
/* Return the first occurrence of NEEDLE in HAYSTACK.  */
/* Return the first occurrence of NEEDLE in HAYSTACK.  */
#if @GNULIB_MEMMEM@
#if @GNULIB_MEMMEM@
# if @REPLACE_MEMMEM@
# if @REPLACE_MEMMEM@
#  define memmem rpl_memmem
#  define memmem rpl_memmem
# endif
# endif
# if ! @HAVE_DECL_MEMMEM@ || @REPLACE_MEMMEM@
# if ! @HAVE_DECL_MEMMEM@ || @REPLACE_MEMMEM@
extern void *memmem (void const *__haystack, size_t __haystack_len,
extern void *memmem (void const *__haystack, size_t __haystack_len,
                     void const *__needle, size_t __needle_len)
                     void const *__needle, size_t __needle_len)
  __attribute__ ((__pure__));
  __attribute__ ((__pure__));
# endif
# endif
#elif defined GNULIB_POSIXCHECK
#elif defined GNULIB_POSIXCHECK
# undef memmem
# undef memmem
# define memmem(a,al,b,bl) \
# define memmem(a,al,b,bl) \
    (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \
    (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \
                      "use gnulib module memmem-simple for portability, " \
                      "use gnulib module memmem-simple for portability, " \
                      "and module memmem for speed" ), \
                      "and module memmem for speed" ), \
     memmem (a, al, b, bl))
     memmem (a, al, b, bl))
#endif
#endif
 
 
/* Copy N bytes of SRC to DEST, return pointer to bytes after the
/* Copy N bytes of SRC to DEST, return pointer to bytes after the
   last written byte.  */
   last written byte.  */
#if @GNULIB_MEMPCPY@
#if @GNULIB_MEMPCPY@
# if ! @HAVE_MEMPCPY@
# if ! @HAVE_MEMPCPY@
extern void *mempcpy (void *restrict __dest, void const *restrict __src,
extern void *mempcpy (void *restrict __dest, void const *restrict __src,
                      size_t __n);
                      size_t __n);
# endif
# endif
#elif defined GNULIB_POSIXCHECK
#elif defined GNULIB_POSIXCHECK
# undef mempcpy
# undef mempcpy
# define mempcpy(a,b,n) \
# define mempcpy(a,b,n) \
    (GL_LINK_WARNING ("mempcpy is unportable - " \
    (GL_LINK_WARNING ("mempcpy is unportable - " \
                      "use gnulib module mempcpy for portability"), \
                      "use gnulib module mempcpy for portability"), \
     mempcpy (a, b, n))
     mempcpy (a, b, n))
#endif
#endif
 
 
/* Search backwards through a block for a byte (specified as an int).  */
/* Search backwards through a block for a byte (specified as an int).  */
#if @GNULIB_MEMRCHR@
#if @GNULIB_MEMRCHR@
# if ! @HAVE_DECL_MEMRCHR@
# if ! @HAVE_DECL_MEMRCHR@
extern void *memrchr (void const *, int, size_t)
extern void *memrchr (void const *, int, size_t)
  __attribute__ ((__pure__));
  __attribute__ ((__pure__));
# endif
# endif
#elif defined GNULIB_POSIXCHECK
#elif defined GNULIB_POSIXCHECK
# undef memrchr
# undef memrchr
# define memrchr(a,b,c) \
# define memrchr(a,b,c) \
    (GL_LINK_WARNING ("memrchr is unportable - " \
    (GL_LINK_WARNING ("memrchr is unportable - " \
                      "use gnulib module memrchr for portability"), \
                      "use gnulib module memrchr for portability"), \
     memrchr (a, b, c))
     memrchr (a, b, c))
#endif
#endif
 
 
/* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
/* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
#if @GNULIB_STPCPY@
#if @GNULIB_STPCPY@
# if ! @HAVE_STPCPY@
# if ! @HAVE_STPCPY@
extern char *stpcpy (char *restrict __dst, char const *restrict __src);
extern char *stpcpy (char *restrict __dst, char const *restrict __src);
# endif
# endif
#elif defined GNULIB_POSIXCHECK
#elif defined GNULIB_POSIXCHECK
# undef stpcpy
# undef stpcpy
# define stpcpy(a,b) \
# define stpcpy(a,b) \
    (GL_LINK_WARNING ("stpcpy is unportable - " \
    (GL_LINK_WARNING ("stpcpy is unportable - " \
                      "use gnulib module stpcpy for portability"), \
                      "use gnulib module stpcpy for portability"), \
     stpcpy (a, b))
     stpcpy (a, b))
#endif
#endif
 
 
/* Copy no more than N bytes of SRC to DST, returning a pointer past the
/* Copy no more than N bytes of SRC to DST, returning a pointer past the
   last non-NUL byte written into DST.  */
   last non-NUL byte written into DST.  */
#if @GNULIB_STPNCPY@
#if @GNULIB_STPNCPY@
# if ! @HAVE_STPNCPY@
# if ! @HAVE_STPNCPY@
#  define stpncpy gnu_stpncpy
#  define stpncpy gnu_stpncpy
extern char *stpncpy (char *restrict __dst, char const *restrict __src,
extern char *stpncpy (char *restrict __dst, char const *restrict __src,
                      size_t __n);
                      size_t __n);
# endif
# endif
#elif defined GNULIB_POSIXCHECK
#elif defined GNULIB_POSIXCHECK
# undef stpncpy
# undef stpncpy
# define stpncpy(a,b,n) \
# define stpncpy(a,b,n) \
    (GL_LINK_WARNING ("stpncpy is unportable - " \
    (GL_LINK_WARNING ("stpncpy is unportable - " \
                      "use gnulib module stpncpy for portability"), \
                      "use gnulib module stpncpy for portability"), \
     stpncpy (a, b, n))
     stpncpy (a, b, n))
#endif
#endif
 
 
#if defined GNULIB_POSIXCHECK
#if defined GNULIB_POSIXCHECK
/* strchr() does not work with multibyte strings if the locale encoding is
/* strchr() does not work with multibyte strings if the locale encoding is
   GB18030 and the character to be searched is a digit.  */
   GB18030 and the character to be searched is a digit.  */
# undef strchr
# undef strchr
# define strchr(s,c) \
# define strchr(s,c) \
    (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
    (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
                      "in some multibyte locales - " \
                      "in some multibyte locales - " \
                      "use mbschr if you care about internationalization"), \
                      "use mbschr if you care about internationalization"), \
     strchr (s, c))
     strchr (s, c))
#endif
#endif
 
 
/* Find the first occurrence of C in S or the final NUL byte.  */
/* Find the first occurrence of C in S or the final NUL byte.  */
#if @GNULIB_STRCHRNUL@
#if @GNULIB_STRCHRNUL@
# if ! @HAVE_STRCHRNUL@
# if ! @HAVE_STRCHRNUL@
extern char *strchrnul (char const *__s, int __c_in)
extern char *strchrnul (char const *__s, int __c_in)
  __attribute__ ((__pure__));
  __attribute__ ((__pure__));
# endif
# endif
#elif defined GNULIB_POSIXCHECK
#elif defined GNULIB_POSIXCHECK
# undef strchrnul
# undef strchrnul
# define strchrnul(a,b) \
# define strchrnul(a,b) \
    (GL_LINK_WARNING ("strchrnul is unportable - " \
    (GL_LINK_WARNING ("strchrnul is unportable - " \
                      "use gnulib module strchrnul for portability"), \
                      "use gnulib module strchrnul for portability"), \
     strchrnul (a, b))
     strchrnul (a, b))
#endif
#endif
 
 
/* Duplicate S, returning an identical malloc'd string.  */
/* Duplicate S, returning an identical malloc'd string.  */
#if @GNULIB_STRDUP@
#if @GNULIB_STRDUP@
# if ! @HAVE_DECL_STRDUP@ && ! defined strdup
# if ! @HAVE_DECL_STRDUP@ && ! defined strdup
extern char *strdup (char const *__s);
extern char *strdup (char const *__s);
# endif
# endif
#elif defined GNULIB_POSIXCHECK
#elif defined GNULIB_POSIXCHECK
# undef strdup
# undef strdup
# define strdup(a) \
# define strdup(a) \
    (GL_LINK_WARNING ("strdup is unportable - " \
    (GL_LINK_WARNING ("strdup is unportable - " \
                      "use gnulib module strdup for portability"), \
                      "use gnulib module strdup for portability"), \
     strdup (a))
     strdup (a))
#endif
#endif
 
 
/* Return a newly allocated copy of at most N bytes of STRING.  */
/* Return a newly allocated copy of at most N bytes of STRING.  */
#if @GNULIB_STRNDUP@
#if @GNULIB_STRNDUP@
# if ! @HAVE_STRNDUP@
# if ! @HAVE_STRNDUP@
#  undef strndup
#  undef strndup
#  define strndup rpl_strndup
#  define strndup rpl_strndup
# endif
# endif
# if ! @HAVE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@
# if ! @HAVE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@
extern char *strndup (char const *__string, size_t __n);
extern char *strndup (char const *__string, size_t __n);
# endif
# endif
#elif defined GNULIB_POSIXCHECK
#elif defined GNULIB_POSIXCHECK
# undef strndup
# undef strndup
# define strndup(a,n) \
# define strndup(a,n) \
    (GL_LINK_WARNING ("strndup is unportable - " \
    (GL_LINK_WARNING ("strndup is unportable - " \
                      "use gnulib module strndup for portability"), \
                      "use gnulib module strndup for portability"), \
     strndup (a, n))
     strndup (a, n))
#endif
#endif
 
 
/* Find the length (number of bytes) of STRING, but scan at most
/* Find the length (number of bytes) of STRING, but scan at most
   MAXLEN bytes.  If no '\0' terminator is found in that many bytes,
   MAXLEN bytes.  If no '\0' terminator is found in that many bytes,
   return MAXLEN.  */
   return MAXLEN.  */
#if @GNULIB_STRNLEN@
#if @GNULIB_STRNLEN@
# if ! @HAVE_DECL_STRNLEN@
# if ! @HAVE_DECL_STRNLEN@
extern size_t strnlen (char const *__string, size_t __maxlen)
extern size_t strnlen (char const *__string, size_t __maxlen)
  __attribute__ ((__pure__));
  __attribute__ ((__pure__));
# endif
# endif
#elif defined GNULIB_POSIXCHECK
#elif defined GNULIB_POSIXCHECK
# undef strnlen
# undef strnlen
# define strnlen(a,n) \
# define strnlen(a,n) \
    (GL_LINK_WARNING ("strnlen is unportable - " \
    (GL_LINK_WARNING ("strnlen is unportable - " \
                      "use gnulib module strnlen for portability"), \
                      "use gnulib module strnlen for portability"), \
     strnlen (a, n))
     strnlen (a, n))
#endif
#endif
 
 
#if defined GNULIB_POSIXCHECK
#if defined GNULIB_POSIXCHECK
/* strcspn() assumes the second argument is a list of single-byte characters.
/* strcspn() assumes the second argument is a list of single-byte characters.
   Even in this simple case, it does not work with multibyte strings if the
   Even in this simple case, it does not work with multibyte strings if the
   locale encoding is GB18030 and one of the characters to be searched is a
   locale encoding is GB18030 and one of the characters to be searched is a
   digit.  */
   digit.  */
# undef strcspn
# undef strcspn
# define strcspn(s,a) \
# define strcspn(s,a) \
    (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
    (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
                      "in multibyte locales - " \
                      "in multibyte locales - " \
                      "use mbscspn if you care about internationalization"), \
                      "use mbscspn if you care about internationalization"), \
     strcspn (s, a))
     strcspn (s, a))
#endif
#endif
 
 
/* Find the first occurrence in S of any character in ACCEPT.  */
/* Find the first occurrence in S of any character in ACCEPT.  */
#if @GNULIB_STRPBRK@
#if @GNULIB_STRPBRK@
# if ! @HAVE_STRPBRK@
# if ! @HAVE_STRPBRK@
extern char *strpbrk (char const *__s, char const *__accept)
extern char *strpbrk (char const *__s, char const *__accept)
  __attribute__ ((__pure__));
  __attribute__ ((__pure__));
# endif
# endif
# if defined GNULIB_POSIXCHECK
# if defined GNULIB_POSIXCHECK
/* strpbrk() assumes the second argument is a list of single-byte characters.
/* strpbrk() assumes the second argument is a list of single-byte characters.
   Even in this simple case, it does not work with multibyte strings if the
   Even in this simple case, it does not work with multibyte strings if the
   locale encoding is GB18030 and one of the characters to be searched is a
   locale encoding is GB18030 and one of the characters to be searched is a
   digit.  */
   digit.  */
#  undef strpbrk
#  undef strpbrk
#  define strpbrk(s,a) \
#  define strpbrk(s,a) \
     (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
     (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
                       "in multibyte locales - " \
                       "in multibyte locales - " \
                       "use mbspbrk if you care about internationalization"), \
                       "use mbspbrk if you care about internationalization"), \
      strpbrk (s, a))
      strpbrk (s, a))
# endif
# endif
#elif defined GNULIB_POSIXCHECK
#elif defined GNULIB_POSIXCHECK
# undef strpbrk
# undef strpbrk
# define strpbrk(s,a) \
# define strpbrk(s,a) \
    (GL_LINK_WARNING ("strpbrk is unportable - " \
    (GL_LINK_WARNING ("strpbrk is unportable - " \
                      "use gnulib module strpbrk for portability"), \
                      "use gnulib module strpbrk for portability"), \
     strpbrk (s, a))
     strpbrk (s, a))
#endif
#endif
 
 
#if defined GNULIB_POSIXCHECK
#if defined GNULIB_POSIXCHECK
/* strspn() assumes the second argument is a list of single-byte characters.
/* strspn() assumes the second argument is a list of single-byte characters.
   Even in this simple case, it cannot work with multibyte strings.  */
   Even in this simple case, it cannot work with multibyte strings.  */
# undef strspn
# undef strspn
# define strspn(s,a) \
# define strspn(s,a) \
    (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
    (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
                      "in multibyte locales - " \
                      "in multibyte locales - " \
                      "use mbsspn if you care about internationalization"), \
                      "use mbsspn if you care about internationalization"), \
     strspn (s, a))
     strspn (s, a))
#endif
#endif
 
 
#if defined GNULIB_POSIXCHECK
#if defined GNULIB_POSIXCHECK
/* strrchr() does not work with multibyte strings if the locale encoding is
/* strrchr() does not work with multibyte strings if the locale encoding is
   GB18030 and the character to be searched is a digit.  */
   GB18030 and the character to be searched is a digit.  */
# undef strrchr
# undef strrchr
# define strrchr(s,c) \
# define strrchr(s,c) \
    (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
    (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
                      "in some multibyte locales - " \
                      "in some multibyte locales - " \
                      "use mbsrchr if you care about internationalization"), \
                      "use mbsrchr if you care about internationalization"), \
     strrchr (s, c))
     strrchr (s, c))
#endif
#endif
 
 
/* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
/* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
   If one is found, overwrite it with a NUL, and advance *STRINGP
   If one is found, overwrite it with a NUL, and advance *STRINGP
   to point to the next char after it.  Otherwise, set *STRINGP to NULL.
   to point to the next char after it.  Otherwise, set *STRINGP to NULL.
   If *STRINGP was already NULL, nothing happens.
   If *STRINGP was already NULL, nothing happens.
   Return the old value of *STRINGP.
   Return the old value of *STRINGP.
 
 
   This is a variant of strtok() that is multithread-safe and supports
   This is a variant of strtok() that is multithread-safe and supports
   empty fields.
   empty fields.
 
 
   Caveat: It modifies the original string.
   Caveat: It modifies the original string.
   Caveat: These functions cannot be used on constant strings.
   Caveat: These functions cannot be used on constant strings.
   Caveat: The identity of the delimiting character is lost.
   Caveat: The identity of the delimiting character is lost.
   Caveat: It doesn't work with multibyte strings unless all of the delimiter
   Caveat: It doesn't work with multibyte strings unless all of the delimiter
           characters are ASCII characters < 0x30.
           characters are ASCII characters < 0x30.
 
 
   See also strtok_r().  */
   See also strtok_r().  */
#if @GNULIB_STRSEP@
#if @GNULIB_STRSEP@
# if ! @HAVE_STRSEP@
# if ! @HAVE_STRSEP@
extern char *strsep (char **restrict __stringp, char const *restrict __delim);
extern char *strsep (char **restrict __stringp, char const *restrict __delim);
# endif
# endif
# if defined GNULIB_POSIXCHECK
# if defined GNULIB_POSIXCHECK
#  undef strsep
#  undef strsep
#  define strsep(s,d) \
#  define strsep(s,d) \
     (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
     (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
                       "in multibyte locales - " \
                       "in multibyte locales - " \
                       "use mbssep if you care about internationalization"), \
                       "use mbssep if you care about internationalization"), \
      strsep (s, d))
      strsep (s, d))
# endif
# endif
#elif defined GNULIB_POSIXCHECK
#elif defined GNULIB_POSIXCHECK
# undef strsep
# undef strsep
# define strsep(s,d) \
# define strsep(s,d) \
    (GL_LINK_WARNING ("strsep is unportable - " \
    (GL_LINK_WARNING ("strsep is unportable - " \
                      "use gnulib module strsep for portability"), \
                      "use gnulib module strsep for portability"), \
     strsep (s, d))
     strsep (s, d))
#endif
#endif
 
 
#if @GNULIB_STRSTR@
#if @GNULIB_STRSTR@
# if @REPLACE_STRSTR@
# if @REPLACE_STRSTR@
#  define strstr rpl_strstr
#  define strstr rpl_strstr
char *strstr (const char *haystack, const char *needle)
char *strstr (const char *haystack, const char *needle)
  __attribute__ ((__pure__));
  __attribute__ ((__pure__));
# endif
# endif
#elif defined GNULIB_POSIXCHECK
#elif defined GNULIB_POSIXCHECK
/* strstr() does not work with multibyte strings if the locale encoding is
/* strstr() does not work with multibyte strings if the locale encoding is
   different from UTF-8:
   different from UTF-8:
   POSIX says that it operates on "strings", and "string" in POSIX is defined
   POSIX says that it operates on "strings", and "string" in POSIX is defined
   as a sequence of bytes, not of characters.  */
   as a sequence of bytes, not of characters.  */
# undef strstr
# undef strstr
# define strstr(a,b) \
# define strstr(a,b) \
    (GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \
    (GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \
                      "work correctly on character strings in most "    \
                      "work correctly on character strings in most "    \
                      "multibyte locales - " \
                      "multibyte locales - " \
                      "use mbsstr if you care about internationalization, " \
                      "use mbsstr if you care about internationalization, " \
                      "or use strstr if you care about speed"), \
                      "or use strstr if you care about speed"), \
     strstr (a, b))
     strstr (a, b))
#endif
#endif
 
 
/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
   comparison.  */
   comparison.  */
#if @GNULIB_STRCASESTR@
#if @GNULIB_STRCASESTR@
# if @REPLACE_STRCASESTR@
# if @REPLACE_STRCASESTR@
#  define strcasestr rpl_strcasestr
#  define strcasestr rpl_strcasestr
# endif
# endif
# if ! @HAVE_STRCASESTR@ || @REPLACE_STRCASESTR@
# if ! @HAVE_STRCASESTR@ || @REPLACE_STRCASESTR@
extern char *strcasestr (const char *haystack, const char *needle)
extern char *strcasestr (const char *haystack, const char *needle)
  __attribute__ ((__pure__));
  __attribute__ ((__pure__));
# endif
# endif
#elif defined GNULIB_POSIXCHECK
#elif defined GNULIB_POSIXCHECK
/* strcasestr() does not work with multibyte strings:
/* strcasestr() does not work with multibyte strings:
   It is a glibc extension, and glibc implements it only for unibyte
   It is a glibc extension, and glibc implements it only for unibyte
   locales.  */
   locales.  */
# undef strcasestr
# undef strcasestr
# define strcasestr(a,b) \
# define strcasestr(a,b) \
    (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
    (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
                      "in multibyte locales - " \
                      "in multibyte locales - " \
                      "use mbscasestr if you care about " \
                      "use mbscasestr if you care about " \
                      "internationalization, or use c-strcasestr if you want " \
                      "internationalization, or use c-strcasestr if you want " \
                      "a locale independent function"), \
                      "a locale independent function"), \
     strcasestr (a, b))
     strcasestr (a, b))
#endif
#endif
 
 
/* Parse S into tokens separated by characters in DELIM.
/* Parse S into tokens separated by characters in DELIM.
   If S is NULL, the saved pointer in SAVE_PTR is used as
   If S is NULL, the saved pointer in SAVE_PTR is used as
   the next starting point.  For example:
   the next starting point.  For example:
        char s[] = "-abc-=-def";
        char s[] = "-abc-=-def";
        char *sp;
        char *sp;
        x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
        x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
        x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
        x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
        x = strtok_r(NULL, "=", &sp);   // x = NULL
        x = strtok_r(NULL, "=", &sp);   // x = NULL
                // s = "abc\0-def\0"
                // s = "abc\0-def\0"
 
 
   This is a variant of strtok() that is multithread-safe.
   This is a variant of strtok() that is multithread-safe.
 
 
   For the POSIX documentation for this function, see:
   For the POSIX documentation for this function, see:
   http://www.opengroup.org/susv3xsh/strtok.html
   http://www.opengroup.org/susv3xsh/strtok.html
 
 
   Caveat: It modifies the original string.
   Caveat: It modifies the original string.
   Caveat: These functions cannot be used on constant strings.
   Caveat: These functions cannot be used on constant strings.
   Caveat: The identity of the delimiting character is lost.
   Caveat: The identity of the delimiting character is lost.
   Caveat: It doesn't work with multibyte strings unless all of the delimiter
   Caveat: It doesn't work with multibyte strings unless all of the delimiter
           characters are ASCII characters < 0x30.
           characters are ASCII characters < 0x30.
 
 
   See also strsep().  */
   See also strsep().  */
#if @GNULIB_STRTOK_R@
#if @GNULIB_STRTOK_R@
# if ! @HAVE_DECL_STRTOK_R@
# if ! @HAVE_DECL_STRTOK_R@
extern char *strtok_r (char *restrict s, char const *restrict delim,
extern char *strtok_r (char *restrict s, char const *restrict delim,
                       char **restrict save_ptr);
                       char **restrict save_ptr);
# endif
# endif
# if defined GNULIB_POSIXCHECK
# if defined GNULIB_POSIXCHECK
#  undef strtok_r
#  undef strtok_r
#  define strtok_r(s,d,p) \
#  define strtok_r(s,d,p) \
     (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
     (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
                       "in multibyte locales - " \
                       "in multibyte locales - " \
                       "use mbstok_r if you care about internationalization"), \
                       "use mbstok_r if you care about internationalization"), \
      strtok_r (s, d, p))
      strtok_r (s, d, p))
# endif
# endif
#elif defined GNULIB_POSIXCHECK
#elif defined GNULIB_POSIXCHECK
# undef strtok_r
# undef strtok_r
# define strtok_r(s,d,p) \
# define strtok_r(s,d,p) \
    (GL_LINK_WARNING ("strtok_r is unportable - " \
    (GL_LINK_WARNING ("strtok_r is unportable - " \
                      "use gnulib module strtok_r for portability"), \
                      "use gnulib module strtok_r for portability"), \
     strtok_r (s, d, p))
     strtok_r (s, d, p))
#endif
#endif
 
 
 
 
/* The following functions are not specified by POSIX.  They are gnulib
/* The following functions are not specified by POSIX.  They are gnulib
   extensions.  */
   extensions.  */
 
 
#if @GNULIB_MBSLEN@
#if @GNULIB_MBSLEN@
/* Return the number of multibyte characters in the character string STRING.
/* Return the number of multibyte characters in the character string STRING.
   This considers multibyte characters, unlike strlen, which counts bytes.  */
   This considers multibyte characters, unlike strlen, which counts bytes.  */
extern size_t mbslen (const char *string);
extern size_t mbslen (const char *string);
#endif
#endif
 
 
#if @GNULIB_MBSNLEN@
#if @GNULIB_MBSNLEN@
/* Return the number of multibyte characters in the character string starting
/* Return the number of multibyte characters in the character string starting
   at STRING and ending at STRING + LEN.  */
   at STRING and ending at STRING + LEN.  */
extern size_t mbsnlen (const char *string, size_t len);
extern size_t mbsnlen (const char *string, size_t len);
#endif
#endif
 
 
#if @GNULIB_MBSCHR@
#if @GNULIB_MBSCHR@
/* Locate the first single-byte character C in the character string STRING,
/* Locate the first single-byte character C in the character string STRING,
   and return a pointer to it.  Return NULL if C is not found in STRING.
   and return a pointer to it.  Return NULL if C is not found in STRING.
   Unlike strchr(), this function works correctly in multibyte locales with
   Unlike strchr(), this function works correctly in multibyte locales with
   encodings such as GB18030.  */
   encodings such as GB18030.  */
# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
extern char * mbschr (const char *string, int c);
extern char * mbschr (const char *string, int c);
#endif
#endif
 
 
#if @GNULIB_MBSRCHR@
#if @GNULIB_MBSRCHR@
/* Locate the last single-byte character C in the character string STRING,
/* Locate the last single-byte character C in the character string STRING,
   and return a pointer to it.  Return NULL if C is not found in STRING.
   and return a pointer to it.  Return NULL if C is not found in STRING.
   Unlike strrchr(), this function works correctly in multibyte locales with
   Unlike strrchr(), this function works correctly in multibyte locales with
   encodings such as GB18030.  */
   encodings such as GB18030.  */
# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
extern char * mbsrchr (const char *string, int c);
extern char * mbsrchr (const char *string, int c);
#endif
#endif
 
 
#if @GNULIB_MBSSTR@
#if @GNULIB_MBSSTR@
/* Find the first occurrence of the character string NEEDLE in the character
/* Find the first occurrence of the character string NEEDLE in the character
   string HAYSTACK.  Return NULL if NEEDLE is not found in HAYSTACK.
   string HAYSTACK.  Return NULL if NEEDLE is not found in HAYSTACK.
   Unlike strstr(), this function works correctly in multibyte locales with
   Unlike strstr(), this function works correctly in multibyte locales with
   encodings different from UTF-8.  */
   encodings different from UTF-8.  */
extern char * mbsstr (const char *haystack, const char *needle);
extern char * mbsstr (const char *haystack, const char *needle);
#endif
#endif
 
 
#if @GNULIB_MBSCASECMP@
#if @GNULIB_MBSCASECMP@
/* Compare the character strings S1 and S2, ignoring case, returning less than,
/* Compare the character strings S1 and S2, ignoring case, returning less than,
   equal to or greater than zero if S1 is lexicographically less than, equal to
   equal to or greater than zero if S1 is lexicographically less than, equal to
   or greater than S2.
   or greater than S2.
   Note: This function may, in multibyte locales, return 0 for strings of
   Note: This function may, in multibyte locales, return 0 for strings of
   different lengths!
   different lengths!
   Unlike strcasecmp(), this function works correctly in multibyte locales.  */
   Unlike strcasecmp(), this function works correctly in multibyte locales.  */
extern int mbscasecmp (const char *s1, const char *s2);
extern int mbscasecmp (const char *s1, const char *s2);
#endif
#endif
 
 
#if @GNULIB_MBSNCASECMP@
#if @GNULIB_MBSNCASECMP@
/* Compare the initial segment of the character string S1 consisting of at most
/* Compare the initial segment of the character string S1 consisting of at most
   N characters with the initial segment of the character string S2 consisting
   N characters with the initial segment of the character string S2 consisting
   of at most N characters, ignoring case, returning less than, equal to or
   of at most N characters, ignoring case, returning less than, equal to or
   greater than zero if the initial segment of S1 is lexicographically less
   greater than zero if the initial segment of S1 is lexicographically less
   than, equal to or greater than the initial segment of S2.
   than, equal to or greater than the initial segment of S2.
   Note: This function may, in multibyte locales, return 0 for initial segments
   Note: This function may, in multibyte locales, return 0 for initial segments
   of different lengths!
   of different lengths!
   Unlike strncasecmp(), this function works correctly in multibyte locales.
   Unlike strncasecmp(), this function works correctly in multibyte locales.
   But beware that N is not a byte count but a character count!  */
   But beware that N is not a byte count but a character count!  */
extern int mbsncasecmp (const char *s1, const char *s2, size_t n);
extern int mbsncasecmp (const char *s1, const char *s2, size_t n);
#endif
#endif
 
 
#if @GNULIB_MBSPCASECMP@
#if @GNULIB_MBSPCASECMP@
/* Compare the initial segment of the character string STRING consisting of
/* Compare the initial segment of the character string STRING consisting of
   at most mbslen (PREFIX) characters with the character string PREFIX,
   at most mbslen (PREFIX) characters with the character string PREFIX,
   ignoring case, returning less than, equal to or greater than zero if this
   ignoring case, returning less than, equal to or greater than zero if this
   initial segment is lexicographically less than, equal to or greater than
   initial segment is lexicographically less than, equal to or greater than
   PREFIX.
   PREFIX.
   Note: This function may, in multibyte locales, return 0 if STRING is of
   Note: This function may, in multibyte locales, return 0 if STRING is of
   smaller length than PREFIX!
   smaller length than PREFIX!
   Unlike strncasecmp(), this function works correctly in multibyte
   Unlike strncasecmp(), this function works correctly in multibyte
   locales.  */
   locales.  */
extern char * mbspcasecmp (const char *string, const char *prefix);
extern char * mbspcasecmp (const char *string, const char *prefix);
#endif
#endif
 
 
#if @GNULIB_MBSCASESTR@
#if @GNULIB_MBSCASESTR@
/* Find the first occurrence of the character string NEEDLE in the character
/* Find the first occurrence of the character string NEEDLE in the character
   string HAYSTACK, using case-insensitive comparison.
   string HAYSTACK, using case-insensitive comparison.
   Note: This function may, in multibyte locales, return success even if
   Note: This function may, in multibyte locales, return success even if
   strlen (haystack) < strlen (needle) !
   strlen (haystack) < strlen (needle) !
   Unlike strcasestr(), this function works correctly in multibyte locales.  */
   Unlike strcasestr(), this function works correctly in multibyte locales.  */
extern char * mbscasestr (const char *haystack, const char *needle);
extern char * mbscasestr (const char *haystack, const char *needle);
#endif
#endif
 
 
#if @GNULIB_MBSCSPN@
#if @GNULIB_MBSCSPN@
/* Find the first occurrence in the character string STRING of any character
/* Find the first occurrence in the character string STRING of any character
   in the character string ACCEPT.  Return the number of bytes from the
   in the character string ACCEPT.  Return the number of bytes from the
   beginning of the string to this occurrence, or to the end of the string
   beginning of the string to this occurrence, or to the end of the string
   if none exists.
   if none exists.
   Unlike strcspn(), this function works correctly in multibyte locales.  */
   Unlike strcspn(), this function works correctly in multibyte locales.  */
extern size_t mbscspn (const char *string, const char *accept);
extern size_t mbscspn (const char *string, const char *accept);
#endif
#endif
 
 
#if @GNULIB_MBSPBRK@
#if @GNULIB_MBSPBRK@
/* Find the first occurrence in the character string STRING of any character
/* Find the first occurrence in the character string STRING of any character
   in the character string ACCEPT.  Return the pointer to it, or NULL if none
   in the character string ACCEPT.  Return the pointer to it, or NULL if none
   exists.
   exists.
   Unlike strpbrk(), this function works correctly in multibyte locales.  */
   Unlike strpbrk(), this function works correctly in multibyte locales.  */
# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
extern char * mbspbrk (const char *string, const char *accept);
extern char * mbspbrk (const char *string, const char *accept);
#endif
#endif
 
 
#if @GNULIB_MBSSPN@
#if @GNULIB_MBSSPN@
/* Find the first occurrence in the character string STRING of any character
/* Find the first occurrence in the character string STRING of any character
   not in the character string REJECT.  Return the number of bytes from the
   not in the character string REJECT.  Return the number of bytes from the
   beginning of the string to this occurrence, or to the end of the string
   beginning of the string to this occurrence, or to the end of the string
   if none exists.
   if none exists.
   Unlike strspn(), this function works correctly in multibyte locales.  */
   Unlike strspn(), this function works correctly in multibyte locales.  */
extern size_t mbsspn (const char *string, const char *reject);
extern size_t mbsspn (const char *string, const char *reject);
#endif
#endif
 
 
#if @GNULIB_MBSSEP@
#if @GNULIB_MBSSEP@
/* Search the next delimiter (multibyte character listed in the character
/* Search the next delimiter (multibyte character listed in the character
   string DELIM) starting at the character string *STRINGP.
   string DELIM) starting at the character string *STRINGP.
   If one is found, overwrite it with a NUL, and advance *STRINGP to point
   If one is found, overwrite it with a NUL, and advance *STRINGP to point
   to the next multibyte character after it.  Otherwise, set *STRINGP to NULL.
   to the next multibyte character after it.  Otherwise, set *STRINGP to NULL.
   If *STRINGP was already NULL, nothing happens.
   If *STRINGP was already NULL, nothing happens.
   Return the old value of *STRINGP.
   Return the old value of *STRINGP.
 
 
   This is a variant of mbstok_r() that supports empty fields.
   This is a variant of mbstok_r() that supports empty fields.
 
 
   Caveat: It modifies the original string.
   Caveat: It modifies the original string.
   Caveat: These functions cannot be used on constant strings.
   Caveat: These functions cannot be used on constant strings.
   Caveat: The identity of the delimiting character is lost.
   Caveat: The identity of the delimiting character is lost.
 
 
   See also mbstok_r().  */
   See also mbstok_r().  */
extern char * mbssep (char **stringp, const char *delim);
extern char * mbssep (char **stringp, const char *delim);
#endif
#endif
 
 
#if @GNULIB_MBSTOK_R@
#if @GNULIB_MBSTOK_R@
/* Parse the character string STRING into tokens separated by characters in
/* Parse the character string STRING into tokens separated by characters in
   the character string DELIM.
   the character string DELIM.
   If STRING is NULL, the saved pointer in SAVE_PTR is used as
   If STRING is NULL, the saved pointer in SAVE_PTR is used as
   the next starting point.  For example:
   the next starting point.  For example:
        char s[] = "-abc-=-def";
        char s[] = "-abc-=-def";
        char *sp;
        char *sp;
        x = mbstok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
        x = mbstok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
        x = mbstok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
        x = mbstok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
        x = mbstok_r(NULL, "=", &sp);   // x = NULL
        x = mbstok_r(NULL, "=", &sp);   // x = NULL
                // s = "abc\0-def\0"
                // s = "abc\0-def\0"
 
 
   Caveat: It modifies the original string.
   Caveat: It modifies the original string.
   Caveat: These functions cannot be used on constant strings.
   Caveat: These functions cannot be used on constant strings.
   Caveat: The identity of the delimiting character is lost.
   Caveat: The identity of the delimiting character is lost.
 
 
   See also mbssep().  */
   See also mbssep().  */
extern char * mbstok_r (char *string, const char *delim, char **save_ptr);
extern char * mbstok_r (char *string, const char *delim, char **save_ptr);
#endif
#endif
 
 
/* Map any int, typically from errno, into an error message.  */
/* Map any int, typically from errno, into an error message.  */
#if @GNULIB_STRERROR@
#if @GNULIB_STRERROR@
# if @REPLACE_STRERROR@
# if @REPLACE_STRERROR@
#  undef strerror
#  undef strerror
#  define strerror rpl_strerror
#  define strerror rpl_strerror
extern char *strerror (int);
extern char *strerror (int);
# endif
# endif
#elif defined GNULIB_POSIXCHECK
#elif defined GNULIB_POSIXCHECK
# undef strerror
# undef strerror
# define strerror(e) \
# define strerror(e) \
    (GL_LINK_WARNING ("strerror is unportable - " \
    (GL_LINK_WARNING ("strerror is unportable - " \
                      "use gnulib module strerror to guarantee non-NULL result"), \
                      "use gnulib module strerror to guarantee non-NULL result"), \
     strerror (e))
     strerror (e))
#endif
#endif
 
 
#if @GNULIB_STRSIGNAL@
#if @GNULIB_STRSIGNAL@
# if @REPLACE_STRSIGNAL@
# if @REPLACE_STRSIGNAL@
#  define strsignal rpl_strsignal
#  define strsignal rpl_strsignal
# endif
# endif
# if ! @HAVE_DECL_STRSIGNAL@ || @REPLACE_STRSIGNAL@
# if ! @HAVE_DECL_STRSIGNAL@ || @REPLACE_STRSIGNAL@
extern char *strsignal (int __sig);
extern char *strsignal (int __sig);
# endif
# endif
#elif defined GNULIB_POSIXCHECK
#elif defined GNULIB_POSIXCHECK
# undef strsignal
# undef strsignal
# define strsignal(a) \
# define strsignal(a) \
    (GL_LINK_WARNING ("strsignal is unportable - " \
    (GL_LINK_WARNING ("strsignal is unportable - " \
                      "use gnulib module strsignal for portability"), \
                      "use gnulib module strsignal for portability"), \
     strsignal (a))
     strsignal (a))
#endif
#endif
 
 
 
 
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
 
 
#endif /* _GL_STRING_H */
#endif /* _GL_STRING_H */
#endif /* _GL_STRING_H */
#endif /* _GL_STRING_H */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.