riscv64: add vfork
[musl.git] / include / string.h
blobdb73d2a92056200090fac44ed3898dc4c9a29128
1 #ifndef _STRING_H
2 #define _STRING_H
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
8 #include <features.h>
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
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
25 #include <bits/alltypes.h>
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);
33 char *strcpy (char *__restrict, const char *__restrict);
34 char *strncpy (char *__restrict, const char *__restrict, size_t);
36 char *strcat (char *__restrict, const char *__restrict);
37 char *strncat (char *__restrict, const char *__restrict, size_t);
39 int strcmp (const char *, const char *);
40 int strncmp (const char *, const char *, size_t);
42 int strcoll (const char *, const char *);
43 size_t strxfrm (char *__restrict, const char *__restrict, size_t);
45 char *strchr (const char *, int);
46 char *strrchr (const char *, int);
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);
54 size_t strlen (const char *);
56 char *strerror (int);
58 #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
59 #include <strings.h>
60 #endif
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 void *memmem(const void *, size_t, const void *, size_t);
77 #endif
79 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
80 || defined(_BSD_SOURCE)
81 void *memccpy (void *__restrict, const void *__restrict, int, size_t);
82 #endif
84 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
85 char *strsep(char **, const char *);
86 size_t strlcat (char *, const char *, size_t);
87 size_t strlcpy (char *, const char *, size_t);
88 void explicit_bzero (void *, size_t);
89 #endif
91 #ifdef _GNU_SOURCE
92 #define strdupa(x) strcpy(alloca(strlen(x)+1),x)
93 int strverscmp (const char *, const char *);
94 char *strchrnul(const char *, int);
95 char *strcasestr(const char *, const char *);
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
103 #ifdef __cplusplus
105 #endif
107 #endif