avr-libc  2.0.0
Standard C library for AVR-GCC

AVR Libc Home Page

AVRs

AVR Libc Development Pages

Main Page

User Manual

Library Reference

FAQ

Example Projects

string.h
Go to the documentation of this file.
1 /* Copyright (c) 2002,2007 Marek Michalkiewicz
2  All rights reserved.
3 
4  Redistribution and use in source and binary forms, with or without
5  modification, are permitted provided that the following conditions are met:
6 
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9 
10  * Redistributions in binary form must reproduce the above copyright
11  notice, this list of conditions and the following disclaimer in
12  the documentation and/or other materials provided with the
13  distribution.
14 
15  * Neither the name of the copyright holders nor the names of
16  contributors may be used to endorse or promote products derived
17  from this software without specific prior written permission.
18 
19  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  POSSIBILITY OF SUCH DAMAGE. */
30 
31 /* $Id: string.h 2515 2016-02-08 22:46:42Z joerg_wunsch $ */
32 
33 /*
34  string.h
35 
36  Contributors:
37  Created by Marek Michalkiewicz <marekm@linux.org.pl>
38  */
39 
40 #ifndef _STRING_H_
41 #define _STRING_H_ 1
42 
43 #ifndef __DOXYGEN__
44 #define __need_NULL
45 #define __need_size_t
46 #include <stddef.h>
47 
48 #ifndef __ATTR_PURE__
49 #define __ATTR_PURE__ __attribute__((__pure__))
50 #endif
51 
52 #ifndef __ATTR_CONST__
53 # define __ATTR_CONST__ __attribute__((__const__))
54 #endif
55 #endif /* !__DOXYGEN__ */
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 /** \file */
62 /** \defgroup avr_string <string.h>: Strings
63  \code #include <string.h> \endcode
64 
65  The string functions perform string operations on NULL terminated
66  strings.
67 
68  \note If the strings you are working on resident in program space (flash),
69  you will need to use the string functions described in \ref avr_pgmspace. */
70 
71 
72 /** \ingroup avr_string
73 
74  This macro finds the first (least significant) bit set in the
75  input value.
76 
77  This macro is very similar to the function ffs() except that
78  it evaluates its argument at compile-time, so it should only
79  be applied to compile-time constant expressions where it will
80  reduce to a constant itself.
81  Application of this macro to expressions that are not constant
82  at compile-time is not recommended, and might result in a huge
83  amount of code generated.
84 
85  \returns The _FFS() macro returns the position of the first
86  (least significant) bit set in the word val, or 0 if no bits are set.
87  The least significant bit is position 1. Only 16 bits of argument
88  are evaluted.
89 */
90 #if defined(__DOXYGEN__)
91 #define _FFS(x)
92 #else /* !DOXYGEN */
93 #define _FFS(x) \
94  (1 \
95  + (((x) & 1) == 0) \
96  + (((x) & 3) == 0) \
97  + (((x) & 7) == 0) \
98  + (((x) & 017) == 0) \
99  + (((x) & 037) == 0) \
100  + (((x) & 077) == 0) \
101  + (((x) & 0177) == 0) \
102  + (((x) & 0377) == 0) \
103  + (((x) & 0777) == 0) \
104  + (((x) & 01777) == 0) \
105  + (((x) & 03777) == 0) \
106  + (((x) & 07777) == 0) \
107  + (((x) & 017777) == 0) \
108  + (((x) & 037777) == 0) \
109  + (((x) & 077777) == 0) \
110  - (((x) & 0177777) == 0) * 16)
111 #endif /* DOXYGEN */
112 
113 /** \ingroup avr_string
114  \fn int ffs(int val);
115 
116  \brief This function finds the first (least significant) bit set in the input value.
117 
118  \returns The ffs() function returns the position of the first
119  (least significant) bit set in the word val, or 0 if no bits are set.
120  The least significant bit is position 1.
121 
122  \note For expressions that are constant at compile time, consider
123  using the \ref _FFS macro instead.
124 */
125 extern int ffs(int __val) __ATTR_CONST__;
126 
127 /** \ingroup avr_string
128  \fn int ffsl(long val);
129 
130  \brief Same as ffs(), for an argument of type long. */
131 extern int ffsl(long __val) __ATTR_CONST__;
132 
133 /** \ingroup avr_string
134  \fn int ffsll(long long val);
135 
136  \brief Same as ffs(), for an argument of type long long. */
137 __extension__ extern int ffsll(long long __val) __ATTR_CONST__;
138 
139 /** \ingroup avr_string
140  \fn void *memccpy(void *dest, const void *src, int val, size_t len)
141  \brief Copy memory area.
142 
143  The memccpy() function copies no more than \p len bytes from memory
144  area \p src to memory area \p dest, stopping when the character \p val
145  is found.
146 
147  \returns The memccpy() function returns a pointer to the next character
148  in \p dest after \p val, or NULL if \p val was not found in the first
149  \p len characters of \p src. */
150 extern void *memccpy(void *, const void *, int, size_t);
151 
152 /** \ingroup avr_string
153  \fn void *memchr(const void *src, int val, size_t len)
154  \brief Scan memory for a character.
155 
156  The memchr() function scans the first len bytes of the memory area pointed
157  to by src for the character val. The first byte to match val (interpreted
158  as an unsigned character) stops the operation.
159 
160  \returns The memchr() function returns a pointer to the matching byte or
161  NULL if the character does not occur in the given memory area. */
162 extern void *memchr(const void *, int, size_t) __ATTR_PURE__;
163 
164 /** \ingroup avr_string
165  \fn int memcmp(const void *s1, const void *s2, size_t len)
166  \brief Compare memory areas
167 
168  The memcmp() function compares the first len bytes of the memory areas s1
169  and s2. The comparision is performed using unsigned char operations.
170 
171  \returns The memcmp() function returns an integer less than, equal to, or
172  greater than zero if the first len bytes of s1 is found, respectively, to be
173  less than, to match, or be greater than the first len bytes of s2.
174 
175  \note Be sure to store the result in a 16 bit variable since you may get
176  incorrect results if you use an unsigned char or char due to truncation.
177 
178  \warning This function is not -mint8 compatible, although if you only care
179  about testing for equality, this function should be safe to use. */
180 extern int memcmp(const void *, const void *, size_t) __ATTR_PURE__;
181 
182 /** \ingroup avr_string
183  \fn void *memcpy(void *dest, const void *src, size_t len)
184  \brief Copy a memory area.
185 
186  The memcpy() function copies len bytes from memory area src to memory area
187  dest. The memory areas may not overlap. Use memmove() if the memory
188  areas do overlap.
189 
190  \returns The memcpy() function returns a pointer to dest. */
191 extern void *memcpy(void *, const void *, size_t);
192 
193 /** \ingroup avr_string
194  \fn void *memmem(const void *s1, size_t len1, const void *s2, size_t len2)
195 
196  The memmem() function finds the start of the first occurrence of the
197  substring \p s2 of length \p len2 in the memory area \p s1 of length
198  \p len1.
199 
200  \return The memmem() function returns a pointer to the beginning of
201  the substring, or \c NULL if the substring is not found. If \p len2
202  is zero, the function returns \p s1. */
203 extern void *memmem(const void *, size_t, const void *, size_t) __ATTR_PURE__;
204 
205 /** \ingroup avr_string
206  \fn void *memmove(void *dest, const void *src, size_t len)
207  \brief Copy memory area.
208 
209  The memmove() function copies len bytes from memory area src to memory area
210  dest. The memory areas may overlap.
211 
212  \returns The memmove() function returns a pointer to dest. */
213 extern void *memmove(void *, const void *, size_t);
214 
215 /** \ingroup avr_string
216  \fn void *memrchr(const void *src, int val, size_t len)
217 
218  The memrchr() function is like the memchr() function, except that it
219  searches backwards from the end of the \p len bytes pointed to by \p
220  src instead of forwards from the front. (Glibc, GNU extension.)
221 
222  \return The memrchr() function returns a pointer to the matching
223  byte or \c NULL if the character does not occur in the given memory
224  area. */
225 extern void *memrchr(const void *, int, size_t) __ATTR_PURE__;
226 
227 /** \ingroup avr_string
228  \fn void *memset(void *dest, int val, size_t len)
229  \brief Fill memory with a constant byte.
230 
231  The memset() function fills the first len bytes of the memory area pointed
232  to by dest with the constant byte val.
233 
234  \returns The memset() function returns a pointer to the memory area dest. */
235 extern void *memset(void *, int, size_t);
236 
237 /** \ingroup avr_string
238  \fn char *strcat(char *dest, const char *src)
239  \brief Concatenate two strings.
240 
241  The strcat() function appends the src string to the dest string
242  overwriting the '\\0' character at the end of dest, and then adds a
243  terminating '\\0' character. The strings may not overlap, and the dest
244  string must have enough space for the result.
245 
246  \returns The strcat() function returns a pointer to the resulting string
247  dest. */
248 extern char *strcat(char *, const char *);
249 
250 /** \ingroup avr_string
251  \fn char *strchr(const char *src, int val)
252  \brief Locate character in string.
253 
254  The strchr() function returns a pointer to the first occurrence of
255  the character \p val in the string \p src.
256 
257  Here "character" means "byte" - these functions do not work with
258  wide or multi-byte characters.
259 
260  \returns The strchr() function returns a pointer to the matched
261  character or \c NULL if the character is not found. */
262 extern char *strchr(const char *, int) __ATTR_PURE__;
263 
264 /** \ingroup avr_string
265  \fn char *strchrnul(const char *s, int c)
266 
267  The strchrnul() function is like strchr() except that if \p c is not
268  found in \p s, then it returns a pointer to the null byte at the end
269  of \p s, rather than \c NULL. (Glibc, GNU extension.)
270 
271  \return The strchrnul() function returns a pointer to the matched
272  character, or a pointer to the null byte at the end of \p s (i.e.,
273  \c s+strlen(s)) if the character is not found. */
274 extern char *strchrnul(const char *, int) __ATTR_PURE__;
275 
276 /** \ingroup avr_string
277  \fn int strcmp(const char *s1, const char *s2)
278  \brief Compare two strings.
279 
280  The strcmp() function compares the two strings \p s1 and \p s2.
281 
282  \returns The strcmp() function returns an integer less than, equal
283  to, or greater than zero if \p s1 is found, respectively, to be less
284  than, to match, or be greater than \p s2. A consequence of the
285  ordering used by strcmp() is that if \p s1 is an initial substring
286  of \p s2, then \p s1 is considered to be "less than" \p s2. */
287 extern int strcmp(const char *, const char *) __ATTR_PURE__;
288 
289 /** \ingroup avr_string
290  \fn char *strcpy(char *dest, const char *src)
291  \brief Copy a string.
292 
293  The strcpy() function copies the string pointed to by src (including the
294  terminating '\\0' character) to the array pointed to by dest. The strings
295  may not overlap, and the destination string dest must be large enough to
296  receive the copy.
297 
298  \returns The strcpy() function returns a pointer to the destination
299  string dest.
300 
301  \note If the destination string of a strcpy() is not large enough (that
302  is, if the programmer was stupid/lazy, and failed to check the size before
303  copying) then anything might happen. Overflowing fixed length strings is
304  a favourite cracker technique. */
305 extern char *strcpy(char *, const char *);
306 
307 /** \ingroup avr_string
308  \fn int strcasecmp(const char *s1, const char *s2)
309  \brief Compare two strings ignoring case.
310 
311  The strcasecmp() function compares the two strings \p s1 and \p s2,
312  ignoring the case of the characters.
313 
314  \returns The strcasecmp() function returns an integer less than,
315  equal to, or greater than zero if \p s1 is found, respectively, to
316  be less than, to match, or be greater than \p s2. A consequence of
317  the ordering used by strcasecmp() is that if \p s1 is an initial
318  substring of \p s2, then \p s1 is considered to be "less than"
319  \p s2. */
320 extern int strcasecmp(const char *, const char *) __ATTR_PURE__;
321 
322 /** \ingroup avr_string
323  \fn char *strcasestr(const char *s1, const char *s2)
324 
325  The strcasestr() function finds the first occurrence of the
326  substring \p s2 in the string \p s1. This is like strstr(), except
327  that it ignores case of alphabetic symbols in searching for the
328  substring. (Glibc, GNU extension.)
329 
330  \return The strcasestr() function returns a pointer to the beginning
331  of the substring, or \c NULL if the substring is not found. If \p s2
332  points to a string of zero length, the function returns \p s1. */
333 extern char *strcasestr(const char *, const char *) __ATTR_PURE__;
334 
335 /** \ingroup avr_string
336  \fn size_t strcspn(const char *s, const char *reject)
337 
338  The strcspn() function calculates the length of the initial segment
339  of \p s which consists entirely of characters not in \p reject.
340 
341  \return The strcspn() function returns the number of characters in
342  the initial segment of \p s which are not in the string \p reject.
343  The terminating zero is not considered as a part of string. */
344 extern size_t strcspn(const char *__s, const char *__reject) __ATTR_PURE__;
345 
346 /** \ingroup avr_string
347  \fn char *strdup(const char *s1)
348  \brief Duplicate a string.
349 
350  The strdup() function allocates memory and copies into it the string
351  addressed by s1, including the terminating null character.
352 
353  \warning The strdup() function calls malloc() to allocate the memory
354  for the duplicated string! The user is responsible for freeing the
355  memory by calling free().
356 
357  \returns The strdup() function returns a pointer to the resulting string
358  dest. If malloc() cannot allocate enough storage for the string, strdup()
359  will return NULL.
360 
361  \warning Be sure to check the return value of the strdup() function to
362  make sure that the function has succeeded in allocating the memory!
363 */
364 extern char *strdup(const char *s1);
365 
366 /** \ingroup avr_string
367  \fn size_t strlcat(char *dst, const char *src, size_t siz)
368  \brief Concatenate two strings.
369 
370  Appends \p src to string \p dst of size \p siz (unlike strncat(),
371  \p siz is the full size of \p dst, not space left). At most \p siz-1
372  characters will be copied. Always NULL terminates (unless \p siz <=
373  \p strlen(dst)).
374 
375  \returns The strlcat() function returns strlen(src) + MIN(siz,
376  strlen(initial dst)). If retval >= siz, truncation occurred. */
377 extern size_t strlcat(char *, const char *, size_t);
378 
379 /** \ingroup avr_string
380  \fn size_t strlcpy(char *dst, const char *src, size_t siz)
381  \brief Copy a string.
382 
383  Copy \p src to string \p dst of size \p siz. At most \p siz-1
384  characters will be copied. Always NULL terminates (unless \p siz == 0).
385 
386  \returns The strlcpy() function returns strlen(src). If retval >= siz,
387  truncation occurred. */
388 extern size_t strlcpy(char *, const char *, size_t);
389 
390 /** \ingroup avr_string
391  \fn size_t strlen(const char *src)
392  \brief Calculate the length of a string.
393 
394  The strlen() function calculates the length of the string src, not
395  including the terminating '\\0' character.
396 
397  \returns The strlen() function returns the number of characters in
398  src. */
399 extern size_t strlen(const char *) __ATTR_PURE__;
400 
401 /** \ingroup avr_string
402  \fn char *strlwr(char *s)
403  \brief Convert a string to lower case.
404 
405  The strlwr() function will convert a string to lower case. Only the upper
406  case alphabetic characters [A .. Z] are converted. Non-alphabetic
407  characters will not be changed.
408 
409  \returns The strlwr() function returns a pointer to the converted
410  string. */
411 extern char *strlwr(char *);
412 
413 /** \ingroup avr_string
414  \fn char *strncat(char *dest, const char *src, size_t len)
415  \brief Concatenate two strings.
416 
417  The strncat() function is similar to strcat(), except that only the first
418  n characters of src are appended to dest.
419 
420  \returns The strncat() function returns a pointer to the resulting string
421  dest. */
422 extern char *strncat(char *, const char *, size_t);
423 
424 /** \ingroup avr_string
425  \fn int strncmp(const char *s1, const char *s2, size_t len)
426  \brief Compare two strings.
427 
428  The strncmp() function is similar to strcmp(), except it only compares the
429  first (at most) n characters of s1 and s2.
430 
431  \returns The strncmp() function returns an integer less than, equal to, or
432  greater than zero if s1 (or the first n bytes thereof) is found,
433  respectively, to be less than, to match, or be greater than s2. */
434 extern int strncmp(const char *, const char *, size_t) __ATTR_PURE__;
435 
436 /** \ingroup avr_string
437  \fn char *strncpy(char *dest, const char *src, size_t len)
438  \brief Copy a string.
439 
440  The strncpy() function is similar to strcpy(), except that not more than n
441  bytes of src are copied. Thus, if there is no null byte among the first n
442  bytes of src, the result will not be null-terminated.
443 
444  In the case where the length of src is less than that of n, the remainder
445  of dest will be padded with nulls.
446 
447  \returns The strncpy() function returns a pointer to the destination
448  string dest. */
449 extern char *strncpy(char *, const char *, size_t);
450 
451 /** \ingroup avr_string
452  \fn int strncasecmp(const char *s1, const char *s2, size_t len)
453  \brief Compare two strings ignoring case.
454 
455  The strncasecmp() function is similar to strcasecmp(), except it
456  only compares the first \p len characters of \p s1.
457 
458  \returns The strncasecmp() function returns an integer less than,
459  equal to, or greater than zero if \p s1 (or the first \p len bytes
460  thereof) is found, respectively, to be less than, to match, or be
461  greater than \p s2. A consequence of the ordering used by
462  strncasecmp() is that if \p s1 is an initial substring of \p s2,
463  then \p s1 is considered to be "less than" \p s2. */
464 extern int strncasecmp(const char *, const char *, size_t) __ATTR_PURE__;
465 
466 /** \ingroup avr_string
467  \fn size_t strnlen(const char *src, size_t len)
468  \brief Determine the length of a fixed-size string.
469 
470  The strnlen function returns the number of characters in the string
471  pointed to by src, not including the terminating '\\0' character, but at
472  most len. In doing this, strnlen looks only at the first len characters at
473  src and never beyond src+len.
474 
475  \returns The strnlen function returns strlen(src), if that is less than
476  len, or len if there is no '\\0' character among the first len
477  characters pointed to by src. */
478 extern size_t strnlen(const char *, size_t) __ATTR_PURE__;
479 
480 /** \ingroup avr_string
481  \fn char *strpbrk(const char *s, const char *accept)
482 
483  The strpbrk() function locates the first occurrence in the string
484  \p s of any of the characters in the string \p accept.
485 
486  \return The strpbrk() function returns a pointer to the character
487  in \p s that matches one of the characters in \p accept, or \c NULL
488  if no such character is found. The terminating zero is not
489  considered as a part of string: if one or both args are empty, the
490  result will be \c NULL. */
491 extern char *strpbrk(const char *__s, const char *__accept) __ATTR_PURE__;
492 
493 /** \ingroup avr_string
494  \fn char *strrchr(const char *src, int val)
495  \brief Locate character in string.
496 
497  The strrchr() function returns a pointer to the last occurrence of the
498  character val in the string src.
499 
500  Here "character" means "byte" - these functions do not work with wide or
501  multi-byte characters.
502 
503  \returns The strrchr() function returns a pointer to the matched character
504  or NULL if the character is not found. */
505 extern char *strrchr(const char *, int) __ATTR_PURE__;
506 
507 /** \ingroup avr_string
508  \fn char *strrev(char *s)
509  \brief Reverse a string.
510 
511  The strrev() function reverses the order of the string.
512 
513  \returns The strrev() function returns a pointer to the beginning of the
514  reversed string. */
515 extern char *strrev(char *);
516 
517 /** \ingroup avr_string
518  \fn char *strsep(char **sp, const char *delim)
519  \brief Parse a string into tokens.
520 
521  The strsep() function locates, in the string referenced by \p *sp,
522  the first occurrence of any character in the string \p delim (or the
523  terminating '\\0' character) and replaces it with a '\\0'. The
524  location of the next character after the delimiter character (or \c
525  NULL, if the end of the string was reached) is stored in \p *sp. An
526  ``empty'' field, i.e. one caused by two adjacent delimiter
527  characters, can be detected by comparing the location referenced by
528  the pointer returned in \p *sp to '\\0'.
529 
530  \return The strsep() function returns a pointer to the original
531  value of \p *sp. If \p *sp is initially \c NULL, strsep() returns
532  \c NULL. */
533 extern char *strsep(char **, const char *);
534 
535 /** \ingroup avr_string
536  \fn size_t strspn(const char *s, const char *accept)
537 
538  The strspn() function calculates the length of the initial segment
539  of \p s which consists entirely of characters in \p accept.
540 
541  \return The strspn() function returns the number of characters in
542  the initial segment of \p s which consist only of characters from \p
543  accept. The terminating zero is not considered as a part of string. */
544 extern size_t strspn(const char *__s, const char *__accept) __ATTR_PURE__;
545 
546 /** \ingroup avr_string
547  \fn char *strstr(const char *s1, const char *s2)
548  \brief Locate a substring.
549 
550  The strstr() function finds the first occurrence of the substring \p
551  s2 in the string \p s1. The terminating '\\0' characters are not
552  compared.
553 
554  \returns The strstr() function returns a pointer to the beginning of
555  the substring, or \c NULL if the substring is not found. If \p s2
556  points to a string of zero length, the function returns \p s1. */
557 extern char *strstr(const char *, const char *) __ATTR_PURE__;
558 
559 /** \ingroup avr_string
560  \fn char *strtok(char *s, const char *delim)
561  \brief Parses the string s into tokens.
562 
563  strtok parses the string s into tokens. The first call to strtok
564  should have s as its first argument. Subsequent calls should have
565  the first argument set to NULL. If a token ends with a delimiter, this
566  delimiting character is overwritten with a '\\0' and a pointer to the next
567  character is saved for the next call to strtok. The delimiter string
568  delim may be different for each call.
569 
570  \returns The strtok() function returns a pointer to the next token or
571  NULL when no more tokens are found.
572 
573  \note strtok() is NOT reentrant. For a reentrant version of this function
574  see \c strtok_r().
575 */
576 extern char *strtok(char *, const char *);
577 
578 /** \ingroup avr_string
579  \fn char *strtok_r(char *string, const char *delim, char **last)
580  \brief Parses string into tokens.
581 
582  strtok_r parses string into tokens. The first call to strtok_r
583  should have string as its first argument. Subsequent calls should have
584  the first argument set to NULL. If a token ends with a delimiter, this
585  delimiting character is overwritten with a '\\0' and a pointer to the next
586  character is saved for the next call to strtok_r. The delimiter string
587  \p delim may be different for each call. \p last is a user allocated char*
588  pointer. It must be the same while parsing the same string. strtok_r is
589  a reentrant version of strtok().
590 
591  \returns The strtok_r() function returns a pointer to the next token or
592  NULL when no more tokens are found. */
593 extern char *strtok_r(char *, const char *, char **);
594 
595 /** \ingroup avr_string
596  \fn char *strupr(char *s)
597  \brief Convert a string to upper case.
598 
599  The strupr() function will convert a string to upper case. Only the lower
600  case alphabetic characters [a .. z] are converted. Non-alphabetic
601  characters will not be changed.
602 
603  \returns The strupr() function returns a pointer to the converted
604  string. The pointer is the same as that passed in since the operation is
605  perform in place. */
606 extern char *strupr(char *);
607 
608 #ifndef __DOXYGEN__
609 /* libstdc++ compatibility, dummy declarations */
610 extern int strcoll(const char *s1, const char *s2);
611 extern char *strerror(int errnum);
612 extern size_t strxfrm(char *dest, const char *src, size_t n);
613 #endif /* !__DOXYGEN__ */
614 
615 #ifdef __cplusplus
616 }
617 #endif
618 
619 #endif /* _STRING_H_ */
620 
void * memmem(const void *, size_t, const void *, size_t) __ATTR_PURE__
void * memmove(void *, const void *, size_t)
Copy memory area.
char * strsep(char **, const char *)
Parse a string into tokens.
char * strstr(const char *, const char *) __ATTR_PURE__
Locate a substring.
char * strlwr(char *)
Convert a string to lower case.
void * memcpy(void *, const void *, size_t)
Copy a memory area.
size_t strnlen(const char *, size_t) __ATTR_PURE__
Determine the length of a fixed-size string.
char * strpbrk(const char *__s, const char *__accept) __ATTR_PURE__
int strncmp(const char *, const char *, size_t) __ATTR_PURE__
Compare two strings.
int strncasecmp(const char *, const char *, size_t) __ATTR_PURE__
Compare two strings ignoring case.
void * memset(void *, int, size_t)
Fill memory with a constant byte.
int strcasecmp(const char *, const char *) __ATTR_PURE__
Compare two strings ignoring case.
char * strncat(char *, const char *, size_t)
Concatenate two strings.
size_t strlcpy(char *, const char *, size_t)
Copy a string.
Definition: strlcpy.c:49
char * strtok(char *, const char *)
Parses the string s into tokens.
Definition: strtok.c:41
char * strchr(const char *, int) __ATTR_PURE__
Locate character in string.
int memcmp(const void *, const void *, size_t) __ATTR_PURE__
Compare memory areas.
void * memchr(const void *, int, size_t) __ATTR_PURE__
Scan memory for a character.
char * strchrnul(const char *, int) __ATTR_PURE__
size_t strlen(const char *) __ATTR_PURE__
Calculate the length of a string.
char * strrev(char *)
Reverse a string.
int ffs(int __val)
This function finds the first (least significant) bit set in the input value.
size_t strcspn(const char *__s, const char *__reject) __ATTR_PURE__
int ffsl(long __val)
Same as ffs(), for an argument of type long.
void * memccpy(void *, const void *, int, size_t)
Copy memory area.
char * strdup(const char *s1)
Duplicate a string.
Definition: strdup.c:37
char * strcasestr(const char *, const char *) __ATTR_PURE__
__extension__ int ffsll(long long __val)
Same as ffs(), for an argument of type long long.
int strcmp(const char *, const char *) __ATTR_PURE__
Compare two strings.
char * strupr(char *)
Convert a string to upper case.
void * memrchr(const void *, int, size_t) __ATTR_PURE__
char * strrchr(const char *, int) __ATTR_PURE__
Locate character in string.
char * strtok_r(char *, const char *, char **)
Parses string into tokens.
char * strcat(char *, const char *)
Concatenate two strings.
size_t strspn(const char *__s, const char *__accept) __ATTR_PURE__
char * strcpy(char *, const char *)
Copy a string.
size_t strlcat(char *, const char *, size_t)
Concatenate two strings.
Definition: strlcat.c:50
char * strncpy(char *, const char *, size_t)
Copy a string.