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