12aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm/** @file 261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm The header <string.h> declares one type and several functions, and defines 361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm one macro useful for manipulating arrays of character type and other objects 461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm treated as arrays of character type. Various methods are used for 561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm determining the lengths of the arrays, but in all cases a char * or void * 661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm argument points to the initial (lowest addressed) character of the array. If 761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm an array is accessed beyond the end of an object, the behavior is undefined. 861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm Where an argument declared as size_t n specifies the length of the array for 1061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm a function, n can have the value zero on a call to that function. Unless 1161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm explicitly stated otherwise in the description of those functions, pointer 1261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm arguments on such a call must still have valid values. 1361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 1461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm For all functions declared in this header, each character shall be 1561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm interpreted as if it had the type unsigned char (and therefore every possible 1661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm object representation is valid and has a different value). 1761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 1861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm The following macros are defined in this file:<BR> 1961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @verbatim 2061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm NULL 2161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm bcopy(a,b,c) ( memcpy((void *)b, (const void *)a, (size_t)c)) 2261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm bcmp(a,b,c) ( memcmp((void *)a, (void *)b, (size_t)c)) 2361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @endverbatim 2461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 2561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm The following types are defined in this file:<BR> 2661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @verbatim 2761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm size_t Unsigned integer type of the result of the sizeof operator. 2861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @endverbatim 2961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 3061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm The following functions are declared in this file:<BR> 3161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @verbatim 3261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm ################ Copying Functions 3361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm void *memcpy (void * __restrict s1, const void * __restrict s2, size_t n); 3461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm void *memmove (void *s1, const void *s2, size_t n); 3561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm char *strcpy (char * __restrict s1, const char * __restrict s2); 3661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm char *strncpy (char * __restrict s1, const char * __restrict s2, size_t n); 3761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm int strncpyX (char * __restrict s1, const char * __restrict s2, size_t n); 3861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 3961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm ################ Concatenation Functions 4061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm char *strcat (char * __restrict s1, const char * __restrict s2); 4161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm char *strncat (char * __restrict s1, const char * __restrict s2, size_t n); 4261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm int strncatX (char * __restrict s1, const char * __restrict s2, size_t n); 4361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 4461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm ################ Comparison Functions 4561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm int memcmp (const void *s1, const void *s2, size_t n); 4661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm int strcmp (const char *s1, const char *s2); 4761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm int strcoll (const char *s1, const char *s2); 4861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm int strncmp (const char *s1, const char *s2, size_t n); 4961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm size_t strxfrm (char * __restrict s1, const char * __restrict s2, size_t n); 5061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 5161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm ################ Search Functions 5261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm void *memchr (const void *s, int c, size_t n); 5361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm char *strchr (const char *s, int c); 5461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm size_t strcspn (const char *s1, const char *s2); 5561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm char *strpbrk (const char *s1, const char *s2); 5661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm char *strrchr (const char *s, int c); 5761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm size_t strspn (const char *s1 , const char *s2); 5861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm char *strstr (const char *s1 , const char *s2); 5961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm char *strtok (char * __restrict s1, const char * __restrict s2); 6061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 6161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm ################ Miscellaneous Functions 6261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm void *memset (void *s, int c, size_t n); 6361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm char *strerror (int num); 6461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm size_t strlen (const char *); 6561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 6661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm ################ BSD Compatibility Functions 6761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm char *strdup (const char *); 6861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm int strerror_r (int, char *, size_t); 6961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm int strcasecmp (const char *s1, const char *s2); 7061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm void *memccpy (void *, const void *, int, size_t); 7161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm int strncasecmp (const char *s1, const char *s2, size_t n); 7261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm size_t strlcpy (char *destination, const char *source, size_t size); 7361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm size_t strlcat (char *destination, const char *source, size_t size); 7461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm char *strsep (register char **stringp, register const char *delim); 7561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @endverbatim 7661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 7761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR> 7861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm This program and the accompanying materials are licensed and made available under 7961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm the terms and conditions of the BSD License that accompanies this distribution. 8061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm The full text of the license may be found at 8161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm http://opensource.org/licenses/bsd-license. 8261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 8361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 8461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 852aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 862aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm#ifndef _STRING_H 872aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm#define _STRING_H 882aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm#include <sys/EfiCdefs.h> 892aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 902aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm#ifdef _EFI_SIZE_T_ 912aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm typedef _EFI_SIZE_T_ size_t; 922aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm #undef _EFI_SIZE_T_ 932aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm #undef _BSD_SIZE_T_ 942aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm#endif 952aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 962aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm__BEGIN_DECLS 972aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 982aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm/* ################ Copying Functions ################################# */ 992aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 10061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The memcpy function copies N characters from the object pointed to by Src 10161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm into the object pointed to by Dest. If copying takes place between objects 1022aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm that overlap, the behavior is undefined. 1032aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 10461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[out] Dest Pointer to the destination of the copy operation. 10561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] Src Pointer to the Source data to be copied. 10661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] N Number of characters (bytes) to be copied. 10761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 10861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @return The memcpy function returns the value of Dest. 1092aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 11061403bd7ce134c5c1ca0cba4091cff1534926bd2darylmvoid *memcpy(void * __restrict Dest, const void * __restrict Src, size_t N); 1112aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 11261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The memmove function copies N characters from the object pointed to by Src 11361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm into the object pointed to by Dest. Copying takes place as if the N 11461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm characters from the object pointed to by Src are first copied into a 11561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm temporary array of N characters that does not overlap the objects pointed 11661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm to by Dest and Src, and then the N characters from the temporary array are 11761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm copied into the object pointed to by Dest. 1182aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 11961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[out] Dest Pointer to the destination of the copy operation. 12061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] Src Pointer to the Source data to be copied. 12161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] N Number of characters (bytes) to be copied. 12261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 12361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @return The memmove function returns the value of Dest. 1242aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 12561403bd7ce134c5c1ca0cba4091cff1534926bd2darylmvoid *memmove(void *Dest, const void *Src, size_t N); 1262aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 12761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The strcpy function copies the string pointed to by Src (including the 12861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm terminating null character) into the array pointed to by Dest. If copying 1292aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm takes place between objects that overlap, the behavior is undefined. 1302aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 13161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[out] Dest Pointer to the destination of the copy operation. 13261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] Src Pointer to the Source data to be copied. 13361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 13461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @return The strcpy function returns the value of Dest. 1352aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 13661403bd7ce134c5c1ca0cba4091cff1534926bd2darylmchar *strcpy(char * __restrict Dest, const char * __restrict Src); 1372aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 13861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The strncpy function copies not more than N characters (characters that 13961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm follow a null character are not copied) from the array pointed to by Src to 14061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm the array pointed to by Dest. If copying takes place between objects that 1412aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm overlap, the behavior is undefined. 1422aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 14361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm If the array pointed to by Src is a string that is shorter than N 1442aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm characters, null characters are appended to the copy in the array pointed 14561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm to by Dest, until N characters in all have been written. 1462aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 14761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[out] Dest Pointer to the destination of the copy operation. 14861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] Src Pointer to the Source data to be copied. 14961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] N Number of characters (bytes) to be copied. 15061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 15161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @return The strncpy function returns the value of Dest. 1522aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 15361403bd7ce134c5c1ca0cba4091cff1534926bd2darylmchar *strncpy(char * __restrict Dest, const char * __restrict Src, size_t N); 1542aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 15561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The strncpyX function copies not more than N-1 characters (characters that 15661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm follow a null character are not copied) from the array pointed to by Src to 15761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm the array pointed to by Dest. Array Dest is guaranteed to be NULL terminated. 1582aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm If copying takes place between objects that overlap, 1592aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm the behavior is undefined. 1602aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 1612aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm strncpyX exists because normal strncpy does not indicate if the copy was 16261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm terminated because of exhausting the buffer or reaching the end of Src. 16361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 16461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[out] Dest Pointer to the destination of the copy operation. 16561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] Src Pointer to the Source data to be copied. 16661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] N Number of characters (bytes) to be copied. 1672aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 1682aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm @return The strncpyX function returns 0 if the copy operation was 16961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm terminated because it reached the end of Dest. Otherwise, 1702aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm a non-zero value is returned indicating how many characters 17161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm remain in Dest. 1722aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 17361403bd7ce134c5c1ca0cba4091cff1534926bd2darylmint strncpyX(char * __restrict Dest, const char * __restrict Src, size_t N); 1742aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 1752aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm/* ################ Concatenation Functions ########################### */ 1762aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 17761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The strcat function appends a copy of the string pointed to by Src 1782aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm (including the terminating null character) to the end of the string pointed 17961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm to by Dest. The initial character of Src overwrites the null character at the 18061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm end of Dest. If copying takes place between objects that overlap, the 1812aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm behavior is undefined. 1822aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 18361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[out] Dest Pointer to the destination of the concatenation operation. 18461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] Src Pointer to the Source data to be concatenated. 18561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 18661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @return The strcat function returns the value of Dest. 1872aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 18861403bd7ce134c5c1ca0cba4091cff1534926bd2darylmchar *strcat(char * __restrict Dest, const char * __restrict Src); 1892aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 19061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The strncat function appends not more than N characters (a null character 1912aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm and characters that follow it are not appended) from the array pointed to 19261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm by Src to the end of the string pointed to by Dest. The initial character of 19361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm Src overwrites the null character at the end of Dest. A terminating null 1942aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm character is always appended to the result. If copying takes place 1952aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm between objects that overlap, the behavior is undefined. 1962aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 19761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[out] Dest Pointer to the destination of the concatenation operation. 19861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] Src Pointer to the Source data to be concatenated. 19961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] N Max Number of characters (bytes) to be concatenated. 20061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 20161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @return The strncat function returns the value of Dest. 2022aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 20361403bd7ce134c5c1ca0cba4091cff1534926bd2darylmchar *strncat(char * __restrict Dest, const char * __restrict Src, size_t N); 2042aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 20561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The strncatX function appends not more than N characters (a null character 2062aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm and characters that follow it are not appended) from the array pointed to 20761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm by Src to the end of the string pointed to by Dest. The initial character of 20861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm Src overwrites the null character at the end of Dest. The result is always 2092aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm terminated with a null character. If copying takes place between objects 2102aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm that overlap, the behavior is undefined. 2112aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 2122aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm strncatX exists because normal strncat does not indicate if the operation 21361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm was terminated because of exhausting N or reaching the end of Src. 21461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 21561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[out] Dest Pointer to the destination of the concatenation operation. 21661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] Src Pointer to the Source data to be concatenated. 21761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] N Max Number of characters (bytes) to be concatenated. 2182aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 2192aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm @return The strncatX function returns 0 if the operation was terminated 22061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm because it reached the end of Dest. Otherwise, a non-zero value is 22161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm returned indicating how many characters remain in Dest. 2222aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 2232aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylmint strncatX(char * __restrict s1, const char * __restrict s2, size_t n); 2242aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 2252aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm/* ################ Comparison Functions ############################## */ 2262aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 22761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The memcmp function compares the first N characters of the object pointed 22861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm to by S1 to the first N characters of the object pointed to by S2. 22961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 23061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[out] S1 Pointer to the first object to be compared. 23161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S2 Pointer to the object to be compared to S1. 23261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] N Max Number of characters (bytes) to be compared. 2332aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 2342aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm @return The memcmp function returns an integer greater than, equal to, or 23561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm less than zero, accordingly as the object pointed to by S1 is 23661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm greater than, equal to, or less than the object pointed to by S2. 2372aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 23861403bd7ce134c5c1ca0cba4091cff1534926bd2darylmint memcmp(const void *S1, const void *S2, size_t N); 2392aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 24061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The strcmp function compares the string pointed to by S1 to the string 24161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm pointed to by S2. 24261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 24361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[out] S1 Pointer to the first string to be compared. 24461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S2 Pointer to the string to be compared to S1. 2452aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 2462aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm @return The strcmp function returns an integer greater than, equal to, or 24761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm less than zero, accordingly as the string pointed to by S1 is 24861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm greater than, equal to, or less than the string pointed to by S2. 2492aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 25061403bd7ce134c5c1ca0cba4091cff1534926bd2darylmint strcmp(const char *S1, const char *S2); 2512aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 25261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The strcoll function compares the string pointed to by S1 to the string 25361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm pointed to by S2, both interpreted as appropriate to the LC_COLLATE 2542aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm category of the current locale. 2552aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 25661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[out] S1 Pointer to the first string to be compared. 25761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S2 Pointer to the string to be compared to S1. 25861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 2592aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm @return The strcoll function returns an integer greater than, equal to, 26061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm or less than zero, accordingly as the string pointed to by S1 is 26161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm greater than, equal to, or less than the string pointed to by S2 2622aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm when both are interpreted as appropriate to the current locale. 2632aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 26461403bd7ce134c5c1ca0cba4091cff1534926bd2darylmint strcoll(const char *S1, const char *S2); 26561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 26661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The strncmp function compares not more than N characters (characters that 26761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm follow a null character are not compared) from the array pointed to by S1 26861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm to the array pointed to by S2. 2692aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 27061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[out] S1 Pointer to the first object to be compared. 27161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S2 Pointer to the object to be compared to S1. 27261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] N Max Number of characters (bytes) to be compared. 2732aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 2742aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm @return The strncmp function returns an integer greater than, equal to, 2752aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm or less than zero, accordingly as the possibly null-terminated 27661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm array pointed to by S1 is greater than, equal to, or less than 27761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm the possibly null-terminated array pointed to by S2. 2782aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 27961403bd7ce134c5c1ca0cba4091cff1534926bd2darylmint strncmp(const char *S1, const char *S2, size_t N); 2802aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 28161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The strxfrm function transforms the string pointed to by Src and places the 28261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm resulting string into the array pointed to by Dest. The transformation is 2832aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm such that if the strcmp function is applied to two transformed strings, it 2842aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm returns a value greater than, equal to, or less than zero, corresponding to 2852aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm the result of the strcoll function applied to the same two original 28661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm strings. No more than N characters are placed into the resulting array 28761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm pointed to by Dest, including the terminating null character. If N is zero, 28861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm Dest is permitted to be a null pointer. If copying takes place between 2892aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm objects that overlap, the behavior is undefined. 2902aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 29161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[out] Dest Pointer to the object to receive the transformed string. 29261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] Src Pointer to the string to be transformed. 29361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] N Max Number of characters (bytes) to be transformed. 29461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 2952aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm @return The strxfrm function returns the length of the transformed string 2962aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm (not including the terminating null character). If the value 29761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm returned is N or more, the contents of the array pointed to by Dest 2982aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm are indeterminate. 2992aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 30061403bd7ce134c5c1ca0cba4091cff1534926bd2darylmsize_t strxfrm(char * __restrict Dest, const char * __restrict Src, size_t N); 3012aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 3022aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm/* ################ Search Functions ################################## */ 3032aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 30461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The memchr function locates the first occurrence of C (converted to an 30561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm unsigned char) in the initial N characters (each interpreted as 30661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm unsigned char) of the object pointed to by S. 30761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 30861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S Pointer to the object to be searched. 30961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] C The character value to search for. 31061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] N Max Number of characters (bytes) to be searched. 3112aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 3122aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm @return The memchr function returns a pointer to the located character, 3132aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm or a null pointer if the character does not occur in the object. 3142aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 31561403bd7ce134c5c1ca0cba4091cff1534926bd2darylmvoid *memchr(const void *S, int C, size_t N); 3162aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 31761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The strchr function locates the first occurrence of C (converted to a char) 31861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm in the string pointed to by S. The terminating null character is considered 3192aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm to be part of the string. 3202aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 32161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S Pointer to the object to be searched. 32261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] C The character value to search for. 32361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 3242aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm @return The strchr function returns a pointer to the located character, 3252aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm or a null pointer if the character does not occur in the string. 3262aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 32761403bd7ce134c5c1ca0cba4091cff1534926bd2darylmchar *strchr(const char *S, int C); 3282aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 3292aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm/** The strcspn function computes the length of the maximum initial segment of 33061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm the string pointed to by S1 which consists entirely of characters NOT from 33161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm the string pointed to by S2. 33261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 33361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S1 Pointer to the object to be searched. 33461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S2 Pointer to the list of characters to search for. 3352aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 3362aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm @return The strcspn function returns the length of the segment. 3372aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 33861403bd7ce134c5c1ca0cba4091cff1534926bd2darylmsize_t strcspn(const char *S1, const char *S2); 3392aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 3402aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm/** The strpbrk function locates the first occurrence in the string pointed to 34161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm by S1 of any character from the string pointed to by S2. 34261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 34361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S1 Pointer to the object to be searched. 34461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S2 Pointer to the list of characters to search for. 3452aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 3462aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm @return The strpbrk function returns a pointer to the character, or a 34761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm null pointer if no character from S2 occurs in S1. 3482aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 34961403bd7ce134c5c1ca0cba4091cff1534926bd2darylmchar *strpbrk(const char *S1, const char *S2); 3502aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 35161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The strrchr function locates the last occurrence of C (converted to a char) 35261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm in the string pointed to by S. The terminating null character is considered 3532aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm to be part of the string. 3542aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 35561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S Pointer to the object to be searched. 35661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] C The character value to search for. 35761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 3582aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm @return The strrchr function returns a pointer to the character, or a 35961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm null pointer if C does not occur in the string. 3602aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 36161403bd7ce134c5c1ca0cba4091cff1534926bd2darylmchar *strrchr(const char *S, int C); 3622aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 3632aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm/** The strspn function computes the length of the maximum initial segment of 36461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm the string pointed to by S1 which consists entirely of characters from the 36561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm string pointed to by S2. 36661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 36761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S1 Pointer to the object to be searched. 36861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S2 Pointer to the list of characters to search for. 3692aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 3702aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm @return The strspn function returns the length of the segment. 3712aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 37261403bd7ce134c5c1ca0cba4091cff1534926bd2darylmsize_t strspn(const char *S1 , const char *S2); 3732aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 3742aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm/** The strstr function locates the first occurrence in the string pointed to 37561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm by S1 of the sequence of characters (excluding the terminating null 37661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm character) in the string pointed to by S2. 37761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 37861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S1 Pointer to the object to be searched. 37961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S2 Pointer to the sequence of characters to search for. 3802aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 3812aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm @return The strstr function returns a pointer to the located string, or a 38261403bd7ce134c5c1ca0cba4091cff1534926bd2darylm null pointer if the string is not found. If S2 points to a string 38361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm with zero length, the function returns S1. 3842aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 38561403bd7ce134c5c1ca0cba4091cff1534926bd2darylmchar *strstr(const char *S1 , const char *S2); 38661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 38761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** Break a string into a sequence of tokens. 3882aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 38961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm A sequence of calls to the strtok function breaks the string pointed to by 39061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm S1 into a sequence of tokens, each of which is delimited by a character 39161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm from the string pointed to by S2. The first call in the sequence has a 3922aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm non-null first argument; subsequent calls in the sequence have a null first 39361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm argument. The separator string pointed to by S2 may be different from call 3942aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm to call. 3952aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 39661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm The first call in the sequence searches the string pointed to by S1 for the 3972aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm first character that is not contained in the current separator string 39861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm pointed to by S2. If no such character is found, then there are no tokens 39961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm in the string pointed to by S1 and the strtok function returns a null 4002aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm pointer. If such a character is found, it is the start of the first token. 4012aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 4022aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm The strtok function then searches from there for a character that is 4032aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm contained in the current separator string. If no such character is found, 40461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm the current token extends to the end of the string pointed to by S1, and 4052aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm subsequent searches for a token will return a null pointer. If such a 4062aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm character is found, it is overwritten by a null character, which terminates 4072aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm the current token. The strtok function saves a pointer to the following 4082aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm character, from which the next search for a token will start. 4092aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 4102aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm Each subsequent call, with a null pointer as the value of the first 4112aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm argument, starts searching from the saved pointer and behaves as 4122aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm described above. 4132aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 41461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S1 Pointer to the string to be tokenized. 41561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S2 Pointer to a list of separator characters. 41661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 4172aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm @return The strtok function returns a pointer to the first character of a 4182aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm token, or a null pointer if there is no token. 4192aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 42061403bd7ce134c5c1ca0cba4091cff1534926bd2darylmchar *strtok(char * __restrict S1, const char * __restrict S2); 4212aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 4222aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm/* ################ Miscellaneous Functions ########################### */ 4232aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 42461403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The memset function copies the value of C (converted to an unsigned char) 42561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm into each of the first N characters of the object pointed to by S. 42661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 42761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[out] S Pointer to the first element of the object to be set. 42861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] C Value to store in each element of S. 42961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] N Number of elements in S to be set. 4302aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 43161403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @return The memset function returns the value of S. 4322aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 43361403bd7ce134c5c1ca0cba4091cff1534926bd2darylmvoid *memset(void *S, int C, size_t N); 4342aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 43561403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The strerror function maps the number in Num to a message string. 43661403bd7ce134c5c1ca0cba4091cff1534926bd2darylm Typically, the values for Num come from errno, but strerror shall map 4372aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm any value of type int to a message. 4382aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 43961403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] Num A value to be converted to a message. 4402aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 4412aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm @return The strerror function returns a pointer to the string, the 4422aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm contents of which are locale specific. The array pointed to 44361403bd7ce134c5c1ca0cba4091cff1534926bd2darylm must not be modified by the program, but may be overwritten by 4442aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm a subsequent call to the strerror function. 4452aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 44661403bd7ce134c5c1ca0cba4091cff1534926bd2darylmchar *strerror(int Num); 44761403bd7ce134c5c1ca0cba4091cff1534926bd2darylm 44861403bd7ce134c5c1ca0cba4091cff1534926bd2darylm/** The strlen function computes the length of the string pointed to by S. 4492aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 45061403bd7ce134c5c1ca0cba4091cff1534926bd2darylm @param[in] S Pointer to the string to determine the length of. 4512aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 4522aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm @return The strlen function returns the number of characters that 4532aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm precede the terminating null character. 4542aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm**/ 45561403bd7ce134c5c1ca0cba4091cff1534926bd2darylmsize_t strlen(const char *S); 4562aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 4572aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 4582aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm/* ################ BSD Compatibility Functions ####################### */ 4592aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 4602aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylmchar *strdup (const char *); 4612aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylmint strerror_r(int, char *, size_t); 4622aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylmint strcasecmp(const char *s1, const char *s2); 4632aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylmvoid *memccpy (void *, const void *, int, size_t); 46453e1e5c647b73e45569ed6e8b8a0a5b276aa685edarylmint strncasecmp(const char *s1, const char *s2, size_t n); 465d7ce700605e1af0e455e31ec11f19ff21d26b525darylmsize_t strlcpy(char *destination, const char *source, size_t size); 466d7ce700605e1af0e455e31ec11f19ff21d26b525darylmsize_t strlcat(char *destination, const char *source, size_t size); 46753e1e5c647b73e45569ed6e8b8a0a5b276aa685edarylm 468d7ce700605e1af0e455e31ec11f19ff21d26b525darylm// bcopy is is a void function with the src/dest arguments reversed, being used in socket lib 469d7ce700605e1af0e455e31ec11f19ff21d26b525darylm#define bcopy(a,b,c) ( memcpy((void *)b, (const void *)a, (size_t)c)) 47053e1e5c647b73e45569ed6e8b8a0a5b276aa685edarylm 47153e1e5c647b73e45569ed6e8b8a0a5b276aa685edarylm// bcmp is same as memcmp, returns 0 for successful compare, non-zero otherwise 47253e1e5c647b73e45569ed6e8b8a0a5b276aa685edarylm#define bcmp(a,b,c) ( memcmp((void *)a, (void *)b, (size_t)c)) 47353e1e5c647b73e45569ed6e8b8a0a5b276aa685edarylm 474d7ce700605e1af0e455e31ec11f19ff21d26b525darylm/* 475d7ce700605e1af0e455e31ec11f19ff21d26b525darylm * Get next token from string *stringp, where tokens are possibly-empty 476d7ce700605e1af0e455e31ec11f19ff21d26b525darylm * strings separated by characters from delim. 477d7ce700605e1af0e455e31ec11f19ff21d26b525darylm * 478d7ce700605e1af0e455e31ec11f19ff21d26b525darylm * Writes NULs into the string at *stringp to end tokens. 479d7ce700605e1af0e455e31ec11f19ff21d26b525darylm * delim need not remain constant from call to call. 480d7ce700605e1af0e455e31ec11f19ff21d26b525darylm * On return, *stringp points past the last NUL written (if there might 481d7ce700605e1af0e455e31ec11f19ff21d26b525darylm * be further tokens), or is NULL (if there are definitely no more tokens). 482d7ce700605e1af0e455e31ec11f19ff21d26b525darylm * 483d7ce700605e1af0e455e31ec11f19ff21d26b525darylm * If *stringp is NULL, strsep returns NULL. 484d7ce700605e1af0e455e31ec11f19ff21d26b525darylm */ 485d7ce700605e1af0e455e31ec11f19ff21d26b525darylmchar * 486d7ce700605e1af0e455e31ec11f19ff21d26b525darylmstrsep( 487d7ce700605e1af0e455e31ec11f19ff21d26b525darylm register char **stringp, 488d7ce700605e1af0e455e31ec11f19ff21d26b525darylm register const char *delim 489d7ce700605e1af0e455e31ec11f19ff21d26b525darylm ); 4902aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 4912aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm__END_DECLS 4922aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm 4932aa62f2bc9a9654687b377d9ca8a8c2c860a3852darylm#endif /* _STRING_H */ 494