remove dependency of memmove on memcpy direction
[musl] / include / string.h
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
16 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
17  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
18  || defined(_BSD_SOURCE)
19 #define __NEED_locale_t
20 #endif
21
22 #include <bits/alltypes.h>
23
24 void *memcpy (void *, const void *, size_t);
25 void *memmove (void *, const void *, size_t);
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
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 *);
49 char *strtok (char *, const char *);
50
51 size_t strlen (const char *);
52
53 char *strerror (int);
54
55 #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
56 #include <strings.h>
57 #endif
58
59 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
60  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
61  || defined(_BSD_SOURCE)
62 char *strtok_r (char *, const char *, char **);
63 int strerror_r (int, char *, size_t);
64 char *stpcpy(char *, const char *);
65 char *stpncpy(char *, const char *, size_t);
66 size_t strnlen (const char *, size_t);
67 char *strdup (const char *);
68 char *strndup (const char *, size_t);
69 char *strsignal(int);
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);
73 #endif
74
75 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
76  || defined(_BSD_SOURCE)
77 void *memccpy (void *, const void *, int, size_t);
78 #endif
79
80 #ifdef _BSD_SOURCE
81 size_t strlcat (char *, const char *, size_t);
82 size_t strlcpy (char *, const char *, size_t);
83 #endif
84
85 #ifdef _GNU_SOURCE
86 #define strdupa(x)      strcpy(alloca(strlen(x)+1),x)
87 int strverscmp (const char *, const char *);
88 int strcasecmp_l (const char *, const char *, locale_t);
89 int strncasecmp_l (const char *, const char *, size_t, locale_t);
90 char *strchrnul(const char *, int);
91 char *strcasestr(const char *, const char *);
92 char *strsep(char **, const char *);
93 void *memrchr(const void *, int, size_t);
94 void *mempcpy(void *, const void *, size_t);
95 #ifndef __cplusplus
96 char *basename();
97 #endif
98 #endif
99
100 #ifdef __cplusplus
101 }
102 #endif
103
104 #endif