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