8 /* Basic string functions */
10 /* Return the length of S. */
11 extern size_t strlen __P ((__const char *__s));
12 /* Append SRC onto DEST. */
13 extern char *strcat __P ((char *__restrict __dest,
14 __const char *__restrict __src));
15 /* Append no more than N characters from SRC onto DEST. */
16 extern char *strncat __P ((char *__restrict __dest,
17 __const char *__restrict __src, size_t __n));
19 /* Copy SRC to DEST. */
20 extern char *strcpy __P ((char *__restrict __dest,
21 __const char *__restrict __src));
22 extern char *stpcpy __P ((char *__restrict __dest,
23 __const char *__restrict __src));
24 /* Copy no more than N characters of SRC to DEST. */
25 extern char *strncpy __P ((char *__restrict __dest,
26 __const char *__restrict __src, size_t __n));
28 /* Compare S1 and S2. */
29 extern int strcmp __P ((__const char *__s1, __const char *__s2));
30 /* Compare N characters of S1 and S2. */
31 extern int strncmp __P ((__const char *__s1, __const char *__s2, size_t __n));
33 /* Find the first occurrence of C in S. */
34 extern char *strchr __P ((__const char *__s, int __c));
35 /* Find the last occurrence of C in S. */
36 extern char *strrchr __P ((__const char *__s, int __c));
37 /* Duplicate S, returning an identical malloc'd string. */
38 extern char *strdup __P ((__const char *__s));
40 /* Basic mem functions */
42 /* Copy N bytes of SRC to DEST. */
43 extern __ptr_t memcpy __P ((__ptr_t __restrict __dest,
44 __const __ptr_t __restrict __src, size_t __n));
45 /* Copy no more than N bytes of SRC to DEST, stopping when C is found.
46 Return the position in DEST one byte past where C was copied,
47 or NULL if C was not found in the first N bytes of SRC. */
48 extern __ptr_t memccpy __P ((__ptr_t __dest, __const __ptr_t __src,
49 int __c, size_t __n));
50 /* Search N bytes of S for C. */
51 extern __ptr_t memchr __P ((__const __ptr_t __s, int __c, size_t __n));
52 /* Set N bytes of S to C. */
53 extern __ptr_t memset __P ((__ptr_t __s, int __c, size_t __n));
54 /* Compare N bytes of S1 and S2. */
55 extern int memcmp __P ((__const __ptr_t __s1, __const __ptr_t __s2,
57 /* Copy N bytes of SRC to DEST, guaranteeing
58 correct behavior for overlapping strings. */
59 extern __ptr_t memmove __P ((__ptr_t __dest, __const __ptr_t __src,
63 /* Minimal (very!) locale support */
64 extern int strcoll __P ((__const char *__s1, __const char *__s2));
65 extern size_t strxfrm __P ((char *__restrict __dest,
66 __const char *__restrict __src, size_t __n));
69 extern char *index __P ((__const char *__s, int __c));
70 extern char *rindex __P ((__const char *__s, int __c));
72 /* Return the position of the first bit set in I, or 0 if none are set.
73 The least-significant bit is position 1, the most-significant 32. */
74 extern int ffs __P ((int __i)) __attribute__ ((const));
76 /* Other common BSD functions */
77 /* Set N bytes of S to 0. */
78 extern void bzero __P ((__ptr_t __s, size_t __n));
79 /* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
80 extern void bcopy __P ((__const __ptr_t __src, __ptr_t __dest, size_t __n));
82 /* Compare S1 and S2, ignoring case. */
83 extern int strcasecmp __P ((__const char *__s1, __const char *__s2));
84 /* Compare no more than N chars of S1 and S2, ignoring case. */
85 extern int strncasecmp __P ((__const char *__s1, __const char *__s2,
87 /* Find the first occurrence in S of any character in ACCEPT. */
88 extern char *strpbrk __P ((__const char *__s, __const char *__accept));
89 /* Return the next DELIM-delimited token from *STRINGP,
90 terminating it with a '\0', and update *STRINGP to point past it. */
91 extern char *strsep __P ((char **__restrict __stringp,
92 __const char *__restrict __delim));
93 /* Find the first occurrence of NEEDLE in HAYSTACK. */
94 extern char *strstr __P ((__const char *__haystack, __const char *__needle));
95 extern char *strcasestr __P((__const char *__haystack, __const char *__needle));
96 /* Divide S into tokens separated by characters in DELIM. */
97 extern char *strtok __P ((char *__restrict __s,
98 __const char *__restrict __delim));
99 /* Divide S into tokens separated by characters in DELIM. Information
100 passed between calls are stored in SAVE_PTR. */
101 extern char *__strtok_r __P ((char *__restrict __s,
102 __const char *__restrict __delim,
103 char **__restrict __save_ptr));
104 #if defined __USE_POSIX || defined __USE_MISC
105 extern char *strtok_r __P ((char *__restrict __s,
106 __const char *__restrict __delim,
107 char **__restrict __save_ptr));
109 /* Return the length of the initial segment of S which
110 consists entirely of characters not in REJECT. */
111 extern size_t strcspn __P ((__const char *__s, __const char *__reject));
112 /* Return the length of the initial segment of S which
113 consists entirely of characters in ACCEPT. */
114 extern size_t strspn __P ((__const char *__s, __const char *__accept));
116 /* Return a string describing the meaning of the signal number in SIG. */
117 extern char *strsignal __P ((int __sig));
119 /* More BSD compatabilty */
120 int bcmp(const void *s1, const void *s2, size_t n);
122 /* Linux silly hour */
123 char *strfry __P ((char *));
125 /* Find the length of STRING, but scan at most MAXLEN characters.
126 If no '\0' terminator is found in that many characters, return MAXLEN. */
127 extern size_t strnlen __P ((__const char *__string, size_t __maxlen));
129 /* Duplicate S, returning an identical alloca'd string. */
130 # define strdupa(s) \
133 __const char *__old = (s); \
134 size_t __len = strlen (__old) + 1; \
135 char *__new = __builtin_alloca (__len); \
136 (char *) memcpy (__new, __old, __len); \
139 /* Return an alloca'd copy of at most N bytes of string. */
140 # define strndupa(s, n) \
143 __const char *__old = (s); \
144 size_t __len = strnlen (__old, (n)); \
145 char *__new = __builtin_alloca (__len + 1); \
146 __new[__len] = '\0'; \
147 (char *) memcpy (__new, __old, __len); \