4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** @file
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The header <string.h> declares one type and several functions, and defines
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync one macro useful for manipulating arrays of character type and other objects
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync treated as arrays of character type. Various methods are used for
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync determining the lengths of the arrays, but in all cases a char * or void *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync argument points to the initial (lowest addressed) character of the array. If
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync an array is accessed beyond the end of an object, the behavior is undefined.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Where an argument declared as size_t n specifies the length of the array for
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync a function, n can have the value zero on a call to that function. Unless
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync explicitly stated otherwise in the description of those functions, pointer
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync arguments on such a call must still have valid values.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync For all functions declared in this header, each character shall be
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync interpreted as if it had the type unsigned char (and therefore every possible
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync object representation is valid and has a different value).
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The following macros are defined in this file:<BR>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @verbatim
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync NULL
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync bcopy(a,b,c) ( memcpy((void *)b, (const void *)a, (size_t)c))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync bcmp(a,b,c) ( memcmp((void *)a, (void *)b, (size_t)c))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @endverbatim
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The following types are defined in this file:<BR>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @verbatim
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync size_t Unsigned integer type of the result of the sizeof operator.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @endverbatim
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The following functions are declared in this file:<BR>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @verbatim
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ################ Copying Functions
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void *memcpy (void * __restrict s1, const void * __restrict s2, size_t n);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void *memmove (void *s1, const void *s2, size_t n);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *strcpy (char * __restrict s1, const char * __restrict s2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *strncpy (char * __restrict s1, const char * __restrict s2, size_t n);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int strncpyX (char * __restrict s1, const char * __restrict s2, size_t n);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ################ Concatenation Functions
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *strcat (char * __restrict s1, const char * __restrict s2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *strncat (char * __restrict s1, const char * __restrict s2, size_t n);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int strncatX (char * __restrict s1, const char * __restrict s2, size_t n);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ################ Comparison Functions
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int memcmp (const void *s1, const void *s2, size_t n);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int strcmp (const char *s1, const char *s2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int strcoll (const char *s1, const char *s2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int strncmp (const char *s1, const char *s2, size_t n);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync size_t strxfrm (char * __restrict s1, const char * __restrict s2, size_t n);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ################ Search Functions
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void *memchr (const void *s, int c, size_t n);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *strchr (const char *s, int c);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync size_t strcspn (const char *s1, const char *s2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *strpbrk (const char *s1, const char *s2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *strrchr (const char *s, int c);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync size_t strspn (const char *s1 , const char *s2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *strstr (const char *s1 , const char *s2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *strtok (char * __restrict s1, const char * __restrict s2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ################ Miscellaneous Functions
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void *memset (void *s, int c, size_t n);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *strerror (int num);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync size_t strlen (const char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ################ BSD Compatibility Functions
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *strdup (const char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int strerror_r (int, char *, size_t);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int strcasecmp (const char *s1, const char *s2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void *memccpy (void *, const void *, int, size_t);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int strncasecmp (const char *s1, const char *s2, size_t n);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync size_t strlcpy (char *destination, const char *source, size_t size);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync size_t strlcat (char *destination, const char *source, size_t size);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync char *strsep (register char **stringp, register const char *delim);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @endverbatim
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This program and the accompanying materials are licensed and made available under
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the terms and conditions of the BSD License that accompanies this distribution.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The full text of the license may be found at
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync http://opensource.org/licenses/bsd-license.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#ifndef _STRING_H
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define _STRING_H
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <sys/EfiCdefs.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#ifdef _EFI_SIZE_T_
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync typedef _EFI_SIZE_T_ size_t;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync #undef _EFI_SIZE_T_
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync #undef _BSD_SIZE_T_
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#endif
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__BEGIN_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* ################ Copying Functions ################################# */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The memcpy function copies N characters from the object pointed to by Src
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync into the object pointed to by Dest. If copying takes place between objects
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync that overlap, the behavior is undefined.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] Dest Pointer to the destination of the copy operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Src Pointer to the Source data to be copied.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] N Number of characters (bytes) to be copied.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The memcpy function returns the value of Dest.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid *memcpy(void * __restrict Dest, const void * __restrict Src, size_t N);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The memmove function copies N characters from the object pointed to by Src
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync into the object pointed to by Dest. Copying takes place as if the N
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync characters from the object pointed to by Src are first copied into a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync temporary array of N characters that does not overlap the objects pointed
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to by Dest and Src, and then the N characters from the temporary array are
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync copied into the object pointed to by Dest.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] Dest Pointer to the destination of the copy operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Src Pointer to the Source data to be copied.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] N Number of characters (bytes) to be copied.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The memmove function returns the value of Dest.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid *memmove(void *Dest, const void *Src, size_t N);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strcpy function copies the string pointed to by Src (including the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync terminating null character) into the array pointed to by Dest. If copying
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync takes place between objects that overlap, the behavior is undefined.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] Dest Pointer to the destination of the copy operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Src Pointer to the Source data to be copied.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strcpy function returns the value of Dest.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchar *strcpy(char * __restrict Dest, const char * __restrict Src);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strncpy function copies not more than N characters (characters that
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync follow a null character are not copied) from the array pointed to by Src to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the array pointed to by Dest. If copying takes place between objects that
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync overlap, the behavior is undefined.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If the array pointed to by Src is a string that is shorter than N
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync characters, null characters are appended to the copy in the array pointed
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to by Dest, until N characters in all have been written.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] Dest Pointer to the destination of the copy operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Src Pointer to the Source data to be copied.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] N Number of characters (bytes) to be copied.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strncpy function returns the value of Dest.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchar *strncpy(char * __restrict Dest, const char * __restrict Src, size_t N);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strncpyX function copies not more than N-1 characters (characters that
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync follow a null character are not copied) from the array pointed to by Src to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the array pointed to by Dest. Array Dest is guaranteed to be NULL terminated.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If copying takes place between objects that overlap,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the behavior is undefined.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync strncpyX exists because normal strncpy does not indicate if the copy was
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync terminated because of exhausting the buffer or reaching the end of Src.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] Dest Pointer to the destination of the copy operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Src Pointer to the Source data to be copied.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] N Number of characters (bytes) to be copied.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strncpyX function returns 0 if the copy operation was
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync terminated because it reached the end of Dest. Otherwise,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync a non-zero value is returned indicating how many characters
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync remain in Dest.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint strncpyX(char * __restrict Dest, const char * __restrict Src, size_t N);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* ################ Concatenation Functions ########################### */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strcat function appends a copy of the string pointed to by Src
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (including the terminating null character) to the end of the string pointed
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to by Dest. The initial character of Src overwrites the null character at the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync end of Dest. If copying takes place between objects that overlap, the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync behavior is undefined.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] Dest Pointer to the destination of the concatenation operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Src Pointer to the Source data to be concatenated.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strcat function returns the value of Dest.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchar *strcat(char * __restrict Dest, const char * __restrict Src);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strncat function appends not more than N characters (a null character
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and characters that follow it are not appended) from the array pointed to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync by Src to the end of the string pointed to by Dest. The initial character of
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Src overwrites the null character at the end of Dest. A terminating null
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync character is always appended to the result. If copying takes place
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync between objects that overlap, the behavior is undefined.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] Dest Pointer to the destination of the concatenation operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Src Pointer to the Source data to be concatenated.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] N Max Number of characters (bytes) to be concatenated.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strncat function returns the value of Dest.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchar *strncat(char * __restrict Dest, const char * __restrict Src, size_t N);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strncatX function appends not more than N characters (a null character
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and characters that follow it are not appended) from the array pointed to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync by Src to the end of the string pointed to by Dest. The initial character of
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Src overwrites the null character at the end of Dest. The result is always
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync terminated with a null character. If copying takes place between objects
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync that overlap, the behavior is undefined.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync strncatX exists because normal strncat does not indicate if the operation
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync was terminated because of exhausting N or reaching the end of Src.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] Dest Pointer to the destination of the concatenation operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Src Pointer to the Source data to be concatenated.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] N Max Number of characters (bytes) to be concatenated.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strncatX function returns 0 if the operation was terminated
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync because it reached the end of Dest. Otherwise, a non-zero value is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync returned indicating how many characters remain in Dest.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint strncatX(char * __restrict s1, const char * __restrict s2, size_t n);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* ################ Comparison Functions ############################## */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The memcmp function compares the first N characters of the object pointed
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to by S1 to the first N characters of the object pointed to by S2.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] S1 Pointer to the first object to be compared.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S2 Pointer to the object to be compared to S1.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] N Max Number of characters (bytes) to be compared.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The memcmp function returns an integer greater than, equal to, or
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync less than zero, accordingly as the object pointed to by S1 is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync greater than, equal to, or less than the object pointed to by S2.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint memcmp(const void *S1, const void *S2, size_t N);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strcmp function compares the string pointed to by S1 to the string
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointed to by S2.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] S1 Pointer to the first string to be compared.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S2 Pointer to the string to be compared to S1.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strcmp function returns an integer greater than, equal to, or
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync less than zero, accordingly as the string pointed to by S1 is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync greater than, equal to, or less than the string pointed to by S2.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint strcmp(const char *S1, const char *S2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strcoll function compares the string pointed to by S1 to the string
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointed to by S2, both interpreted as appropriate to the LC_COLLATE
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync category of the current locale.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] S1 Pointer to the first string to be compared.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S2 Pointer to the string to be compared to S1.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strcoll function returns an integer greater than, equal to,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync or less than zero, accordingly as the string pointed to by S1 is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync greater than, equal to, or less than the string pointed to by S2
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync when both are interpreted as appropriate to the current locale.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint strcoll(const char *S1, const char *S2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strncmp function compares not more than N characters (characters that
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync follow a null character are not compared) from the array pointed to by S1
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to the array pointed to by S2.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] S1 Pointer to the first object to be compared.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S2 Pointer to the object to be compared to S1.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] N Max Number of characters (bytes) to be compared.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strncmp function returns an integer greater than, equal to,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync or less than zero, accordingly as the possibly null-terminated
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync array pointed to by S1 is greater than, equal to, or less than
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the possibly null-terminated array pointed to by S2.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint strncmp(const char *S1, const char *S2, size_t N);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strxfrm function transforms the string pointed to by Src and places the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync resulting string into the array pointed to by Dest. The transformation is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync such that if the strcmp function is applied to two transformed strings, it
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync returns a value greater than, equal to, or less than zero, corresponding to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the result of the strcoll function applied to the same two original
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync strings. No more than N characters are placed into the resulting array
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointed to by Dest, including the terminating null character. If N is zero,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Dest is permitted to be a null pointer. If copying takes place between
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync objects that overlap, the behavior is undefined.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] Dest Pointer to the object to receive the transformed string.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Src Pointer to the string to be transformed.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] N Max Number of characters (bytes) to be transformed.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strxfrm function returns the length of the transformed string
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (not including the terminating null character). If the value
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync returned is N or more, the contents of the array pointed to by Dest
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync are indeterminate.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncsize_t strxfrm(char * __restrict Dest, const char * __restrict Src, size_t N);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* ################ Search Functions ################################## */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The memchr function locates the first occurrence of C (converted to an
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync unsigned char) in the initial N characters (each interpreted as
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync unsigned char) of the object pointed to by S.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S Pointer to the object to be searched.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] C The character value to search for.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] N Max Number of characters (bytes) to be searched.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The memchr function returns a pointer to the located character,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync or a null pointer if the character does not occur in the object.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid *memchr(const void *S, int C, size_t N);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strchr function locates the first occurrence of C (converted to a char)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync in the string pointed to by S. The terminating null character is considered
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to be part of the string.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S Pointer to the object to be searched.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] C The character value to search for.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strchr function returns a pointer to the located character,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync or a null pointer if the character does not occur in the string.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchar *strchr(const char *S, int C);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strcspn function computes the length of the maximum initial segment of
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the string pointed to by S1 which consists entirely of characters NOT from
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the string pointed to by S2.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S1 Pointer to the object to be searched.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S2 Pointer to the list of characters to search for.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strcspn function returns the length of the segment.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncsize_t strcspn(const char *S1, const char *S2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strpbrk function locates the first occurrence in the string pointed to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync by S1 of any character from the string pointed to by S2.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S1 Pointer to the object to be searched.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S2 Pointer to the list of characters to search for.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strpbrk function returns a pointer to the character, or a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync null pointer if no character from S2 occurs in S1.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchar *strpbrk(const char *S1, const char *S2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strrchr function locates the last occurrence of C (converted to a char)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync in the string pointed to by S. The terminating null character is considered
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to be part of the string.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S Pointer to the object to be searched.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] C The character value to search for.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strrchr function returns a pointer to the character, or a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync null pointer if C does not occur in the string.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchar *strrchr(const char *S, int C);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strspn function computes the length of the maximum initial segment of
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the string pointed to by S1 which consists entirely of characters from the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync string pointed to by S2.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S1 Pointer to the object to be searched.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S2 Pointer to the list of characters to search for.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strspn function returns the length of the segment.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncsize_t strspn(const char *S1 , const char *S2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strstr function locates the first occurrence in the string pointed to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync by S1 of the sequence of characters (excluding the terminating null
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync character) in the string pointed to by S2.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S1 Pointer to the object to be searched.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S2 Pointer to the sequence of characters to search for.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strstr function returns a pointer to the located string, or a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync null pointer if the string is not found. If S2 points to a string
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync with zero length, the function returns S1.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchar *strstr(const char *S1 , const char *S2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** Break a string into a sequence of tokens.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync A sequence of calls to the strtok function breaks the string pointed to by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync S1 into a sequence of tokens, each of which is delimited by a character
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync from the string pointed to by S2. The first call in the sequence has a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync non-null first argument; subsequent calls in the sequence have a null first
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync argument. The separator string pointed to by S2 may be different from call
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to call.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The first call in the sequence searches the string pointed to by S1 for the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync first character that is not contained in the current separator string
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointed to by S2. If no such character is found, then there are no tokens
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync in the string pointed to by S1 and the strtok function returns a null
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync pointer. If such a character is found, it is the start of the first token.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The strtok function then searches from there for a character that is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync contained in the current separator string. If no such character is found,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the current token extends to the end of the string pointed to by S1, and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync subsequent searches for a token will return a null pointer. If such a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync character is found, it is overwritten by a null character, which terminates
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the current token. The strtok function saves a pointer to the following
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync character, from which the next search for a token will start.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Each subsequent call, with a null pointer as the value of the first
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync argument, starts searching from the saved pointer and behaves as
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync described above.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S1 Pointer to the string to be tokenized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S2 Pointer to a list of separator characters.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strtok function returns a pointer to the first character of a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync token, or a null pointer if there is no token.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchar *strtok(char * __restrict S1, const char * __restrict S2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* ################ Miscellaneous Functions ########################### */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The memset function copies the value of C (converted to an unsigned char)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync into each of the first N characters of the object pointed to by S.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[out] S Pointer to the first element of the object to be set.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] C Value to store in each element of S.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] N Number of elements in S to be set.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The memset function returns the value of S.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid *memset(void *S, int C, size_t N);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strerror function maps the number in Num to a message string.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Typically, the values for Num come from errno, but strerror shall map
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync any value of type int to a message.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] Num A value to be converted to a message.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strerror function returns a pointer to the string, the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync contents of which are locale specific. The array pointed to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync must not be modified by the program, but may be overwritten by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync a subsequent call to the strerror function.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchar *strerror(int Num);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** The strlen function computes the length of the string pointed to by S.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] S Pointer to the string to determine the length of.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The strlen function returns the number of characters that
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync precede the terminating null character.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncsize_t strlen(const char *S);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* ################ BSD Compatibility Functions ####################### */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchar *strdup (const char *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint strerror_r(int, char *, size_t);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint strcasecmp(const char *s1, const char *s2);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid *memccpy (void *, const void *, int, size_t);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncint strncasecmp(const char *s1, const char *s2, size_t n);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncsize_t strlcpy(char *destination, const char *source, size_t size);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncsize_t strlcat(char *destination, const char *source, size_t size);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync// bcopy is is a void function with the src/dest arguments reversed, being used in socket lib
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define bcopy(a,b,c) ( memcpy((void *)b, (const void *)a, (size_t)c))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync// bcmp is same as memcmp, returns 0 for successful compare, non-zero otherwise
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define bcmp(a,b,c) ( memcmp((void *)a, (void *)b, (size_t)c))
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/*
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Get next token from string *stringp, where tokens are possibly-empty
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * strings separated by characters from delim.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Writes NULs into the string at *stringp to end tokens.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * delim need not remain constant from call to call.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * On return, *stringp points past the last NUL written (if there might
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * be further tokens), or is NULL (if there are definitely no more tokens).
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * If *stringp is NULL, strsep returns NULL.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncchar *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncstrsep(
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync register char **stringp,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync register const char *delim
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync );
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync__END_DECLS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#endif /* _STRING_H */