• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * @defgroup libc Libc
3  * @defgroup string String
4  * @ingroup libc
5  */
6 
7 #ifndef	_STRING_H
8 #define	_STRING_H
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 #include <features.h>
15 
16 #ifdef __cplusplus
17 #define NULL 0L
18 #else
19 #ifndef NULL
20 #define NULL ((void*)0)
21 #endif
22 #endif
23 
24 #define __NEED_size_t
25 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
26  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
27  || defined(_BSD_SOURCE)
28 #define __NEED_locale_t
29 #endif
30 
31 #include <bits/alltypes.h>
32 
33 /**
34  * @ingroup  string
35  *
36  * @par Description:
37  * The memcpy() function copies n bytes from memory area src to memory area dest.
38  * The memory areas must not overlap.
39  *
40  * @attention
41  * <ul>
42  * <li>None.</li>
43  * </ul>
44  *
45  * @retval #void* The memcpy() function returns a pointer to dest.
46  *
47  * @par Dependency:
48  * <ul><li>string.h</li></ul>
49  * @see  memmove | strcpy | strncpy | wmemcpy
50  */
51 void *memcpy (void *__restrict, const void *__restrict, size_t);
52 
53 /**
54  * @ingroup  string
55  *
56  * @par Description:
57  * The memmove() function copies n bytes from memory area src to memory area dest.
58  * The memory areas may overlap: copying takes place as though the bytes in src are
59  * first copied into a temporary array that does not overlap src or dest, and
60  * the bytes are then copied from the temporary array to dest.
61  *
62  * @attention
63  * <ul>
64  * <li>None.</li>
65  * </ul>
66  *
67  * @retval #void* The memmove() function returns a pointer to dest.
68  *
69  * @par Dependency:
70  * <ul><li>string.h</li></ul>
71  * @see  strcpy | strncpy | wmemcpy
72  */
73 void *memmove (void *, const void *, size_t);
74 
75 /**
76  * @ingroup  string
77  *
78  * @par Description:
79  * The memset() function fills the first n bytes of the memory area
80  * pointed to by s with the constant byte c.
81  *
82  * @attention
83  * <ul>
84  * <li>None.</li>
85  * </ul>
86  *
87  * @retval #void* The memset() function returns a pointer to the memory area s.
88  *
89  * @par Dependency:
90  * <ul><li>string.h</li></ul>
91  * @see  wmemset
92  */
93 void *memset (void *, int, size_t);
94 
95 /**
96  * @ingroup  string
97  *
98  * @par Description:
99  * The memcmp() function compares the first n bytes (each interpreted as unsigned char)
100  * of the memory areas s1 and s2.
101  *
102  * @attention
103  * <ul>
104  * <li>None.</li>
105  * </ul>
106  *
107  * @retval #int The memcmp() function returns 0 if the parameters s1 and s2 are identical.
108  * If s1 is greater than s2, a value greater than 0 is returned.
109  * If s1 is less than s2, a value less than 0 is returned.
110  *
111  * @par Dependency:
112  * <ul><li>string.h</li></ul>
113  * @see  strcasecmp | strcmp | strcoll | strncasecmp | strncmp | wmemcmp
114  */
115 int memcmp (const void *, const void *, size_t);
116 
117 /**
118  * @ingroup  string
119  *
120  * @par Description:
121  * The memchr() function scans the initial n bytes of the memory area
122  * pointed to by src for the first instance of c. Both c and the bytes of
123  * the memory area pointed to by src are interpreted as unsigned char.
124  *
125  * @attention
126  * <ul>
127  * <li>None.</li>
128  * </ul>
129  *
130  * @retval #void* The memchr() function returns a pointer to the matching
131  *         byte or NULL if the character does not occur in the given memory
132  *         area.
133  *
134  * @par Dependency:
135  * <ul><li>string.h</li></ul>
136  * @see strchr | strpbrk | strrchr | strsep | strspn | strstr | wmemchr
137  */
138 void *memchr (const void *, int, size_t);
139 
140 /**
141  * @ingroup  string
142  *
143  * @par Description:
144  * The strcpy() function copies the string pointed to by from, including
145  * the terminating null byte ("\0"), to the buffer pointed to by to.
146  * The strings may not overlap, and the destination string to must be
147  * large enough to receive the copy. Beware of buffer overruns!
148  *
149  * @attention
150  * <ul>
151  * <li>None.</li>
152  * </ul>
153  *
154  * @retval #char* The function returns a pointer to the resulting string to.
155  *
156  * @par Dependency:
157  * <ul><li>string.h</li></ul>
158  * @see  memcpy | stpcpy | strdup
159  */
160 char *strcpy (char *__restrict, const char *__restrict);
161 
162 /**
163  * @ingroup  string
164  *
165  * @par Description:
166  * The strncpy() function shall copy not more than n
167  * bytes (bytes that follow a NUL character are not copied) from the
168  * array pointed to by src to the array pointed to by dst.
169  * If the array pointed to by src is a string that is shorter than n
170  * bytes, NUL characters shall be appended to the copy in the array
171  * pointed to by dst, until n bytes in all are written.
172  *
173  * @attention
174  * <ul>
175  * <li>None.</li>
176  * </ul>
177  *
178  * @retval #char* The strncpy() function shall return dst.
179  *
180  * @par Dependency:
181  * <ul><li>string.h</li></ul>
182  * @see  strcpy | wcsncpy
183  */
184 char *strncpy (char *__restrict, const char *__restrict, size_t);
185 
186 /**
187  * @ingroup  string
188  *
189  * @par Description:
190  * The strcat() function appends the src string to the dst string,
191  * overwriting the terminating null byte ("\0") at the end of dst, and
192  * then adds a terminating null byte. The strings may not overlap, and
193  * the dst string must have enough space for the result. If dst is
194  * not large enough, program behavior is unpredictable.
195  *
196  * @attention
197  * <ul>
198  * <li>None.</li>
199  * </ul>
200  *
201  * @retval #char* The function returns a pointer to the resulting string dst.
202  *
203  * @par Dependency:
204  * <ul><li>string.h</li></ul>
205  * @see  memcpy | strcpy | strncpy
206  */
207 char *strcat (char *__restrict, const char *__restrict);
208 
209 /**
210  * @ingroup  string
211  *
212  * @par Description:
213  * The strncat() function will use at most n bytes from src and src does not
214  * need to be null-terminated if it contains n or more bytes. As with strcat(),
215  * the resulting string in dst is always null-terminated. If src contains n or more bytes,
216  * strncat() writes n+1 bytes to dst(n from src plus the terminating null byte).
217  * Therefore, the size of dst must be at least strlen(dst)+n+1.
218  *
219  * @attention
220  * <ul>
221  * <li>None.</li>
222  * </ul>
223  *
224  * @retval #char* The strncat() function returns pointer to the
225  *       resulting string dst.
226  *
227  * @par Dependency:
228  * <ul><li>string.h</li></ul>
229  * @see  memcpy | strcpy | strncpy
230  */
231 char *strncat (char *__restrict, const char *__restrict, size_t);
232 
233 /**
234  * @ingroup  string
235  *
236  * @par Description:
237  * The strcmp() function shall compare the string pointed to by s1 to the
238  * string pointed to by s2. The sign of a non-zero return value shall be
239  * determined by the sign of the difference between the values of the first
240  * pair of bytes (both interpreted as type unsigned char) that differ in the
241  * strings being compared.
242  *
243  * @attention
244  * <ul>
245  * <li>None.</li>
246  * </ul>
247  *
248  * @retval #int Upon completion, strcmp() shall return an integer greater than,
249  * equal to, or less than 0, if the string pointed to by s1 is greater than, equal to,
250  * or less than the string pointed to by s2, respectively.
251  *
252  * @par Dependency:
253  * <ul><li>string.h</li></ul>
254  * @see  strncmp
255  */
256 int strcmp (const char *, const char *);
257 
258 /**
259  * @ingroup  string
260  *
261  * @par Description:
262  * The strncmp() function compares only the first (at most) n bytes of s1 and s2.
263  * It returns an integer less than, equal to, or greater than zero if s1 is found,
264  * respectively, to be less than, to match, or be greater than s2.
265  *
266  * @attention
267  * <ul>
268  * <li>None.</li>
269  * </ul>
270  *
271  * @retval #int The strncmp() function returns an integer less than,
272  *       equal to, or greater than zero if s1 (or the first n bytes thereof)
273  *       is found, respectively, to be less than, to match, or be greater than
274  *       s2.
275  *
276  * @par Dependency:
277  * <ul><li>string.h</li></ul>
278  * @see  memcmp | strcasecmp | strcoll | strncasecmp | wcscmp | wcsncmp
279  */
280 int strncmp (const char *, const char *, size_t);
281 
282 /**
283  * @ingroup  string
284  *
285  * @par Description:
286  * The strcoll() function compares the two strings s1 and s2. It
287  * returns an integer less than, equal to, or greater than zero if s1 is
288  * found, respectively, to be less than, to match, or be greater than s2.
289  *
290  * @attention
291  * <ul>
292  * <li>Liteos does not compare strings according to the order in which
293  * text is specified by LC_COLLATE.</li>
294  * </ul>
295  *
296  * @retval #int The strcoll() function returns an integer less than, equal to, or
297  *       greater than zero if s1 is found, respectively, to be less than, to
298  *       match, or be greater than s2, when both are interpreted as
299  *       appropriate for the current locale.
300  *
301  * @par Dependency:
302  * <ul><li>string.h</li></ul>
303  * @see  memcmp | setlocale | strcasecmp | strcmp | strxfrm
304  */
305 int strcoll (const char *, const char *);
306 
307 /**
308  * @ingroup  string
309  *
310  * @par Description:
311  *
312  * The strxfrm() function Transforms the string src and places the result into dst. It copies at most
313  * n characters into dst including the null terminating character. The
314  * transformation occurs such that strcmp applied to two separate converted
315  * strings returns the same value as strcoll applied to the same two strings. If
316  * overlapping occurs, the result is undefined.
317  *
318  * @attention
319  * <ul>
320  * <li>None.</li>
321  * </ul>
322  *
323  * @retval #size_t The strxfrm() function returns the number of bytes required to store
324  * the transformed string in dst excluding the terminating null byte
325  * ("\0"). If the value returned is n or more, the contents of dst are
326  * indeterminate.
327  *
328  * @par Dependency:
329  * <ul><li>string.h</li></ul>
330  * @see  memcmp | setlocale | strcasecmp | strcmp | strcoll
331  */
332 size_t strxfrm (char *__restrict, const char *__restrict, size_t);
333 
334 /**
335  * @ingroup  string
336  *
337  * @par Description:
338  * The strchr() function returns a pointer to the first occurrence of the character c in the string s.
339  *
340  * @attention
341  * <ul>
342  * <li>None.</li>
343  * </ul>
344  *
345  * @retval #char* Upon completion, strchr() shall return a pointer to the byte, or a null pointer
346  * if the byte was not found.
347  *
348  * @par Dependency:
349  * <ul><li>string.h</li></ul>
350  * @see  memcpy | memmove | stpcpy | strdup | wcsncpy
351  */
352 char *strchr (const char *, int);
353 
354 /**
355  * @ingroup  string
356  *
357  * @par Description:
358  * The strrchr() function returns a pointer to the last occurrence of
359  * the character c in the string s.
360  *
361  * @attention
362  * <ul>
363  * <li>None.</li>
364  * </ul>
365  *
366  * @retval #char* The strrchr() function returns a pointer to the matched
367  *       character or NULL if the character is not found. The terminating
368  *       null byte is considered part of the string, so that if c is specified
369  *       as "\0", the function returns a pointer to the terminator.
370  *
371  *
372  * @par Dependency:
373  * <ul><li>string.h</li></ul>
374  * @see  memchr | strlen | strpbrk | strsep | strspn | strstr | strtok | wcschr
375  */
376 char *strrchr (const char *, int);
377 
378 /**
379  * @ingroup  string
380  *
381  * @par Description:
382  * The strcspn() function calculates the length of the initial segment
383  * of s1 which consists entirely of bytes not in s2.
384  *
385  * @attention
386  * <ul>
387  * <li>None.</li>
388  * </ul>
389  *
390  * @retval #size_t The strcspn() function returns the number of bytes in the initial
391  *       segment of s1 which are not in the string s2.
392  *
393  * @par Dependency:
394  * <ul><li>string.h</li></ul>
395  * @see  memchr | strchr | strpbrk | strsep | strstr | strtok
396  */
397 size_t strcspn (const char *, const char *);
398 
399 /**
400  * @ingroup  string
401  *
402  * @par Description:
403  * The strspn() function calculates the length (in bytes) of the initial
404  *       segment of s1 which consists entirely of bytes in s2.
405  *
406  * @attention
407  * <ul>
408  * <li>None.</li>
409  * </ul>
410  *
411  * @retval #size_t The strspn() function returns the number of bytes in the initial
412  *      segment of s1 which consist only of bytes from s2.
413  *
414  * @par Dependency:
415  * <ul><li>string.h</li></ul>
416  * @see  memchr | strchr | strpbrk | strsep | strstr | strtok
417  */
418 size_t strspn (const char *, const char *);
419 
420 /**
421  * @ingroup  string
422  *
423  * @par Description:
424  * The strpbrk() function shall locate the first occurrence in the
425  *       string pointed to by s1 of any byte from the string pointed to by s2.
426  *
427  * @attention
428  * <ul>
429  * <li>None.</li>
430  * </ul>
431  *
432  * @retval #char* Upon successful completion, strpbrk() shall return a pointer to the
433  *      byte or a null pointer if no byte from s2 occurs in s1.
434  *
435  * @par Dependency:
436  * <ul><li>string.h</li></ul>
437  * @see  strchr | strrchr
438  */
439 char *strpbrk (const char *, const char *);
440 
441 /**
442  * @ingroup  string
443  *
444  * @par Description:
445  * The strstr() function finds the first occurrence of the substring
446  * find in the string s. The terminating null bytes ("\0") are
447  * not compared.
448  *
449  * @attention
450  * <ul>
451  * <li>None.</li>
452  * </ul>
453  *
454  * @retval #char* The function returns a pointer to the beginning of the located
455  *               substring, or NULL if the substring is not found.
456  *
457  * @par Dependency:
458  * <ul><li>string.h</li></ul>
459  * @see  memchr | strcasecmp | strchr | strpbrk | strsep | strspn | strtok
460  */
461 char *strstr (const char *, const char *);
462 
463 /**
464  * @ingroup  string
465  *
466  * @par Description:
467  * The strtok() function breaks a string into a sequence of zero or more
468  *       nonempty tokens. On the first call to strtok(), the string to be
469  *       parsed should be specified in str. In each subsequent call that
470  *       should parse the same string, str must be NULL.
471  *       The delim argument specifies a set of bytes that delimit the tokens
472  *       in the parsed string. The caller may specify different strings in
473  *       delim in successive calls that parse the same string.
474  *       Each call to strtok() returns a pointer to a null-terminated string
475  *       containing the next token. This string does not include the
476  *       delimiting byte. If no more tokens are found, strtok() returns NULL.
477  *       A sequence of calls to strtok() that operate on the same string
478  *       maintains a pointer that determines the point from which to start
479  *       searching for the next token. The first call to strtok() sets this
480  *       pointer to point to the first byte of the string. The start of the
481  *       next token is determined by scanning forward for the next
482  *       nondelimiter byte in str. If such a byte is found, it is taken as
483  *       the start of the next token. If no such byte is found, then there
484  *       are no more tokens, and strtok() returns NULL. (A string that is
485  *       empty or that contains only delimiters will thus cause strtok() to
486  *       return NULL on the first call.)
487  *
488  * @attention
489  * <ul>
490  * <li>None.</li>
491  * </ul>
492  *
493  * @retval #char* The strtok() function returns a pointer to the next
494  *       token, or NULL if there are no more tokens.
495  *
496  * @par Dependency:
497  * <ul><li>string.h</li></ul>
498  * @see  memchr | strchr | strpbrk | strsep | strspn | strstr
499  */
500 char *strtok (char *__restrict, const char *__restrict);
501 
502 /**
503  * @ingroup  string
504  *
505  * @par Description:
506  * The strlen() function calculates the length of the string s,
507  * excluding the terminating null byte ("\0").
508  *
509  * @attention
510  * <ul>
511  * <li>None.</li>
512  * </ul>
513  *
514  * @retval #size_t The strlen() function returns the number of bytes in the string s.
515  *
516  *
517  * @par Dependency:
518  * <ul><li>string.h</li></ul>
519  * @see strnlen | wcslen
520  *
521  */
522 size_t strlen (const char *);
523 
524 /**
525  * @ingroup  string
526  *
527  * @par Description:
528  * The strerror() function returns a pointer to a string that describes
529  * the error code passed in the argument error_number. (For example, if error_number is EINVAL,
530  * the returned description will be "Invalid argument".) This string must not be
531  * modified by the application, but may be modified by a subsequent call
532  * to strerror(). No other library function, including
533  * perror(), will modify this string.
534  *
535  * @attention
536  * <ul>
537  * <li>The errno is not to be set in Liteos.</li>
538  * </ul>
539  *
540  * @retval #char* The strerror() function returns the appropriate error description string,
541  * or return NULL if can not find error description string.
542  *
543  * @par Dependency:
544  * <ul><li>string.h</li></ul>
545  * @see   perror
546  */
547 char *strerror (int);
548 
549 #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
550 #include <strings.h>
551 #endif
552 
553 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
554  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
555  || defined(_BSD_SOURCE)
556 
557 /**
558  * @ingroup  string
559  *
560  * @par Description:
561  * The strtok_r() function is a reentrant version strtok(). The saveptr
562  *   argument is a pointer to a char* variable that is used internally by
563  *   strtok_r() in order to maintain context between successive calls that
564  *   parse the same string.
565  *   On the first call to strtok_r(), str should point to the string to be
566  *   parsed, and the value of saveptr is ignored. In subsequent calls,
567  *   str should be NULL, and saveptr should be unchanged since the
568  *   previous call.
569  *   Different strings may be parsed concurrently using sequences of calls
570  *   to strtok_r() that specify different saveptr arguments.
571  *
572  * @attention
573  * <ul>
574  * <li>None.</li>
575  * </ul>
576  *
577  * @retval #char* The strtok_r() function returns a pointer to the next
578  *       token, or NULL if there are no more tokens.
579  *
580  * @par Dependency:
581  * <ul><li>string.h</li></ul>
582  * @see  memchr | strchr | strpbrk | strsep | strspn | strstr
583  */
584 char *strtok_r (char *__restrict, const char *__restrict, char **__restrict);
585 
586 /**
587  * @ingroup  string
588  *
589  * @par Description:
590  * The strerror_r() function shall map the error number in error_number
591  * to a locale-dependent error message string and shall return the string
592  * in the buffer pointed to by buf, with length buf_len. If the value of
593  * error_number is a valid error number, the message string shall indicate
594  * what error occurred; if the value of error_number is zero, the message
595  * string shall either be an empty string or indicate that no error occurred;
596  * otherwise, if these functions complete successfully, the message string
597  * shall indicate that an unknown error occurred.
598  *
599  * @attention
600  * <ul>
601  * <li>None.</li>
602  * </ul>
603  *
604  * @retval #int Upon successful completion, strerror_l() shall return a pointer
605  * to the generated message string. If error_number is not a valid error number,
606  * errno may be set to [EINVAL], but a pointer to a message string shall still
607  * be returned. If any other error occurs, errno shall be set to indicate the
608  * error and a null pointer shall be returned.
609  *
610  * @par Dependency:
611  * <ul><li>string.h</li></ul>
612  * @see  perror
613  */
614 int strerror_r (int, char *, size_t);
615 
616 /**
617  * @ingroup  string
618  *
619  * @par Description:
620  * The stpcpy() function copies the string pointed to by src
621  * (including the terminating null byte ("\0")) to the array pointed to by dest.
622  * The strings may not overlap, and the destination string dest must be large
623  * enough to receive the copy.
624  *
625  * @attention
626  * <ul>
627  * <li>None.</li>
628  * </ul>
629  *
630  * @retval #char* stpcpy() returns a pointer to the end of the string dest
631  * (that is, the address of the terminating null byte) rather than the beginning.
632  *
633  * @par Dependency:
634  * <ul><li>string.h</li></ul>
635  * @see  memcpy | memmove | strcpy
636  */
637 char *stpcpy(char *__restrict, const char *__restrict);
638 char *stpncpy(char *__restrict, const char *__restrict, size_t);
639 
640 /**
641  * @ingroup  string
642  *
643  * @par Description:
644  * The strnlen() function returns the number of characters in the string
645  * pointed to by str, excluding the terminating null byte ("\0"), but at
646  * most maxlen. In doing this, strnlen() looks only at the first maxlen
647  * characters in the string pointed to by str and never beyond str+maxlen.
648  *
649  *
650  * @attention
651  * <ul>
652  * <li>None.</li>
653  * </ul>
654  *
655  * @retval #size_t The strnlen() function returns the number of characters in the string
656  * pointed to by str, if that is less than maxlen, or maxlen if there is no null
657  * terminating ("\0") among the first maxlen characters pointed to by str.
658  *
659  * @par Dependency:
660  * <ul><li>string.h</li></ul>
661  * @see  strlen
662  */
663 size_t strnlen (const char *, size_t);
664 
665 /**
666  * @ingroup  string
667  *
668  * @par Description:
669  * The strdup() function returns a pointer to a new string which is a
670  * duplicate of the string str. Memory for the new string is obtained
671  * with malloc(), and can be freed with free().
672  *
673  * @attention
674  * <ul>
675  * <li>None.</li>
676  * </ul>
677  *
678  * @retval #char* On success, the strdup() function returns a pointer to the duplicated
679  * string. It returns NULL if insufficient memory was available.
680  *
681  * @par Dependency:
682  * <ul><li>string.h</li></ul>
683  * @see  calloc | free | malloc | realloc
684  */
685 char *strdup (const char *);
686 char *strndup (const char *, size_t);
687 char *strsignal(int);
688 char *strerror_l (int, locale_t);
689 int strcoll_l (const char *, const char *, locale_t);
690 size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t);
691 #endif
692 
693 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
694  || defined(_BSD_SOURCE)
695 void *memccpy (void *__restrict, const void *__restrict, int, size_t);
696 #endif
697 
698 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
699 
700 /**
701  * @ingroup  string
702  *
703  * @par Description:
704  * Decompose a string into a set of strings. Scan backwards from the position pointed
705  * to by stringp. After encountering the character in the string pointed to by delim,
706  * replace this character with NULL and return the address pointed to by stringp.
707  *
708  * @attention
709  * <ul>
710  * <li>
711  * The strsep() function is not a standard C Library Function.
712  * </li>
713  * </ul>
714  *
715  * @retval #char* Returns a substring starting at the beginning of stringp, and returns
716  * NULL when there is no substring that is split.
717  *
718  * @par Dependency:
719  * <ul><li>string.h</li></ul>
720  * @see  memchr | strchr | strspn | strstr | strtok
721  */
722 char *strsep(char **, const char *);
723 size_t strlcat (char *, const char *, size_t);
724 
725 /**
726  * @ingroup  string
727  *
728  * @par Description:
729  * The strlcpy() function copies and concatenate strings. It is
730  * designed to be safer, more consistent, and less error prone replacements
731  * for the easily misused functions strncpy() and.
732  * strlcpy() takes the full size	of the destination buffer and
733  * guarantee NUL-termination if there is room. Note that room for the NUL
734  * should be included in siz. strlcpy() copies up to siz - 1 characters from
735  * the string src to dst, NUL-terminating the result if siz is not 0.
736  *
737  * @attention
738  * <ul>
739  * <li>
740  * The strlcpy() function is not a standard C Library Function.
741  * </li>
742  * </ul>
743  *
744  * @retval #size_t the strlcpy() function returns the	total
745  * length of the string they tried to create. For strlcpy() that means the
746  * length of src. If the return value is >= siz, the output string has been truncated.
747  *
748  * @par Dependency:
749  * <ul><li>string.h</li></ul>
750  * @see  snprintf | strncat | strncpy | wcslcpy
751  */
752 size_t strlcpy (char *, const char *, size_t);
753 void explicit_bzero (void *, size_t);
754 #endif
755 
756 #ifdef _GNU_SOURCE
757 #define	strdupa(x)	strcpy(alloca(strlen(x)+1),x)
758 int strverscmp (const char *, const char *);
759 char *strchrnul(const char *, int);
760 
761 /**
762  * @ingroup  string
763  *
764  * @par Description:
765  * The strcasestr() function finds the first occurrence of the substring
766  * find in the string s. The terminating null bytes ("\0") are not compared.
767  *
768  * @attention
769  * <ul>
770  * <li>
771  * The strcasestr() function is not a standard C Library Function.
772  * </li>
773  * </ul>
774  *
775  * @retval #char* The function returns a pointer to the beginning of the substring,
776  * or NULL if the substring is not found.
777  *
778  * @par Dependency:
779  * <ul><li>string.h</li></ul>
780  * @see  memchr | strcasecmp | strchr | strpbrk | strsep | strspn | strtok
781  */
782 char *strcasestr(const char *, const char *);
783 void *memmem(const void *, size_t, const void *, size_t);
784 void *memrchr(const void *, int, size_t);
785 void *mempcpy(void *, const void *, size_t);
786 #ifndef __cplusplus
787 #ifndef __LITEOS__
788 char *basename();
789 #else
790 char *basename(char *);
791 #endif
792 #endif
793 #endif
794 
795 #ifdef __cplusplus
796 }
797 #endif
798 
799 #endif
800