4 * Definitions for memory and string functions.
11 #include <sys/reent.h>
12 #include <sys/cdefs.h>
13 #include <sys/features.h>
19 #if __POSIX_VISIBLE >= 200809
20 #include <sys/_locale.h>
29 void * memchr (const void *, int, size_t);
30 int memcmp (const void *, const void *, size_t);
31 void * memcpy (void *__restrict
, const void *__restrict
, size_t);
32 void * memmove (void *, const void *, size_t);
33 void * memset (void *, int, size_t);
34 char *strcat (char *__restrict
, const char *__restrict
);
35 char *strchr (const char *, int);
36 int strcmp (const char *, const char *);
37 int strcoll (const char *, const char *);
38 char *strcpy (char *__restrict
, const char *__restrict
);
39 size_t strcspn (const char *, const char *);
41 size_t strlen (const char *);
42 char *strncat (char *__restrict
, const char *__restrict
, size_t);
43 int strncmp (const char *, const char *, size_t);
44 char *strncpy (char *__restrict
, const char *__restrict
, size_t);
45 char *strpbrk (const char *, const char *);
46 char *strrchr (const char *, int);
47 size_t strspn (const char *, const char *);
48 char *strstr (const char *, const char *);
50 char *strtok (char *__restrict
, const char *__restrict
);
52 size_t strxfrm (char *__restrict
, const char *__restrict
, size_t);
54 #if __POSIX_VISIBLE >= 200809
55 int strcoll_l (const char *, const char *, locale_t
);
56 char *strerror_l (int, locale_t
);
57 size_t strxfrm_l (char *__restrict
, const char *__restrict
, size_t, locale_t
);
59 #if __MISC_VISIBLE || __POSIX_VISIBLE
60 char *strtok_r (char *__restrict
, const char *__restrict
, char **__restrict
);
63 int timingsafe_bcmp (const void *, const void *, size_t);
64 int timingsafe_memcmp (const void *, const void *, size_t);
66 #if __MISC_VISIBLE || __POSIX_VISIBLE
67 void * memccpy (void *__restrict
, const void *__restrict
, int, size_t);
70 void * mempcpy (void *, const void *, size_t);
71 void * memmem (const void *, size_t, const void *, size_t);
72 void * memrchr (const void *, int, size_t);
73 void * rawmemchr (const void *, int);
75 #if __POSIX_VISIBLE >= 200809
76 char *stpcpy (char *__restrict
, const char *__restrict
);
77 char *stpncpy (char *__restrict
, const char *__restrict
, size_t);
80 char *strcasestr (const char *, const char *);
81 char *strchrnul (const char *, int);
83 #if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 4
84 char *strdup (const char *) __malloc_like __result_use_check
;
86 char *_strdup_r (struct _reent
*, const char *);
87 #if __POSIX_VISIBLE >= 200809
88 char *strndup (const char *, size_t) __malloc_like __result_use_check
;
90 char *_strndup_r (struct _reent
*, const char *, size_t);
92 /* There are two common strerror_r variants. If you request
93 _GNU_SOURCE, you get the GNU version; otherwise you get the POSIX
94 version. POSIX requires that #undef strerror_r will still let you
95 invoke the underlying function, but that requires gcc support. */
97 char *strerror_r (int, char *, size_t);
98 #elif __POSIX_VISIBLE >= 200112
100 int strerror_r (int, char *, size_t)
102 __asm__ (__ASMNAME ("__xpg_strerror_r"))
106 int __xpg_strerror_r (int, char *, size_t);
107 # define strerror_r __xpg_strerror_r
111 /* Reentrant version of strerror. */
112 char * _strerror_r (struct _reent
*, int, int, int *);
115 size_t strlcat (char *, const char *, size_t);
116 size_t strlcpy (char *, const char *, size_t);
118 #if __POSIX_VISIBLE >= 200809
119 size_t strnlen (const char *, size_t);
122 char *strsep (char **, const char *);
125 char *strnstr(const char *, const char *, size_t) __pure
;
129 char *strlwr (char *);
130 char *strupr (char *);
133 #if __POSIX_VISIBLE >= 200809
134 char *strsignal (int __signo
);
138 int strtosigno (const char *__name
);
142 int strverscmp (const char *, const char *);
145 #if __GNU_VISIBLE && defined(__GNUC__)
146 #define strdupa(__s) \
147 (__extension__ ({const char *__sin = (__s); \
148 size_t __len = strlen (__sin) + 1; \
149 char * __sout = (char *) __builtin_alloca (__len); \
150 (char *) memcpy (__sout, __sin, __len);}))
151 #define strndupa(__s, __n) \
152 (__extension__ ({const char *__sin = (__s); \
153 size_t __len = strnlen (__sin, (__n)) + 1; \
154 char *__sout = (char *) __builtin_alloca (__len); \
155 __sout[__len-1] = '\0'; \
156 (char *) memcpy (__sout, __sin, __len-1);}))
157 #endif /* __GNU_VISIBLE && __GNUC__ */
159 /* There are two common basename variants. If you do NOT #include <libgen.h>
165 you get the GNU version. Otherwise you get the POSIX versionfor which you
166 should #include <libgen.h>i for the function prototype. POSIX requires that
167 #undef basename will still let you invoke the underlying function. However,
168 this also implies that the POSIX version is used in this case. That's made
170 #if __GNU_VISIBLE && !defined(basename)
171 # define basename basename
172 char *__nonnull ((1)) basename (const char *) __asm__(__ASMNAME("__gnu_basename"));
175 #include <sys/string.h>
179 #if __SSP_FORTIFY_LEVEL > 0
180 #include <ssp/string.h>
183 #endif /* _STRING_H_ */