| 1 | #ifndef	_STRING_H |
| 2 | #define	_STRING_H |
| 3 | |
| 4 | #ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */ |
| 5 | #else |
| 6 | #include <__header_string.h> |
| 7 | #endif |
| 8 | #ifdef __cplusplus |
| 9 | extern "C" { |
| 10 | #endif |
| 11 | |
| 12 | #include <features.h> |
| 13 | |
| 14 | #ifdef __wasilibc_unmodified_upstream /* Use the compiler's definition of NULL */ |
| 15 | #if __cplusplus >= 201103L |
| 16 | #define NULL nullptr |
| 17 | #elif defined(__cplusplus) |
| 18 | #define NULL 0L |
| 19 | #else |
| 20 | #define NULL ((void*)0) |
| 21 | #endif |
| 22 | #else |
| 23 | #define __need_NULL |
| 24 | #include <stddef.h> |
| 25 | #endif |
| 26 | |
| 27 | #define __NEED_size_t |
| 28 | #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ |
| 29 | || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ |
| 30 | || defined(_BSD_SOURCE) |
| 31 | #define __NEED_locale_t |
| 32 | #endif |
| 33 | |
| 34 | #include <bits/alltypes.h> |
| 35 | |
| 36 | #ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */ |
| 37 | void *memcpy (void *__restrict, const void *__restrict, size_t); |
| 38 | void *memmove (void *, const void *, size_t); |
| 39 | void *memset (void *, int, size_t); |
| 40 | #endif |
| 41 | int memcmp (const void *, const void *, size_t); |
| 42 | #ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */ |
| 43 | void *memchr (const void *, int, size_t); |
| 44 | #endif |
| 45 | |
| 46 | char *strcpy (char *__restrict, const char *__restrict); |
| 47 | char *strncpy (char *__restrict, const char *__restrict, size_t); |
| 48 | |
| 49 | char *strcat (char *__restrict, const char *__restrict); |
| 50 | char *strncat (char *__restrict, const char *__restrict, size_t); |
| 51 | |
| 52 | #ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */ |
| 53 | int strcmp (const char *, const char *); |
| 54 | #endif |
| 55 | int strncmp (const char *, const char *, size_t); |
| 56 | |
| 57 | int strcoll (const char *, const char *); |
| 58 | size_t strxfrm (char *__restrict, const char *__restrict, size_t); |
| 59 | |
| 60 | char *strchr (const char *, int); |
| 61 | char *strrchr (const char *, int); |
| 62 | |
| 63 | size_t strcspn (const char *, const char *); |
| 64 | size_t strspn (const char *, const char *); |
| 65 | char *strpbrk (const char *, const char *); |
| 66 | char *strstr (const char *, const char *); |
| 67 | char *strtok (char *__restrict, const char *__restrict); |
| 68 | |
| 69 | #ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */ |
| 70 | size_t strlen (const char *); |
| 71 | #endif |
| 72 | |
| 73 | char *strerror (int); |
| 74 | |
| 75 | #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) |
| 76 | #include <strings.h> |
| 77 | #endif |
| 78 | |
| 79 | #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ |
| 80 | || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ |
| 81 | || defined(_BSD_SOURCE) |
| 82 | char *strtok_r (char *__restrict, const char *__restrict, char **__restrict); |
| 83 | int strerror_r (int, char *, size_t); |
| 84 | char *stpcpy(char *__restrict, const char *__restrict); |
| 85 | char *stpncpy(char *__restrict, const char *__restrict, size_t); |
| 86 | size_t strnlen (const char *, size_t); |
| 87 | #ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */ |
| 88 | char *strdup (const char *); |
| 89 | #endif |
| 90 | char *strndup (const char *, size_t); |
| 91 | char *strsignal(int); |
| 92 | char *strerror_l (int, locale_t); |
| 93 | int strcoll_l (const char *, const char *, locale_t); |
| 94 | size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t); |
| 95 | void *memmem(const void *, size_t, const void *, size_t); |
| 96 | #endif |
| 97 | |
| 98 | #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ |
| 99 | || defined(_BSD_SOURCE) |
| 100 | void *memccpy (void *__restrict, const void *__restrict, int, size_t); |
| 101 | #endif |
| 102 | |
| 103 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
| 104 | char *strsep(char **, const char *); |
| 105 | size_t strlcat (char *, const char *, size_t); |
| 106 | size_t strlcpy (char *, const char *, size_t); |
| 107 | void explicit_bzero (void *, size_t); |
| 108 | #endif |
| 109 | |
| 110 | #ifdef _GNU_SOURCE |
| 111 | #define	strdupa(x)	strcpy(alloca(strlen(x)+1),x) |
| 112 | int strverscmp (const char *, const char *); |
| 113 | char *strchrnul(const char *, int); |
| 114 | char *strcasestr(const char *, const char *); |
| 115 | void *memrchr(const void *, int, size_t); |
| 116 | void *mempcpy(void *, const void *, size_t); |
| 117 | #endif |
| 118 | |
| 119 | #ifdef __cplusplus |
| 120 | } |
| 121 | #endif |
| 122 | |
| 123 | #endif |