1998-09-06 23:45:24 +00:00
|
|
|
#ifndef _STRING_H
|
1999-11-24 20:48:27 +00:00
|
|
|
|
2016-11-20 20:46:30 -05:00
|
|
|
#ifndef _ISOMAC
|
|
|
|
|
/* Some of these are defined as macros in the real string.h, so we must
|
|
|
|
|
prototype them before including it. */
|
1999-11-24 20:48:27 +00:00
|
|
|
#include <sys/types.h>
|
2020-05-14 17:44:15 -03:00
|
|
|
#include <locale.h>
|
1999-11-24 20:48:27 +00:00
|
|
|
|
2012-01-07 23:57:22 -05:00
|
|
|
extern void *__memccpy (void *__dest, const void *__src,
|
2004-10-18 04:17:19 +00:00
|
|
|
int __c, size_t __n);
|
1999-11-24 20:48:27 +00:00
|
|
|
|
2012-01-07 23:57:22 -05:00
|
|
|
extern size_t __strnlen (const char *__string, size_t __maxlen)
|
2000-05-12 07:01:25 +00:00
|
|
|
__attribute_pure__;
|
1999-11-24 20:48:27 +00:00
|
|
|
|
2012-01-07 23:57:22 -05:00
|
|
|
extern char *__strsep (char **__stringp, const char *__delim);
|
2017-10-01 16:03:28 -07:00
|
|
|
libc_hidden_proto (__strsep)
|
1999-11-24 20:48:27 +00:00
|
|
|
|
2012-01-07 23:57:22 -05:00
|
|
|
extern int __strverscmp (const char *__s1, const char *__s2)
|
2000-05-12 07:01:25 +00:00
|
|
|
__attribute_pure__;
|
1999-11-24 20:48:27 +00:00
|
|
|
|
2012-01-07 23:57:22 -05:00
|
|
|
extern int __strncasecmp (const char *__s1, const char *__s2,
|
2000-05-12 07:01:25 +00:00
|
|
|
size_t __n)
|
|
|
|
|
__attribute_pure__;
|
1999-11-24 20:48:27 +00:00
|
|
|
|
2012-01-07 23:57:22 -05:00
|
|
|
extern int __strcasecmp (const char *__s1, const char *__s2)
|
2000-10-20 06:16:38 +00:00
|
|
|
__attribute_pure__;
|
|
|
|
|
|
2012-01-07 23:57:22 -05:00
|
|
|
extern char *__strcasestr (const char *__haystack, const char *__needle)
|
2000-10-20 06:16:38 +00:00
|
|
|
__attribute_pure__;
|
|
|
|
|
|
2012-01-07 23:57:22 -05:00
|
|
|
extern char *__strdup (const char *__string)
|
2000-06-23 02:04:57 +00:00
|
|
|
__attribute_malloc__;
|
2012-01-07 23:57:22 -05:00
|
|
|
extern char *__strndup (const char *__string, size_t __n)
|
1999-12-19 19:14:15 +00:00
|
|
|
__attribute_malloc__;
|
1999-11-24 20:48:27 +00:00
|
|
|
|
2012-01-07 23:57:22 -05:00
|
|
|
extern void *__rawmemchr (const void *__s, int __c)
|
2000-05-12 07:01:25 +00:00
|
|
|
__attribute_pure__;
|
1999-11-24 20:48:27 +00:00
|
|
|
|
2012-01-07 23:57:22 -05:00
|
|
|
extern char *__strchrnul (const char *__s, int __c)
|
2000-05-12 07:01:25 +00:00
|
|
|
__attribute_pure__;
|
1999-11-24 20:48:27 +00:00
|
|
|
|
2012-01-07 23:57:22 -05:00
|
|
|
extern void *__memrchr (const void *__s, int __c, size_t __n)
|
2000-05-12 07:01:25 +00:00
|
|
|
__attribute_pure__;
|
1999-11-24 20:48:27 +00:00
|
|
|
|
2012-01-07 23:57:22 -05:00
|
|
|
extern void *__memchr (const void *__s, int __c, size_t __n)
|
2000-07-18 14:00:31 +00:00
|
|
|
__attribute_pure__;
|
2001-02-06 18:27:57 +00:00
|
|
|
|
2016-11-16 16:20:26 -05:00
|
|
|
extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1));
|
|
|
|
|
|
2001-02-06 18:27:57 +00:00
|
|
|
extern int __ffs (int __i) __attribute__ ((const));
|
|
|
|
|
|
|
|
|
|
extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen);
|
|
|
|
|
|
2020-05-14 17:44:15 -03:00
|
|
|
extern char *__strerror_l (int __errnum, locale_t __loc);
|
|
|
|
|
|
2020-05-18 17:05:05 -03:00
|
|
|
extern const char *__sigdescr_np (int __errnum);
|
|
|
|
|
libc_hidden_proto (__sigdescr_np)
|
2016-11-20 20:46:30 -05:00
|
|
|
#endif
|
2016-02-18 11:00:33 -02:00
|
|
|
|
1995-02-18 01:27:10 +00:00
|
|
|
#include <string/string.h>
|
2001-08-30 23:22:02 +00:00
|
|
|
|
2016-11-20 20:46:30 -05:00
|
|
|
#ifndef _ISOMAC
|
2002-08-27 23:36:31 +00:00
|
|
|
extern __typeof (strcoll_l) __strcoll_l;
|
|
|
|
|
extern __typeof (strxfrm_l) __strxfrm_l;
|
|
|
|
|
extern __typeof (strcasecmp_l) __strcasecmp_l;
|
|
|
|
|
extern __typeof (strncasecmp_l) __strncasecmp_l;
|
|
|
|
|
|
2001-08-30 23:22:02 +00:00
|
|
|
/* Alternative version which doesn't pollute glibc's namespace. */
|
2014-11-24 15:03:45 +05:30
|
|
|
#if IS_IN (libc)
|
2007-01-13 21:31:45 +00:00
|
|
|
# undef strndupa
|
|
|
|
|
# define strndupa(s, n) \
|
2001-08-30 23:22:02 +00:00
|
|
|
(__extension__ \
|
|
|
|
|
({ \
|
2012-01-07 23:57:22 -05:00
|
|
|
const char *__old = (s); \
|
2001-08-30 23:22:02 +00:00
|
|
|
size_t __len = __strnlen (__old, (n)); \
|
|
|
|
|
char *__new = (char *) __builtin_alloca (__len + 1); \
|
|
|
|
|
__new[__len] = '\0'; \
|
|
|
|
|
(char *) memcpy (__new, __old, __len); \
|
|
|
|
|
}))
|
2007-01-13 21:31:45 +00:00
|
|
|
#endif
|
2002-08-03 07:02:10 +00:00
|
|
|
|
|
|
|
|
libc_hidden_proto (__mempcpy)
|
2016-11-17 09:26:27 -05:00
|
|
|
#ifndef __NO_STRING_INLINES
|
|
|
|
|
# define __mempcpy(dest, src, n) __builtin_mempcpy (dest, src, n)
|
|
|
|
|
#endif
|
2002-08-04 01:22:11 +00:00
|
|
|
libc_hidden_proto (__stpcpy)
|
2016-11-17 09:26:27 -05:00
|
|
|
#ifndef __NO_STRING_INLINES
|
|
|
|
|
# define __stpcpy(dest, src) __builtin_stpcpy (dest, src)
|
|
|
|
|
#endif
|
2002-08-03 07:02:10 +00:00
|
|
|
libc_hidden_proto (__stpncpy)
|
2023-06-14 18:10:08 +02:00
|
|
|
extern __typeof (strlcpy) __strlcpy;
|
|
|
|
|
libc_hidden_proto (__strlcpy)
|
|
|
|
|
extern __typeof (strlcat) __strlcat;
|
|
|
|
|
libc_hidden_proto (__strlcat)
|
2002-08-03 07:02:10 +00:00
|
|
|
libc_hidden_proto (__rawmemchr)
|
|
|
|
|
libc_hidden_proto (__strcasecmp)
|
2002-08-03 21:19:56 +00:00
|
|
|
libc_hidden_proto (__strcasecmp_l)
|
|
|
|
|
libc_hidden_proto (__strncasecmp_l)
|
2023-02-06 13:15:22 -03:00
|
|
|
libc_hidden_proto (__strchrnul)
|
2016-11-17 09:26:27 -05:00
|
|
|
extern __typeof (strncat) __strncat;
|
|
|
|
|
libc_hidden_proto (__strncat)
|
2002-08-03 21:19:56 +00:00
|
|
|
libc_hidden_proto (__strdup)
|
|
|
|
|
libc_hidden_proto (__strndup)
|
|
|
|
|
libc_hidden_proto (__strerror_r)
|
2002-08-04 09:27:27 +00:00
|
|
|
libc_hidden_proto (__strverscmp)
|
2002-08-12 02:02:20 +00:00
|
|
|
libc_hidden_proto (basename)
|
2015-05-22 17:09:36 +00:00
|
|
|
extern char *__basename (const char *__filename) __THROW __nonnull ((1));
|
|
|
|
|
libc_hidden_proto (__basename)
|
2002-08-13 00:24:58 +00:00
|
|
|
libc_hidden_proto (strcoll)
|
2004-03-14 21:12:06 +00:00
|
|
|
libc_hidden_proto (__strcoll_l)
|
|
|
|
|
libc_hidden_proto (__strxfrm_l)
|
2004-07-10 20:00:44 +00:00
|
|
|
libc_hidden_proto (__strtok_r)
|
2012-01-07 23:57:22 -05:00
|
|
|
extern char *__strsep_g (char **__stringp, const char *__delim);
|
2004-07-10 20:00:44 +00:00
|
|
|
libc_hidden_proto (__strsep_g)
|
2005-10-24 19:31:12 +00:00
|
|
|
libc_hidden_proto (strnlen)
|
2015-06-02 20:24:25 +00:00
|
|
|
libc_hidden_proto (__strnlen)
|
2021-10-21 15:53:58 -05:00
|
|
|
libc_hidden_proto (__memcmpeq)
|
2012-10-11 14:48:32 +02:00
|
|
|
libc_hidden_proto (memmem)
|
2014-11-12 22:41:03 +00:00
|
|
|
extern __typeof (memmem) __memmem;
|
|
|
|
|
libc_hidden_proto (__memmem)
|
2013-09-20 21:24:53 +02:00
|
|
|
libc_hidden_proto (__ffs)
|
2020-05-14 17:44:15 -03:00
|
|
|
libc_hidden_proto (__strerror_l)
|
2023-02-06 15:05:56 -03:00
|
|
|
libc_hidden_proto (__memrchr)
|
2002-08-06 06:09:28 +00:00
|
|
|
|
2016-09-15 07:29:44 -04:00
|
|
|
#if IS_IN (libc)
|
|
|
|
|
/* Avoid hidden reference to IFUNC symbol __explicit_bzero_chk. */
|
|
|
|
|
void __explicit_bzero_chk_internal (void *, size_t, size_t)
|
|
|
|
|
__THROW __nonnull ((1)) attribute_hidden;
|
|
|
|
|
# define explicit_bzero(buf, len) \
|
2020-12-30 11:09:58 +05:30
|
|
|
__explicit_bzero_chk_internal (buf, len, __glibc_objsize0 (buf))
|
2016-09-15 07:29:44 -04:00
|
|
|
#elif !IS_IN (nonlib)
|
|
|
|
|
void __explicit_bzero_chk (void *, size_t, size_t) __THROW __nonnull ((1));
|
2020-12-30 11:09:58 +05:30
|
|
|
# define explicit_bzero(buf, len) __explicit_bzero_chk (buf, len, \
|
|
|
|
|
__glibc_objsize0 (buf))
|
2016-09-15 07:29:44 -04:00
|
|
|
#endif
|
|
|
|
|
|
2003-04-29 22:49:58 +00:00
|
|
|
libc_hidden_builtin_proto (memchr)
|
|
|
|
|
libc_hidden_builtin_proto (memcpy)
|
2004-05-26 17:27:20 +00:00
|
|
|
libc_hidden_builtin_proto (mempcpy)
|
2004-04-01 23:29:52 +00:00
|
|
|
libc_hidden_builtin_proto (memcmp)
|
2003-04-29 22:49:58 +00:00
|
|
|
libc_hidden_builtin_proto (memmove)
|
|
|
|
|
libc_hidden_builtin_proto (memset)
|
|
|
|
|
libc_hidden_builtin_proto (strcat)
|
|
|
|
|
libc_hidden_builtin_proto (strchr)
|
|
|
|
|
libc_hidden_builtin_proto (strcmp)
|
|
|
|
|
libc_hidden_builtin_proto (strcpy)
|
|
|
|
|
libc_hidden_builtin_proto (strcspn)
|
|
|
|
|
libc_hidden_builtin_proto (strlen)
|
|
|
|
|
libc_hidden_builtin_proto (strncmp)
|
|
|
|
|
libc_hidden_builtin_proto (strncpy)
|
|
|
|
|
libc_hidden_builtin_proto (strpbrk)
|
2004-05-26 17:27:20 +00:00
|
|
|
libc_hidden_builtin_proto (stpcpy)
|
2003-04-29 22:49:58 +00:00
|
|
|
libc_hidden_builtin_proto (strrchr)
|
|
|
|
|
libc_hidden_builtin_proto (strspn)
|
|
|
|
|
libc_hidden_builtin_proto (strstr)
|
2004-07-05 17:36:34 +00:00
|
|
|
libc_hidden_builtin_proto (ffs)
|
2003-04-29 22:49:58 +00:00
|
|
|
|
2020-11-10 23:35:19 +00:00
|
|
|
#if IS_IN (rtld)
|
2015-10-15 14:25:45 -07:00
|
|
|
extern __typeof (__stpcpy) __stpcpy attribute_hidden;
|
|
|
|
|
extern __typeof (__strdup) __strdup attribute_hidden;
|
|
|
|
|
extern __typeof (__strerror_r) __strerror_r attribute_hidden;
|
|
|
|
|
extern __typeof (__strsep_g) __strsep_g attribute_hidden;
|
|
|
|
|
|
|
|
|
|
extern __typeof (memchr) memchr attribute_hidden;
|
|
|
|
|
extern __typeof (memcmp) memcmp attribute_hidden;
|
|
|
|
|
extern __typeof (memcpy) memcpy attribute_hidden;
|
|
|
|
|
extern __typeof (memmove) memmove attribute_hidden;
|
|
|
|
|
extern __typeof (memset) memset attribute_hidden;
|
|
|
|
|
extern __typeof (rawmemchr) rawmemchr attribute_hidden;
|
|
|
|
|
extern __typeof (stpcpy) stpcpy attribute_hidden;
|
|
|
|
|
extern __typeof (strchr) strchr attribute_hidden;
|
|
|
|
|
extern __typeof (strcmp) strcmp attribute_hidden;
|
|
|
|
|
extern __typeof (strlen) strlen attribute_hidden;
|
|
|
|
|
extern __typeof (strnlen) strnlen attribute_hidden;
|
|
|
|
|
extern __typeof (strsep) strsep attribute_hidden;
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-11-24 15:03:45 +05:30
|
|
|
#if (!IS_IN (libc) || !defined SHARED) \
|
2014-11-14 13:48:39 +00:00
|
|
|
&& !defined NO_MEMPCPY_STPCPY_REDIRECT
|
2014-11-12 22:36:34 +00:00
|
|
|
/* Redirect calls to __builtin_mempcpy and __builtin_stpcpy to call
|
|
|
|
|
__mempcpy and __stpcpy if not inlined. */
|
|
|
|
|
extern __typeof (mempcpy) mempcpy __asm__ ("__mempcpy");
|
|
|
|
|
extern __typeof (stpcpy) stpcpy __asm__ ("__stpcpy");
|
|
|
|
|
#endif
|
|
|
|
|
|
2004-10-18 04:17:19 +00:00
|
|
|
extern void *__memcpy_chk (void *__restrict __dest,
|
|
|
|
|
const void *__restrict __src, size_t __len,
|
|
|
|
|
size_t __destlen) __THROW;
|
|
|
|
|
extern void *__memmove_chk (void *__dest, const void *__src, size_t __len,
|
|
|
|
|
size_t __destlen) __THROW;
|
|
|
|
|
extern void *__mempcpy_chk (void *__restrict __dest,
|
|
|
|
|
const void *__restrict __src, size_t __len,
|
|
|
|
|
size_t __destlen) __THROW;
|
|
|
|
|
extern void *__memset_chk (void *__dest, int __ch, size_t __len,
|
|
|
|
|
size_t __destlen) __THROW;
|
|
|
|
|
extern char *__strcpy_chk (char *__restrict __dest,
|
|
|
|
|
const char *__restrict __src,
|
|
|
|
|
size_t __destlen) __THROW;
|
|
|
|
|
extern char *__stpcpy_chk (char *__restrict __dest,
|
|
|
|
|
const char *__restrict __src,
|
|
|
|
|
size_t __destlen) __THROW;
|
|
|
|
|
extern char *__strncpy_chk (char *__restrict __dest,
|
|
|
|
|
const char *__restrict __src,
|
|
|
|
|
size_t __len, size_t __destlen) __THROW;
|
|
|
|
|
extern char *__strcat_chk (char *__restrict __dest,
|
|
|
|
|
const char *__restrict __src,
|
|
|
|
|
size_t __destlen) __THROW;
|
|
|
|
|
extern char *__strncat_chk (char *__restrict __dest,
|
|
|
|
|
const char *__restrict __src,
|
|
|
|
|
size_t __len, size_t __destlen) __THROW;
|
2023-04-20 14:07:52 +02:00
|
|
|
|
|
|
|
|
libc_hidden_builtin_proto (__memcpy_chk)
|
|
|
|
|
libc_hidden_builtin_proto (__memmove_chk)
|
|
|
|
|
libc_hidden_builtin_proto (__mempcpy_chk)
|
|
|
|
|
libc_hidden_builtin_proto (__memset_chk)
|
|
|
|
|
libc_hidden_builtin_proto (__stpcpy_chk)
|
2023-08-03 21:16:41 +02:00
|
|
|
libc_hidden_builtin_proto (__strncpy_chk)
|
2023-04-20 14:07:52 +02:00
|
|
|
|
2012-02-25 23:18:39 -05:00
|
|
|
#endif
|
2004-10-18 04:17:19 +00:00
|
|
|
|
2002-08-06 06:09:28 +00:00
|
|
|
#endif
|