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