Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 1 | #ifndef _STRING_H |
| 2 | #define _STRING_H |
| 3 | |
| 4 | #ifdef __cplusplus |
| 5 | extern "C" { |
| 6 | #endif |
| 7 | |
Rich Felker | c1a9658 | 2012-09-07 23:13:55 -0400 | [diff] [blame] | 8 | #include <features.h> |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 9 | |
Rich Felker | c8a9c22 | 2013-11-24 21:42:55 -0500 | [diff] [blame^] | 10 | #ifdef __cplusplus |
Rich Felker | 41d7c77 | 2013-01-18 20:35:26 -0500 | [diff] [blame] | 11 | #define NULL 0L |
Rich Felker | c8a9c22 | 2013-11-24 21:42:55 -0500 | [diff] [blame^] | 12 | #else |
| 13 | #define NULL ((void*)0) |
| 14 | #endif |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 15 | |
| 16 | #define __NEED_size_t |
Rich Felker | 36bf569 | 2012-02-06 21:51:02 -0500 | [diff] [blame] | 17 | #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ |
Rich Felker | 419ae6d | 2012-05-22 21:52:08 -0400 | [diff] [blame] | 18 | || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ |
| 19 | || defined(_BSD_SOURCE) |
Rich Felker | 36bf569 | 2012-02-06 21:51:02 -0500 | [diff] [blame] | 20 | #define __NEED_locale_t |
| 21 | #endif |
| 22 | |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 23 | #include <bits/alltypes.h> |
| 24 | |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 25 | void *memcpy (void *__restrict, const void *__restrict, size_t); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 26 | void *memmove (void *, const void *, size_t); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 27 | void *memset (void *, int, size_t); |
| 28 | int memcmp (const void *, const void *, size_t); |
| 29 | void *memchr (const void *, int, size_t); |
| 30 | |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 31 | char *strcpy (char *__restrict, const char *__restrict); |
| 32 | char *strncpy (char *__restrict, const char *__restrict, size_t); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 33 | |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 34 | char *strcat (char *__restrict, const char *__restrict); |
| 35 | char *strncat (char *__restrict, const char *__restrict, size_t); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 36 | |
| 37 | int strcmp (const char *, const char *); |
| 38 | int strncmp (const char *, const char *, size_t); |
| 39 | |
| 40 | int strcoll (const char *, const char *); |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 41 | size_t strxfrm (char *__restrict, const char *__restrict, size_t); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 42 | |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 43 | char *strchr (const char *, int); |
| 44 | char *strrchr (const char *, int); |
| 45 | |
| 46 | size_t strcspn (const char *, const char *); |
| 47 | size_t strspn (const char *, const char *); |
| 48 | char *strpbrk (const char *, const char *); |
| 49 | char *strstr (const char *, const char *); |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 50 | char *strtok (char *__restrict, const char *__restrict); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 51 | |
| 52 | size_t strlen (const char *); |
| 53 | |
| 54 | char *strerror (int); |
Rich Felker | ca1aa5b | 2011-02-14 20:53:15 -0500 | [diff] [blame] | 55 | |
Rich Felker | 419ae6d | 2012-05-22 21:52:08 -0400 | [diff] [blame] | 56 | #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) |
| 57 | #include <strings.h> |
| 58 | #endif |
Rich Felker | ca1aa5b | 2011-02-14 20:53:15 -0500 | [diff] [blame] | 59 | |
| 60 | #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ |
Rich Felker | 419ae6d | 2012-05-22 21:52:08 -0400 | [diff] [blame] | 61 | || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ |
| 62 | || defined(_BSD_SOURCE) |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 63 | char *strtok_r (char *__restrict, const char *__restrict, char **__restrict); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 64 | int strerror_r (int, char *, size_t); |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 65 | char *stpcpy(char *__restrict, const char *__restrict); |
| 66 | char *stpncpy(char *__restrict, const char *__restrict, size_t); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 67 | size_t strnlen (const char *, size_t); |
Rich Felker | ca1aa5b | 2011-02-14 20:53:15 -0500 | [diff] [blame] | 68 | char *strdup (const char *); |
| 69 | char *strndup (const char *, size_t); |
Rich Felker | 2a195dd | 2011-02-26 23:50:26 -0500 | [diff] [blame] | 70 | char *strsignal(int); |
Rich Felker | 36bf569 | 2012-02-06 21:51:02 -0500 | [diff] [blame] | 71 | char *strerror_l (int, locale_t); |
| 72 | int strcoll_l (const char *, const char *, locale_t); |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 73 | size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t); |
Rich Felker | ca1aa5b | 2011-02-14 20:53:15 -0500 | [diff] [blame] | 74 | #endif |
| 75 | |
Rich Felker | 419ae6d | 2012-05-22 21:52:08 -0400 | [diff] [blame] | 76 | #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ |
| 77 | || defined(_BSD_SOURCE) |
Rich Felker | 400c5e5 | 2012-09-06 22:44:55 -0400 | [diff] [blame] | 78 | void *memccpy (void *__restrict, const void *__restrict, int, size_t); |
Rich Felker | 73d310e | 2011-02-24 12:36:04 -0500 | [diff] [blame] | 79 | #endif |
| 80 | |
Rich Felker | e2f6a32 | 2012-09-13 21:01:30 -0400 | [diff] [blame] | 81 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
| 82 | char *strsep(char **, const char *); |
Rich Felker | ca1aa5b | 2011-02-14 20:53:15 -0500 | [diff] [blame] | 83 | size_t strlcat (char *, const char *, size_t); |
| 84 | size_t strlcpy (char *, const char *, size_t); |
| 85 | #endif |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 86 | |
| 87 | #ifdef _GNU_SOURCE |
Rich Felker | 419ae6d | 2012-05-22 21:52:08 -0400 | [diff] [blame] | 88 | #define strdupa(x) strcpy(alloca(strlen(x)+1),x) |
Rich Felker | a654017 | 2011-09-11 22:45:56 -0400 | [diff] [blame] | 89 | int strverscmp (const char *, const char *); |
Rich Felker | 419ae6d | 2012-05-22 21:52:08 -0400 | [diff] [blame] | 90 | int strcasecmp_l (const char *, const char *, locale_t); |
| 91 | int strncasecmp_l (const char *, const char *, size_t, locale_t); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 92 | char *strchrnul(const char *, int); |
Rich Felker | 26f3551 | 2011-02-15 16:08:19 -0500 | [diff] [blame] | 93 | char *strcasestr(const char *, const char *); |
Rich Felker | c86f297 | 2012-10-15 23:02:57 -0400 | [diff] [blame] | 94 | void *memmem(const void *, size_t, const void *, size_t); |
Rich Felker | 6597f9a | 2011-04-13 08:36:29 -0400 | [diff] [blame] | 95 | void *memrchr(const void *, int, size_t); |
Rich Felker | b5b4121 | 2011-04-26 12:28:41 -0400 | [diff] [blame] | 96 | void *mempcpy(void *, const void *, size_t); |
Rich Felker | 37bb3cc | 2012-05-09 11:47:06 -0400 | [diff] [blame] | 97 | #ifndef __cplusplus |
Rich Felker | 06aec8d | 2012-02-24 23:23:47 -0500 | [diff] [blame] | 98 | char *basename(); |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 99 | #endif |
Rich Felker | 37bb3cc | 2012-05-09 11:47:06 -0400 | [diff] [blame] | 100 | #endif |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 101 | |
| 102 | #ifdef __cplusplus |
| 103 | } |
| 104 | #endif |
| 105 | |
| 106 | #endif |