2.5-18.1
[glibc.git] / include / string.h
blobc196007dcb04339ab2498ebdccfe84a2e9ddd01d
1 #ifndef _STRING_H
3 #include <sys/types.h>
5 extern void *__memccpy (void *__dest, __const void *__src,
6 int __c, size_t __n);
8 extern size_t __strnlen (__const char *__string, size_t __maxlen)
9 __attribute_pure__;
11 extern char *__strsep (char **__stringp, __const char *__delim);
13 extern int __strverscmp (__const char *__s1, __const char *__s2)
14 __attribute_pure__;
16 extern int __strncasecmp (__const char *__s1, __const char *__s2,
17 size_t __n)
18 __attribute_pure__;
20 extern int __strcasecmp (__const char *__s1, __const char *__s2)
21 __attribute_pure__;
23 extern char *__strcasestr (__const char *__haystack, __const char *__needle)
24 __attribute_pure__;
26 extern char *__strdup (__const char *__string)
27 __attribute_malloc__;
28 extern char *__strndup (__const char *__string, size_t __n)
29 __attribute_malloc__;
31 extern void *__rawmemchr (__const void *__s, int __c)
32 __attribute_pure__;
34 extern char *__strchrnul (__const char *__s, int __c)
35 __attribute_pure__;
37 extern void *__memrchr (__const void *__s, int __c, size_t __n)
38 __attribute_pure__;
40 extern void *__memchr (__const void *__s, int __c, size_t __n)
41 __attribute_pure__;
43 extern int __ffs (int __i) __attribute__ ((const));
45 extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen);
47 /* Now the real definitions. We do this here since some of the functions
48 above are defined as macros in the headers. */
49 #include <string/string.h>
51 extern __typeof (strcoll_l) __strcoll_l;
52 extern __typeof (strxfrm_l) __strxfrm_l;
53 extern __typeof (strcasecmp_l) __strcasecmp_l;
54 extern __typeof (strncasecmp_l) __strncasecmp_l;
56 /* Alternative version which doesn't pollute glibc's namespace. */
57 #undef strndupa
58 #define strndupa(s, n) \
59 (__extension__ \
60 ({ \
61 __const char *__old = (s); \
62 size_t __len = __strnlen (__old, (n)); \
63 char *__new = (char *) __builtin_alloca (__len + 1); \
64 __new[__len] = '\0'; \
65 (char *) memcpy (__new, __old, __len); \
66 }))
68 libc_hidden_proto (__mempcpy)
69 libc_hidden_proto (__stpcpy)
70 libc_hidden_proto (__stpncpy)
71 libc_hidden_proto (__rawmemchr)
72 libc_hidden_proto (__strcasecmp)
73 libc_hidden_proto (__strcasecmp_l)
74 libc_hidden_proto (__strncasecmp_l)
75 libc_hidden_proto (__strdup)
76 libc_hidden_proto (__strndup)
77 libc_hidden_proto (__strerror_r)
78 libc_hidden_proto (__strverscmp)
79 libc_hidden_proto (basename)
80 libc_hidden_proto (strcoll)
81 libc_hidden_proto (__strcoll_l)
82 libc_hidden_proto (__strxfrm_l)
83 libc_hidden_proto (__strtok_r)
84 extern char *__strsep_g (char **__stringp, __const char *__delim);
85 libc_hidden_proto (__strsep_g)
86 libc_hidden_proto (strnlen)
88 libc_hidden_builtin_proto (memchr)
89 libc_hidden_builtin_proto (memcpy)
90 libc_hidden_builtin_proto (mempcpy)
91 libc_hidden_builtin_proto (memcmp)
92 libc_hidden_builtin_proto (memmove)
93 libc_hidden_builtin_proto (memset)
94 libc_hidden_builtin_proto (strcat)
95 libc_hidden_builtin_proto (strchr)
96 libc_hidden_builtin_proto (strcmp)
97 libc_hidden_builtin_proto (strcpy)
98 libc_hidden_builtin_proto (strcspn)
99 libc_hidden_builtin_proto (strlen)
100 libc_hidden_builtin_proto (strncmp)
101 libc_hidden_builtin_proto (strncpy)
102 libc_hidden_builtin_proto (strpbrk)
103 libc_hidden_builtin_proto (stpcpy)
104 libc_hidden_builtin_proto (strrchr)
105 libc_hidden_builtin_proto (strspn)
106 libc_hidden_builtin_proto (strstr)
107 libc_hidden_builtin_proto (ffs)
109 # ifndef _ISOMAC
110 # ifndef index
111 # define index(s, c) (strchr ((s), (c)))
112 # endif
113 # ifndef rindex
114 # define rindex(s, c) (strrchr ((s), (c)))
115 # endif
116 # endif
118 extern void *__memcpy_chk (void *__restrict __dest,
119 const void *__restrict __src, size_t __len,
120 size_t __destlen) __THROW;
121 extern void *__memmove_chk (void *__dest, const void *__src, size_t __len,
122 size_t __destlen) __THROW;
123 extern void *__mempcpy_chk (void *__restrict __dest,
124 const void *__restrict __src, size_t __len,
125 size_t __destlen) __THROW;
126 extern void *__memset_chk (void *__dest, int __ch, size_t __len,
127 size_t __destlen) __THROW;
128 extern char *__strcpy_chk (char *__restrict __dest,
129 const char *__restrict __src,
130 size_t __destlen) __THROW;
131 extern char *__stpcpy_chk (char *__restrict __dest,
132 const char *__restrict __src,
133 size_t __destlen) __THROW;
134 extern char *__strncpy_chk (char *__restrict __dest,
135 const char *__restrict __src,
136 size_t __len, size_t __destlen) __THROW;
137 extern char *__strcat_chk (char *__restrict __dest,
138 const char *__restrict __src,
139 size_t __destlen) __THROW;
140 extern char *__strncat_chk (char *__restrict __dest,
141 const char *__restrict __src,
142 size_t __len, size_t __destlen) __THROW;
144 #endif