$treeview $search $mathjax $extrastylesheet
avr-libc  2.0.0
$projectbrief
$projectbrief
$searchbox

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.
00001 /* Copyright (c) 2002,2007 Marek Michalkiewicz
00002    All rights reserved.
00003 
00004    Redistribution and use in source and binary forms, with or without
00005    modification, are permitted provided that the following conditions are met:
00006 
00007    * Redistributions of source code must retain the above copyright
00008      notice, this list of conditions and the following disclaimer.
00009 
00010    * Redistributions in binary form must reproduce the above copyright
00011      notice, this list of conditions and the following disclaimer in
00012      the documentation and/or other materials provided with the
00013      distribution.
00014 
00015    * Neither the name of the copyright holders nor the names of
00016      contributors may be used to endorse or promote products derived
00017      from this software without specific prior written permission.
00018 
00019   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00020   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00022   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00023   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00024   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00025   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00026   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00027   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00028   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00029   POSSIBILITY OF SUCH DAMAGE. */
00030 
00031 /* $Id$ */
00032 
00033 /*
00034    string.h
00035 
00036    Contributors:
00037      Created by Marek Michalkiewicz <marekm@linux.org.pl>
00038  */
00039 
00040 #ifndef _STRING_H_
00041 #define _STRING_H_ 1
00042 
00043 #ifndef __DOXYGEN__
00044 #define __need_NULL
00045 #define __need_size_t
00046 #include <stddef.h>
00047 
00048 #ifndef __ATTR_PURE__
00049 #define __ATTR_PURE__ __attribute__((__pure__))
00050 #endif
00051 
00052 #ifndef __ATTR_CONST__
00053 # define __ATTR_CONST__ __attribute__((__const__))
00054 #endif
00055 #endif  /* !__DOXYGEN__ */
00056 
00057 #ifdef __cplusplus
00058 extern "C" {
00059 #endif
00060 
00061 /** \file */
00062 /** \defgroup avr_string <string.h>: Strings
00063     \code #include <string.h> \endcode
00064 
00065     The string functions perform string operations on NULL terminated
00066     strings. 
00067 
00068     \note If the strings you are working on resident in program space (flash),
00069     you will need to use the string functions described in \ref avr_pgmspace. */
00070 
00071 
00072 /** \ingroup avr_string
00073 
00074     This macro finds the first (least significant) bit set in the
00075     input value.
00076 
00077     This macro is very similar to the function ffs() except that
00078     it evaluates its argument at compile-time, so it should only
00079     be applied to compile-time constant expressions where it will
00080     reduce to a constant itself.
00081     Application of this macro to expressions that are not constant
00082     at compile-time is not recommended, and might result in a huge
00083     amount of code generated.
00084 
00085     \returns The _FFS() macro returns the position of the first
00086     (least significant) bit set in the word val, or 0 if no bits are set.
00087     The least significant bit is position 1.  Only 16 bits of argument
00088     are evaluted.
00089 */
00090 #if defined(__DOXYGEN__)
00091 #define _FFS(x)
00092 #else  /* !DOXYGEN */
00093 #define _FFS(x) \
00094     (1              \
00095      + (((x) & 1) == 0)     \
00096      + (((x) & 3) == 0)     \
00097      + (((x) & 7) == 0)     \
00098      + (((x) & 017) == 0)       \
00099      + (((x) & 037) == 0)       \
00100      + (((x) & 077) == 0)       \
00101      + (((x) & 0177) == 0)      \
00102      + (((x) & 0377) == 0)      \
00103      + (((x) & 0777) == 0)      \
00104      + (((x) & 01777) == 0)     \
00105      + (((x) & 03777) == 0)     \
00106      + (((x) & 07777) == 0)     \
00107      + (((x) & 017777) == 0)    \
00108      + (((x) & 037777) == 0)    \
00109      + (((x) & 077777) == 0)    \
00110      - (((x) & 0177777) == 0) * 16)
00111 #endif /* DOXYGEN */
00112 
00113 /** \ingroup avr_string
00114     \fn int ffs(int val);
00115 
00116     \brief This function finds the first (least significant) bit set in the input value.
00117 
00118     \returns The ffs() function returns the position of the first
00119     (least significant) bit set in the word val, or 0 if no bits are set.
00120     The least significant bit is position 1.
00121 
00122     \note For expressions that are constant at compile time, consider
00123     using the \ref _FFS macro instead.
00124 */
00125 extern int ffs(int __val) __ATTR_CONST__;
00126 
00127 /** \ingroup avr_string
00128     \fn int ffsl(long val);
00129 
00130     \brief Same as ffs(), for an argument of type long. */
00131 extern int ffsl(long __val) __ATTR_CONST__;
00132 
00133 /** \ingroup avr_string
00134     \fn int ffsll(long long val);
00135 
00136     \brief Same as ffs(), for an argument of type long long. */
00137 __extension__ extern int ffsll(long long __val) __ATTR_CONST__;
00138 
00139 /** \ingroup avr_string
00140     \fn void *memccpy(void *dest, const void *src, int val, size_t len)
00141     \brief Copy memory area.
00142 
00143     The memccpy() function copies no more than \p len bytes from memory
00144     area \p src to memory area \p dest, stopping when the character \p val
00145     is found.
00146 
00147     \returns The memccpy() function returns a pointer to the next character
00148     in \p dest after \p val, or NULL if \p val was not found in the first
00149     \p len characters of \p src. */
00150 extern void *memccpy(void *, const void *, int, size_t);
00151 
00152 /** \ingroup avr_string
00153     \fn void *memchr(const void *src, int val, size_t len)
00154     \brief Scan memory for a character.
00155 
00156     The memchr() function scans the first len bytes of the memory area pointed
00157     to by src for the character val.  The first byte to match val (interpreted
00158     as an unsigned character) stops the operation.
00159 
00160     \returns The memchr() function returns a pointer to the matching byte or
00161     NULL if the character does not occur in the given memory area.  */
00162 extern void *memchr(const void *, int, size_t) __ATTR_PURE__;
00163 
00164 /** \ingroup avr_string
00165     \fn int memcmp(const void *s1, const void *s2, size_t len)
00166     \brief Compare memory areas
00167 
00168     The memcmp() function compares the first len bytes of the memory areas s1
00169     and s2. The comparision is performed using unsigned char operations.
00170 
00171     \returns The memcmp() function returns an integer less than, equal to, or
00172     greater than zero if the first len bytes of s1 is found, respectively, to be
00173     less than, to match, or be greater than the first len bytes of s2.
00174 
00175     \note Be sure to store the result in a 16 bit variable since you may get
00176     incorrect results if you use an unsigned char or char due to truncation.
00177 
00178     \warning This function is not -mint8 compatible, although if you only care
00179     about testing for equality, this function should be safe to use. */
00180 extern int memcmp(const void *, const void *, size_t) __ATTR_PURE__;
00181 
00182 /** \ingroup avr_string
00183     \fn void *memcpy(void *dest, const void *src, size_t len)
00184     \brief Copy a memory area.
00185 
00186     The memcpy() function copies len bytes from memory area src to memory area
00187     dest.  The memory areas may not overlap.  Use memmove() if the memory
00188     areas do overlap.
00189 
00190     \returns The memcpy() function returns a pointer to dest.  */
00191 extern void *memcpy(void *, const void *, size_t);
00192 
00193 /** \ingroup avr_string
00194     \fn void *memmem(const void *s1, size_t len1, const void *s2, size_t len2)
00195 
00196     The memmem() function finds the start of the first occurrence of the
00197     substring \p s2 of length \p len2 in the memory area \p s1 of length
00198     \p len1.
00199 
00200     \return The memmem() function returns a pointer to the beginning of
00201     the substring, or \c NULL if the substring is not found. If \p len2
00202     is zero, the function returns \p s1. */
00203 extern void *memmem(const void *, size_t, const void *, size_t) __ATTR_PURE__;
00204 
00205 /** \ingroup avr_string
00206     \fn void *memmove(void *dest, const void *src, size_t len)
00207     \brief Copy memory area.
00208 
00209     The memmove() function copies len bytes from memory area src to memory area
00210     dest.  The memory areas may overlap.
00211 
00212     \returns The memmove() function returns a pointer to dest.  */
00213 extern void *memmove(void *, const void *, size_t);
00214 
00215 /** \ingroup avr_string
00216     \fn void *memrchr(const void *src, int val, size_t len)
00217 
00218     The memrchr() function is like the memchr() function, except that it
00219     searches backwards from the end of the \p len bytes pointed to by \p
00220     src instead of forwards from the front. (Glibc, GNU extension.)
00221 
00222     \return The memrchr() function returns a pointer to the matching
00223     byte or \c NULL if the character does not occur in the given memory
00224     area. */
00225 extern void *memrchr(const void *, int, size_t) __ATTR_PURE__;
00226 
00227 /** \ingroup avr_string
00228     \fn void *memset(void *dest, int val, size_t len)
00229     \brief Fill memory with a constant byte.
00230 
00231     The memset() function fills the first len bytes of the memory area pointed
00232     to by dest with the constant byte val.
00233 
00234     \returns The memset() function returns a pointer to the memory area dest. */
00235 extern void *memset(void *, int, size_t);
00236 
00237 /** \ingroup avr_string
00238     \fn char *strcat(char *dest, const char *src)
00239     \brief Concatenate two strings.
00240 
00241     The strcat() function appends the src string to the dest string
00242     overwriting the '\\0' character at the end of dest, and then adds a
00243     terminating '\\0' character.  The strings may not overlap, and the dest
00244     string must have enough space for the result.
00245 
00246     \returns The strcat() function returns a pointer to the resulting string
00247     dest.  */
00248 extern char *strcat(char *, const char *);
00249 
00250 /** \ingroup avr_string
00251     \fn char *strchr(const char *src, int val)
00252     \brief Locate character in string.
00253 
00254     The strchr() function returns a pointer to the first occurrence of
00255     the character \p val in the string \p src.
00256 
00257     Here "character" means "byte" - these functions do not work with
00258     wide or multi-byte characters.
00259 
00260     \returns The strchr() function returns a pointer to the matched
00261     character or \c NULL if the character is not found. */
00262 extern char *strchr(const char *, int) __ATTR_PURE__;
00263 
00264 /** \ingroup avr_string
00265     \fn char *strchrnul(const char *s, int c)
00266 
00267     The strchrnul() function is like strchr() except that if \p c is not
00268     found in \p s, then it returns a pointer to the null byte at the end
00269     of \p s, rather than \c NULL. (Glibc, GNU extension.)
00270 
00271     \return The strchrnul() function returns a pointer to the matched
00272     character, or a pointer to the null byte at the end of \p s (i.e.,
00273     \c s+strlen(s)) if the character is not found.  */
00274 extern char *strchrnul(const char *, int) __ATTR_PURE__;
00275 
00276 /** \ingroup avr_string
00277     \fn int strcmp(const char *s1, const char *s2)
00278     \brief Compare two strings.
00279 
00280     The strcmp() function compares the two strings \p s1 and \p s2.
00281 
00282     \returns The strcmp() function returns an integer less than, equal
00283     to, or greater than zero if \p s1 is found, respectively, to be less
00284     than, to match, or be greater than \p s2. A consequence of the
00285     ordering used by strcmp() is that if \p s1 is an initial substring
00286     of \p s2, then \p s1 is considered to be "less than" \p s2. */
00287 extern int strcmp(const char *, const char *) __ATTR_PURE__;
00288 
00289 /** \ingroup avr_string
00290     \fn char *strcpy(char *dest, const char *src)
00291     \brief Copy a string.
00292 
00293     The strcpy() function copies the string pointed to by src (including the
00294     terminating '\\0' character) to the array pointed to by dest.  The strings
00295     may not overlap, and the destination string dest must be large enough to
00296     receive the copy.
00297 
00298     \returns The strcpy() function returns a pointer to the destination
00299     string dest.
00300 
00301     \note If the destination string of a strcpy() is not large enough (that
00302     is, if the programmer was stupid/lazy, and failed to check the size before
00303     copying) then anything might happen.  Overflowing fixed length strings is
00304     a favourite cracker technique. */
00305 extern char *strcpy(char *, const char *);
00306 
00307 /** \ingroup avr_string
00308     \fn int strcasecmp(const char *s1, const char *s2)
00309     \brief Compare two strings ignoring case.
00310 
00311     The strcasecmp() function compares the two strings \p s1 and \p s2,
00312     ignoring the case of the characters.
00313 
00314     \returns The strcasecmp() function returns an integer less than,
00315     equal to, or greater than zero if \p s1 is found, respectively, to
00316     be less than, to match, or be greater than \p s2. A consequence of
00317     the ordering used by strcasecmp() is that if \p s1 is an initial
00318     substring of \p s2, then \p s1 is considered to be "less than"
00319     \p s2. */
00320 extern int strcasecmp(const char *, const char *) __ATTR_PURE__;
00321 
00322 /** \ingroup avr_string
00323     \fn char *strcasestr(const char *s1, const char *s2)
00324 
00325     The strcasestr() function finds the first occurrence of the
00326     substring \p s2 in the string \p s1. This is like strstr(), except
00327     that it ignores case of alphabetic symbols in searching for the
00328     substring. (Glibc, GNU extension.)
00329 
00330     \return The strcasestr() function returns a pointer to the beginning
00331     of the substring, or \c NULL if the substring is not found. If \p s2
00332     points to a string of zero length, the function returns \p s1. */
00333 extern char *strcasestr(const char *, const char *) __ATTR_PURE__;
00334 
00335 /** \ingroup avr_string
00336     \fn size_t strcspn(const char *s, const char *reject)
00337 
00338     The strcspn() function calculates the length of the initial segment
00339     of \p s which consists entirely of characters not in \p reject.
00340 
00341     \return The strcspn() function returns the number of characters in
00342     the initial segment of \p s which are not in the string \p reject.
00343     The terminating zero is not considered as a part of string. */
00344 extern size_t strcspn(const char *__s, const char *__reject) __ATTR_PURE__;
00345 
00346 /** \ingroup avr_string
00347     \fn char *strdup(const char *s1)
00348     \brief Duplicate a string.
00349 
00350     The strdup() function allocates memory and copies into it the string
00351     addressed by s1, including the terminating null character.
00352 
00353     \warning The strdup() function calls malloc() to allocate the memory
00354     for the duplicated string! The user is responsible for freeing the
00355     memory by calling free().
00356 
00357     \returns The strdup() function returns a pointer to the resulting string
00358     dest. If malloc() cannot allocate enough storage for the string, strdup()
00359     will return NULL.
00360 
00361     \warning Be sure to check the return value of the strdup() function to
00362     make sure that the function has succeeded in allocating the memory!
00363 */
00364 extern char *strdup(const char *s1);
00365 
00366 /** \ingroup avr_string
00367     \fn size_t strlcat(char *dst, const char *src, size_t siz)
00368     \brief Concatenate two strings.
00369 
00370     Appends \p src to string \p dst of size \p siz (unlike strncat(),
00371     \p siz is the full size of \p dst, not space left).  At most \p siz-1
00372     characters will be copied.  Always NULL terminates (unless \p siz <=
00373     \p strlen(dst)).
00374 
00375     \returns The strlcat() function returns strlen(src) + MIN(siz,
00376     strlen(initial dst)).  If retval >= siz, truncation occurred.  */
00377 extern size_t strlcat(char *, const char *, size_t);
00378 
00379 /** \ingroup avr_string
00380     \fn size_t strlcpy(char *dst, const char *src, size_t siz)
00381     \brief Copy a string.
00382 
00383     Copy \p src to string \p dst of size \p siz.  At most \p siz-1
00384     characters will be copied.  Always NULL terminates (unless \p siz == 0).
00385 
00386     \returns The strlcpy() function returns strlen(src). If retval >= siz,
00387     truncation occurred.  */
00388 extern size_t strlcpy(char *, const char *, size_t);
00389 
00390 /** \ingroup avr_string
00391     \fn size_t strlen(const char *src)
00392     \brief Calculate the length of a string.
00393 
00394     The strlen() function calculates the length of the string src, not
00395     including the terminating '\\0' character.
00396 
00397     \returns The strlen() function returns the number of characters in
00398     src.  */
00399 extern size_t strlen(const char *) __ATTR_PURE__;
00400 
00401 /** \ingroup avr_string
00402     \fn char *strlwr(char *s)
00403     \brief Convert a string to lower case.
00404 
00405     The strlwr() function will convert a string to lower case. Only the upper
00406     case alphabetic characters [A .. Z] are converted.  Non-alphabetic
00407     characters will not be changed.
00408 
00409     \returns The strlwr() function returns a pointer to the converted
00410     string. */
00411 extern char *strlwr(char *);
00412 
00413 /** \ingroup avr_string
00414     \fn char *strncat(char *dest, const char *src, size_t len)
00415     \brief Concatenate two strings.
00416 
00417     The strncat() function is similar to strcat(), except that only the first
00418     n characters of src are appended to dest.
00419 
00420     \returns The strncat() function returns a pointer to the resulting string
00421     dest.  */
00422 extern char *strncat(char *, const char *, size_t);
00423 
00424 /** \ingroup avr_string
00425     \fn int strncmp(const char *s1, const char *s2, size_t len)
00426     \brief Compare two strings.
00427 
00428     The strncmp() function is similar to strcmp(), except it only compares the
00429     first (at most) n characters of s1 and s2.
00430 
00431     \returns The strncmp() function returns an integer less than, equal to, or
00432     greater than zero if s1 (or the first n bytes thereof) is found,
00433     respectively, to be less than, to match, or be greater than s2.  */
00434 extern int strncmp(const char *, const char *, size_t) __ATTR_PURE__;
00435 
00436 /** \ingroup avr_string
00437     \fn char *strncpy(char *dest, const char *src, size_t len)
00438     \brief Copy a string.
00439 
00440     The strncpy() function is similar to strcpy(), except that not more than n
00441     bytes of src are copied. Thus, if there is no null byte among the first n
00442     bytes of src, the result will not be null-terminated.
00443 
00444     In the case where the length of src is less than that of n, the remainder
00445     of dest will be padded with nulls.
00446 
00447     \returns The strncpy() function returns a pointer to the destination
00448     string dest.  */
00449 extern char *strncpy(char *, const char *, size_t);
00450 
00451 /** \ingroup avr_string
00452     \fn int strncasecmp(const char *s1, const char *s2, size_t len)
00453     \brief Compare two strings ignoring case.
00454 
00455     The strncasecmp() function is similar to strcasecmp(), except it
00456     only compares the first \p len characters of \p s1.
00457 
00458     \returns The strncasecmp() function returns an integer less than,
00459     equal to, or greater than zero if \p s1 (or the first \p len bytes
00460     thereof) is found, respectively, to be less than, to match, or be
00461     greater than \p s2. A consequence of the ordering used by
00462     strncasecmp() is that if \p s1 is an initial substring of \p s2,
00463     then \p s1 is considered to be "less than" \p s2.  */
00464 extern int strncasecmp(const char *, const char *, size_t) __ATTR_PURE__;
00465 
00466 /** \ingroup avr_string
00467     \fn size_t strnlen(const char *src, size_t len)
00468     \brief Determine the length of a fixed-size string.
00469 
00470     The strnlen function returns the number of characters in the string
00471     pointed to by src, not including the terminating '\\0' character, but at
00472     most len. In doing this, strnlen looks only at the first len characters at
00473     src and never beyond src+len.
00474 
00475     \returns The strnlen function returns strlen(src), if that is less than
00476     len, or len if there is no '\\0' character among the first len
00477     characters pointed to by src. */
00478 extern size_t strnlen(const char *, size_t) __ATTR_PURE__;
00479 
00480 /** \ingroup avr_string
00481     \fn char *strpbrk(const char *s, const char *accept)
00482 
00483     The strpbrk() function locates the first occurrence in the string
00484     \p s of any of the characters in the string \p accept.
00485 
00486     \return  The strpbrk() function returns a pointer to the character
00487     in \p s that matches one of the characters in \p accept, or \c NULL
00488     if no such character is found. The terminating zero is not
00489     considered as a part of string: if one or both args are empty, the
00490     result will be \c NULL. */
00491 extern char *strpbrk(const char *__s, const char *__accept) __ATTR_PURE__;
00492 
00493 /** \ingroup avr_string
00494     \fn char *strrchr(const char *src, int val)
00495     \brief Locate character in string.
00496 
00497     The strrchr() function returns a pointer to the last occurrence of the
00498     character val in the string src.
00499 
00500     Here "character" means "byte" - these functions do not work with wide or
00501     multi-byte characters.
00502 
00503     \returns The strrchr() function returns a pointer to the matched character
00504     or NULL if the character is not found. */
00505 extern char *strrchr(const char *, int) __ATTR_PURE__;
00506 
00507 /** \ingroup avr_string
00508     \fn char *strrev(char *s)
00509     \brief Reverse a string.
00510 
00511     The strrev() function reverses the order of the string.
00512 
00513     \returns The strrev() function returns a pointer to the beginning of the
00514     reversed string.  */
00515 extern char *strrev(char *);
00516 
00517 /** \ingroup avr_string
00518     \fn char *strsep(char **sp, const char *delim)
00519     \brief Parse a string into tokens.
00520 
00521     The strsep() function locates, in the string referenced by \p *sp,
00522     the first occurrence of any character in the string \p delim (or the
00523     terminating '\\0' character) and replaces it with a '\\0'.  The
00524     location of the next character after the delimiter character (or \c
00525     NULL, if the end of the string was reached) is stored in \p *sp. An
00526     ``empty'' field, i.e. one caused by two adjacent delimiter
00527     characters, can be detected by comparing the location referenced by
00528     the pointer returned in \p *sp to '\\0'.
00529 
00530     \return The strsep() function returns a pointer to the original
00531     value of \p *sp. If \p *sp is initially \c NULL, strsep() returns
00532     \c NULL. */
00533 extern char *strsep(char **, const char *);
00534 
00535 /** \ingroup avr_string
00536     \fn size_t strspn(const char *s, const char *accept)
00537 
00538     The strspn() function calculates the length of the initial segment
00539     of \p s which consists entirely of characters in \p accept.
00540 
00541     \return  The strspn() function returns the number of characters in
00542     the initial segment of \p s which consist only of characters from \p
00543     accept. The terminating zero is not considered as a part of string. */
00544 extern size_t strspn(const char *__s, const char *__accept) __ATTR_PURE__;
00545 
00546 /** \ingroup avr_string
00547     \fn char *strstr(const char *s1, const char *s2)
00548     \brief Locate a substring.
00549 
00550     The strstr() function finds the first occurrence of the substring \p
00551     s2 in the string \p s1.  The terminating '\\0' characters are not
00552     compared.
00553 
00554     \returns The strstr() function returns a pointer to the beginning of
00555     the substring, or \c NULL if the substring is not found. If \p s2
00556     points to a string of zero length, the function returns \p s1. */
00557 extern char *strstr(const char *, const char *) __ATTR_PURE__;
00558 
00559 /** \ingroup avr_string
00560     \fn char *strtok(char *s, const char *delim)
00561     \brief Parses the string s into tokens.
00562 
00563     strtok parses the string s into tokens. The first call to strtok
00564     should have s as its first argument. Subsequent calls should have
00565     the first argument set to NULL. If a token ends with a delimiter, this
00566     delimiting character is overwritten with a '\\0' and a pointer to the next
00567     character is saved for the next call to strtok. The delimiter string
00568     delim may be different for each call.
00569 
00570     \returns The strtok() function returns a pointer to the next token or
00571     NULL when no more tokens are found.
00572 
00573     \note strtok() is NOT reentrant. For a reentrant version of this function
00574     see \c strtok_r().
00575 */
00576 extern char *strtok(char *, const char *);
00577 
00578 /** \ingroup avr_string
00579     \fn char *strtok_r(char *string, const char *delim, char **last)
00580     \brief Parses string into tokens.
00581 
00582     strtok_r parses string into tokens. The first call to strtok_r
00583     should have string as its first argument. Subsequent calls should have
00584     the first argument set to NULL. If a token ends with a delimiter, this
00585     delimiting character is overwritten with a '\\0' and a pointer to the next
00586     character is saved for the next call to strtok_r. The delimiter string
00587     \p delim may be different for each call. \p last is a user allocated char*
00588     pointer. It must be the same while parsing the same string. strtok_r is
00589     a reentrant version of strtok().
00590 
00591     \returns The strtok_r() function returns a pointer to the next token or
00592     NULL when no more tokens are found. */
00593 extern char *strtok_r(char *, const char *, char **);
00594 
00595 /** \ingroup avr_string
00596     \fn char *strupr(char *s)
00597     \brief Convert a string to upper case.
00598 
00599     The strupr() function will convert a string to upper case. Only the lower
00600     case alphabetic characters [a .. z] are converted.  Non-alphabetic
00601     characters will not be changed.
00602 
00603     \returns The strupr() function returns a pointer to the converted
00604     string.  The pointer is the same as that passed in since the operation is
00605     perform in place. */
00606 extern char *strupr(char *);
00607 
00608 #ifndef __DOXYGEN__
00609 /* libstdc++ compatibility, dummy declarations */
00610 extern int strcoll(const char *s1, const char *s2);
00611 extern char *strerror(int errnum);
00612 extern size_t strxfrm(char *dest, const char *src, size_t n);
00613 #endif  /* !__DOXYGEN__ */
00614 
00615 #ifdef __cplusplus
00616 }
00617 #endif
00618 
00619 #endif /* _STRING_H_ */
00620 
 All Data Structures Files Functions Variables Typedefs Enumerations Defines