|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- /*
- * string.h
- *
- * Definitions for memory and string functions.
- */
-
- #ifndef _STRING_H_
- #define _STRING_H_
-
- #include "_ansi.h"
- #include <sys/reent.h>
- #include <sys/cdefs.h>
- #include <sys/features.h>
-
- #define __need_size_t
- #define __need_NULL
- #include <stddef.h>
-
- #if __POSIX_VISIBLE >= 200809
- #include <sys/_locale.h>
- #endif
-
- #if __BSD_VISIBLE
- #include <strings.h>
- #endif
-
- _BEGIN_STD_C
-
- void * memchr (const void *, int, size_t);
- int memcmp (const void *, const void *, size_t);
- void * memcpy (void *__restrict, const void *__restrict, size_t);
- void * memmove (void *, const void *, size_t);
- void * memset (void *, int, size_t);
- char *strcat (char *__restrict, const char *__restrict);
- char *strchr (const char *, int);
- int strcmp (const char *, const char *);
- int strcoll (const char *, const char *);
- char *strcpy (char *__restrict, const char *__restrict);
- size_t strcspn (const char *, const char *);
- char *strerror (int);
- size_t strlen (const char *);
- char *strncat (char *__restrict, const char *__restrict, size_t);
- int strncmp (const char *, const char *, size_t);
- char *strncpy (char *__restrict, const char *__restrict, size_t);
- char *strpbrk (const char *, const char *);
- char *strrchr (const char *, int);
- size_t strspn (const char *, const char *);
- char *strstr (const char *, const char *);
- #ifndef _REENT_ONLY
- char *strtok (char *__restrict, const char *__restrict);
- #endif
- size_t strxfrm (char *__restrict, const char *__restrict, size_t);
-
- #if __POSIX_VISIBLE >= 200809
- int strcoll_l (const char *, const char *, locale_t);
- char *strerror_l (int, locale_t);
- size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);
- #endif
- #if __MISC_VISIBLE || __POSIX_VISIBLE
- char *strtok_r (char *__restrict, const char *__restrict, char **__restrict);
- #endif
- #if __BSD_VISIBLE
- int timingsafe_bcmp (const void *, const void *, size_t);
- int timingsafe_memcmp (const void *, const void *, size_t);
- #endif
- #if __MISC_VISIBLE || __POSIX_VISIBLE
- void * memccpy (void *__restrict, const void *__restrict, int, size_t);
- #endif
- #if __GNU_VISIBLE
- void * mempcpy (void *, const void *, size_t);
- void * memmem (const void *, size_t, const void *, size_t);
- void * memrchr (const void *, int, size_t);
- void * rawmemchr (const void *, int);
- #endif
- #if __POSIX_VISIBLE >= 200809
- char *stpcpy (char *__restrict, const char *__restrict);
- char *stpncpy (char *__restrict, const char *__restrict, size_t);
- #endif
- #if __GNU_VISIBLE
- char *strcasestr (const char *, const char *);
- char *strchrnul (const char *, int);
- #endif
- #if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 4
- char *strdup (const char *) __malloc_like __result_use_check;
- #endif
- char *_strdup_r (struct _reent *, const char *);
- #if __POSIX_VISIBLE >= 200809
- char *strndup (const char *, size_t) __malloc_like __result_use_check;
- #endif
- char *_strndup_r (struct _reent *, const char *, size_t);
-
- /* There are two common strerror_r variants. If you request
- _GNU_SOURCE, you get the GNU version; otherwise you get the POSIX
- version. POSIX requires that #undef strerror_r will still let you
- invoke the underlying function, but that requires gcc support. */
- #if __GNU_VISIBLE
- char *strerror_r (int, char *, size_t);
- #elif __POSIX_VISIBLE >= 200112
- # ifdef __GNUC__
- int strerror_r (int, char *, size_t)
- #ifdef __ASMNAME
- __asm__ (__ASMNAME ("__xpg_strerror_r"))
- #endif
- ;
- # else
- int __xpg_strerror_r (int, char *, size_t);
- # define strerror_r __xpg_strerror_r
- # endif
- #endif
-
- /* Reentrant version of strerror. */
- char * _strerror_r (struct _reent *, int, int, int *);
-
- #if __BSD_VISIBLE
- size_t strlcat (char *, const char *, size_t);
- size_t strlcpy (char *, const char *, size_t);
- #endif
- #if __POSIX_VISIBLE >= 200809
- size_t strnlen (const char *, size_t);
- #endif
- #if __BSD_VISIBLE
- char *strsep (char **, const char *);
- #endif
- #if __BSD_VISIBLE
- char *strnstr(const char *, const char *, size_t) __pure;
- #endif
-
- #if __MISC_VISIBLE
- char *strlwr (char *);
- char *strupr (char *);
- #endif
-
- #ifndef DEFS_H /* Kludge to work around problem compiling in gdb */
- char *strsignal (int __signo);
- #endif
-
- #ifdef __CYGWIN__
- int strtosigno (const char *__name);
- #endif
-
- #if __GNU_VISIBLE
- int strverscmp (const char *, const char *);
- #endif
-
- #if __GNU_VISIBLE && defined(__GNUC__)
- #define strdupa(__s) \
- (__extension__ ({const char *__sin = (__s); \
- size_t __len = strlen (__sin) + 1; \
- char * __sout = (char *) __builtin_alloca (__len); \
- (char *) memcpy (__sout, __sin, __len);}))
- #define strndupa(__s, __n) \
- (__extension__ ({const char *__sin = (__s); \
- size_t __len = strnlen (__sin, (__n)) + 1; \
- char *__sout = (char *) __builtin_alloca (__len); \
- __sout[__len-1] = '\0'; \
- (char *) memcpy (__sout, __sin, __len-1);}))
- #endif /* __GNU_VISIBLE && __GNUC__ */
-
- /* There are two common basename variants. If you do NOT #include <libgen.h>
- and you do
-
- #define _GNU_SOURCE
- #include <string.h>
-
- you get the GNU version. Otherwise you get the POSIX versionfor which you
- should #include <libgen.h>i for the function prototype. POSIX requires that
- #undef basename will still let you invoke the underlying function. However,
- this also implies that the POSIX version is used in this case. That's made
- sure here. */
- #if __GNU_VISIBLE && !defined(basename)
- # define basename basename
- char *__nonnull ((1)) basename (const char *) __asm__(__ASMNAME("__gnu_basename"));
- #endif
-
- #include <sys/string.h>
-
- _END_STD_C
-
- #if __SSP_FORTIFY_LEVEL > 0
- #include <ssp/string.h>
- #endif
-
- #endif /* _STRING_H_ */
|