sl@0: /** @file  ../include/string.h
sl@0: @internalComponent
sl@0: */
sl@0: 
sl@0: /** @fn  memccpy(void *t, const void *f, int c, size_t n)
sl@0: @param t
sl@0: @param f
sl@0: @param c
sl@0: @param n
sl@0: @return   memccpy function returns a pointer to the next character in t after c, or NULL if c was not found in the first n characters of f.
sl@0: 
sl@0:   The memccpy function
sl@0: copies bytes from string f to string t. If the character c (as converted to an unsigned char) occurs in the string f, the copy stops and a pointer to the byte after the copy of c in the string t is returned.
sl@0: Otherwise, n bytes are copied, and a NULL pointer is returned.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     char one[50] = {"\0"};
sl@0:     (void) memccpy(one, "abcdefgh",8,3);
sl@0:     printf("String after memcpy %s
sl@0: ",one);
sl@0:     (void) memccpy(one, "Hello",5,1);
sl@0:     printf("String after memcpy %s
sl@0: ",one);
sl@0:     return 0;
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: String after memcpy abc
sl@0: String after memcpy Hbc
sl@0: 
sl@0: @endcode
sl@0: @see bcopy()
sl@0: @see memcpy()
sl@0: @see memmove()
sl@0: @see strcpy()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  memchr(const void *s, int c, size_t n)
sl@0: @param s
sl@0: @param c
sl@0: @param n
sl@0: 
sl@0: @return   The memchr function
sl@0: returns a pointer to the byte located,
sl@0: or NULL if no such byte exists within n bytes.
sl@0: 
sl@0:   The memchr function
sl@0: locates the first occurrence of c (converted to an unsigned char)
sl@0: in string s.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     char one[50];
sl@0:     char* ret;
sl@0:     strcpy(one,"abcd");
sl@0:     ret = memchr("abcd", ’c’,4);
sl@0:     if(!strncmp(one+2,ret,1)) printf("\ ’c\ ’ found in string \"abcd\"\n");
sl@0:     ret = memchr(one, ’z’,4);
sl@0:     if(ret == NULL) printf("\ ’z\ ’ not found in string \"abcd\"\n");           
sl@0:     return 0;
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0:  ’c’ found in string "abcd"
sl@0:  ’z’ not found in string "abcd"
sl@0: 
sl@0: @endcode
sl@0: @see strchr()
sl@0: @see strcspn()
sl@0: @see strpbrk()
sl@0: @see strsep()
sl@0: @see strstr()
sl@0: @see strtok()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  memcmp(const void *s1, const void *s2, size_t n)
sl@0: @param s1
sl@0: @param s2
sl@0: @param n
sl@0: 
sl@0: @return   The memcmp function
sl@0: returns zero if the two strings are identical,
sl@0: otherwise returns the difference between the first two differing bytes
sl@0: (treated as unsigned char values, so that '\\200'
sl@0: is greater than '\\0'
sl@0: for example).
sl@0: Zero-length strings are always identical.
sl@0: 
sl@0:   The memcmp function
sl@0: compares byte string s1 against byte string s2. Both strings are assumed to be n bytes long.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:    char str1[]  = "abcdefg";
sl@0:    char str2[] =  "abcdefr";
sl@0:    int result;
sl@0:    printf( "Compare ’%.6s’ to ’%.6s\n", str1, str2 );
sl@0:    result = memcmp( str1, str2, 6);
sl@0:    if( result < 0 )
sl@0:       printf( "str1 is less than str2.\n" );
sl@0:    else if( result == 0 )
sl@0:       printf( "str1 is equal to str2.\n" );
sl@0:    else if( result > 0 )
sl@0:       printf( "str1 is greater than str2.\n" );
sl@0:    printf( "Compare ’%.7s’ to ’%.7s\n", str1, str2 );
sl@0:    result = memcmp( str1, str2, 7 );
sl@0:    if( result < 0 )
sl@0:       printf( "str1 is less than str2.\n" );
sl@0:    else if( result == 0 )
sl@0:       printf( "str1 is equal to str2.\n" );
sl@0:    else if( result > 0 )
sl@0:       printf( "str1 is greater than str2.\n" );
sl@0:    return 0;    
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: Compare ’abcdef’ to ’abcdef
sl@0: str1 is equal to str2.
sl@0: Compare ’abcdefg’ to ’abcdefr
sl@0: str1 is less than str2.
sl@0: 
sl@0: @endcode
sl@0: @see bcmp()
sl@0: @see strcasecmp()
sl@0: @see strcmp()
sl@0: @see strcoll()
sl@0: @see strxfrm()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  memcpy(void *dst, const void *src, size_t len)
sl@0: @param dst
sl@0: @param src
sl@0: @param len
sl@0: @return   The memcpy function
sl@0: returns the original value of dst.
sl@0: 
sl@0:   The memcpy function
sl@0: copies len bytes from string src to string dst.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     char one[50] = {"\0"};
sl@0:     (void) memcpy(one, "abcdefgh",8);
sl@0:     printf("String after memcpy %s
sl@0: ",one);
sl@0:     (void) memcpy(one, "Hello",5);
sl@0:     printf("String after memcpy %s
sl@0: ",one);
sl@0:     return 0;   
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: String after memcpy abcdefgh
sl@0: String after memcpy Hellofgh
sl@0: 
sl@0: @endcode
sl@0: @see bcopy()
sl@0: @see memccpy()
sl@0: @see memmove()
sl@0: @see strcpy()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  memmove(void *dst, const void *src, size_t len)
sl@0: @param dst
sl@0: @param src
sl@0: @param len
sl@0: 
sl@0:   The memmove function copies len bytes from string src to string dst. The two strings may overlap. The copy is always done in a non-destructive 
sl@0: manner.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     char one[50];
sl@0:     (void) strcpy(one, "abcdefgh");
sl@0:     printf("String before memmove %s
sl@0: ",one);
sl@0:     (void) memmove(one+1, "xyz", 2);
sl@0:     printf("String after memmove %s
sl@0: ",one);
sl@0:     (void) strcpy(one, "abcdefgh");
sl@0:     printf("String before memmove %s
sl@0: ",one);
sl@0:     (void) memmove(one+1, "xyz", 0);
sl@0:     printf("String after memmove %s
sl@0: ",one);
sl@0:     return 0;   
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: String before memmove abcdefgh
sl@0: String after memmove axydefgh
sl@0: String before memmove abcdefgh
sl@0: String after memmove abcdefgh
sl@0: 
sl@0: @endcode
sl@0: @return   The memmove function returns pointer to dst dst.
sl@0: 
sl@0: @see bcopy()
sl@0: @see memcpy()
sl@0: @see strcpy()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  memset(void *dst0, int c0, size_t length)
sl@0: @param dst0
sl@0: @param c0
sl@0: @param length
sl@0: 
sl@0:   The memset function
sl@0: writes length bytes of value c0 (converted to an unsigned char) to the string dst0.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     char one[50];       
sl@0:     strcpy(one, "abcdefgh");
sl@0:     printf("String before memset %s
sl@0: ",one);
sl@0:     memset(one+1, 'x', 3);
sl@0:     printf("String after calling memset first time %s
sl@0: ",one);          
sl@0:     memset(one+2, 'y', 0);
sl@0:     printf("String after calling memset second time %s
sl@0: ",one);
sl@0:     return 0;   
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: String before memset abcdefgh
sl@0: String after calling memset first time axxxefgh
sl@0: String after calling memset second time axxxefgh
sl@0: 
sl@0: @endcode
sl@0: @return   The memset function returns its first argument.
sl@0: 
sl@0: @see bzero()
sl@0: @see swab()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  stpcpy(char *to, const char *from)
sl@0: @param to
sl@0: @param from
sl@0: 
sl@0: Note: This description also covers the following functions -
sl@0:  strcpy()  strncpy() 
sl@0: 
sl@0: @return   The strcpy and strncpy functions
sl@0: return to. The stpcpy function returns a pointer to the terminating ‘\\0’
sl@0: character of to.
sl@0: 
sl@0:   The stpcpy and strcpy functions
sl@0: copy the string from to to (including the terminating ‘\\0’
sl@0: character.)
sl@0: 
sl@0:  The strncpy function copies at most len characters from from into to. If from is less than len characters long,
sl@0: the remainder of to is filled with '\\0'
sl@0: characters.
sl@0: Otherwise, to is not terminated.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     char one[50] = {"abcdefgh"};        
sl@0:     printf("String before strcpy %s
sl@0: ",one);
sl@0:     strcpy(one,"Hello");
sl@0:     printf("String after strcpy %s
sl@0: ",one);
sl@0:     strncpy(one + 5, " ",1);
sl@0:     strncpy(one + 6, "World",5);
sl@0:     printf("String after strncpy %s
sl@0: ",one);
sl@0:     return 0;   
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: String before strcpy abcdefgh
sl@0: String after strcpy Hello
sl@0: String after strncpy Hello World
sl@0: 
sl@0: @endcode
sl@0: Examples:
sl@0:  The following sets chararray to "abc\\0\\0\\0"
sl@0: @code
sl@0: char chararray[6];
sl@0: (void)strncpy(chararray, "abc", sizeof(chararray));
sl@0: 
sl@0: @endcode
sl@0:  The following sets chararray to "abcdef:"
sl@0: @code
sl@0: char chararray[6];
sl@0: (void)strncpy(chararray, "abcdefgh", sizeof(chararray));
sl@0: 
sl@0: @endcode
sl@0:  Note that it does not NULL terminate chararray because the length of the source string is greater than or equal
sl@0: to the length argument. The following copies as many characters from input to buf as will fit and NULL terminates the result.
sl@0: Because strncpy does not guarantee to NULL terminate the string itself, this must be done explicitly.
sl@0: @code
sl@0: char buf[1024];
sl@0: (void)strncpy(buf, input, sizeof(buf) - 1);
sl@0: buf[sizeof(buf) - 1] = ’\0’;
sl@0: 
sl@0: @endcode
sl@0: 
sl@0: Security considerations:
sl@0: 
sl@0:  The strcpy function is easily misused in a manner which enables malicious users
sl@0: to arbitrarily change a running program's functionality through a
sl@0: buffer overflow attack.
sl@0: @see bcopy()
sl@0: @see memcpy()
sl@0: @see memmove()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strcasestr(const char *s, const char *find)
sl@0: @param s
sl@0: @param find
sl@0: 
sl@0: Refer to  strstr() for the documentation
sl@0: @see memchr()
sl@0: @see strchr()
sl@0: @see strcspn()
sl@0: @see strpbrk()
sl@0: @see strrchr()
sl@0: @see strsep()
sl@0: @see strspn()
sl@0: @see strtok()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strcat(char *  s, const char *  append)
sl@0: @param s
sl@0: @param append
sl@0: 
sl@0: Note: This description also covers the following functions -
sl@0:  strncat() 
sl@0: 
sl@0: @return   The strcat and strncat functions
sl@0: return the pointer s.
sl@0: 
sl@0:   The strcat and strncat functions
sl@0: append a copy of the null-terminated string append to the end of the null-terminated string s, then add a terminating ‘\\0’
sl@0: The string s must have sufficient space to hold the result.
sl@0: 
sl@0:  The strncat function
sl@0: appends not more than count characters from append, and then adds a terminating ‘\\0’
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     char one[50] = {"\0"};              
sl@0:     strcpy(one,"Hello");
sl@0:     strcat(one," World");
sl@0:     printf("Concatenated String %s
sl@0: ",one);
sl@0:     return 0;   
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: Concatenated String Hello World
sl@0: 
sl@0: @endcode
sl@0: 
sl@0: Security considerations:
sl@0: 
sl@0:  The strcat function is easily misused in a manner
sl@0: which enables malicious users to arbitrarily change
sl@0: a running program's functionality through a buffer overflow attack. Avoid using strcat. Instead, use strncat or strlcat and ensure that no more characters are copied to the destination buffer
sl@0: than it can hold. Note that strncat can also be problematic.
sl@0: It may be a security concern for a string to be truncated at all.
sl@0: Since the truncated string will not be as long as the original,
sl@0: it may refer to a completely different resource
sl@0: and usage of the truncated resource
sl@0: could result in very incorrect behavior.
sl@0: Example:
sl@0: 
sl@0: @see bcopy()
sl@0: @see memcpy()
sl@0: @see memmove()
sl@0: @see strcpy()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strchr(const char *s, int c)
sl@0: @param s
sl@0: @param c
sl@0: 
sl@0: Note: This description also covers the following functions -
sl@0:  strrchr() 
sl@0: 
sl@0: @return   The functions strchr and strrchr return a pointer to the located character, or NULL if the character does not appear in the string.
sl@0: 
sl@0:   The strchr function locates the first occurrence of c (converted to a char)
sl@0: in the string pointed to by s. The terminating null character is considered part of the string;
sl@0: therefore if c is ‘\\0’
sl@0: the functions locate the terminating ‘\\0’
sl@0: 
sl@0:  The strrchr function is identical to strchr except it locates the last occurrence of c.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:         char one[50];
sl@0:         char* ret;
sl@0:         strcpy(one,"abcd");
sl@0:         ret = strchr("abcd", 'c');
sl@0:         if(!strncmp(one+2,ret,1)) printf("\ 'c\ ' found in string \"abcd\"
sl@0: ");
sl@0:         ret = strchr(one, 'z');
sl@0:         if(ret == NULL) printf("\ 'z\ ' not found in string \"abcd\"
sl@0: ");               
sl@0:         return 0;
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0:  ’c’ found in string "abcd"
sl@0:  ’z’ not found in string "abcd"
sl@0: 
sl@0: @endcode
sl@0: @see memchr()
sl@0: @see strcspn()
sl@0: @see strpbrk()
sl@0: @see strsep()
sl@0: @see strspn()
sl@0: @see strstr()
sl@0: @see strtok()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strcmp(const char *s1, const char *s2)
sl@0: @param s1
sl@0: @param s2
sl@0: 
sl@0: Note: This description also covers the following functions -
sl@0:  strncmp() 
sl@0: 
sl@0: @return   The strcmp and strncmp return an integer greater than, equal to, or less than 0, according 
sl@0: to whether the string s1 is greater than, equal to, or less than the string s2.
sl@0: 
sl@0:   The strcmp and strncmp functions
sl@0: lexicographically compare the null-terminated strings s1 and s2.
sl@0: 
sl@0:  The strncmp function
sl@0: compares not more than len characters.
sl@0: Because strncmp is designed for comparing strings rather than binary data,
sl@0: characters that appear after a ‘\\0’
sl@0: character are not compared.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:    char str1[]  = "abcdefg";
sl@0:    char str2[] =  "abcdefr";
sl@0:    int result;
sl@0:    printf( "Compare '%s' to '%s
sl@0: ", str1, str2 );
sl@0:    result = strcmp( str1, str2);
sl@0:    if( result < 0 )
sl@0:       printf( "str1 is less than str2.
sl@0: " );
sl@0:    else if( result == 0 )
sl@0:       printf( "str1 is equal to str2.
sl@0: " );
sl@0:    else if( result > 0 )
sl@0:       printf( "str1 is greater than str2.
sl@0: " );
sl@0:    printf( "Compare '%.6s' to '%.6s
sl@0: ", str1, str2 );
sl@0:    result = strncmp( str1, str2, 6 );
sl@0:    if( result < 0 )
sl@0:       printf( "str1 is less than str2.
sl@0: " );
sl@0:    else if( result == 0 )
sl@0:       printf( "str1 is equal to str2.
sl@0: " );
sl@0:    else if( result > 0 )
sl@0:       printf( "str1 is greater than str2.
sl@0: " );
sl@0:    return 0;    
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: Compare ’abcdefg’ to ’abcdefr
sl@0: str1 is less than str2.
sl@0: Compare ’abased’ to ’abcdef
sl@0: str1 is equal to str2.
sl@0: 
sl@0: @endcode
sl@0: @see bcmp()
sl@0: @see memcmp()
sl@0: @see strcasecmp()
sl@0: @see strcoll()
sl@0: @see strxfrm()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strcoll(const char *s1, const char *s2)
sl@0: @param s1   
sl@0: @param s2      
sl@0: 
sl@0:   This function lexicographically compares the null-terminated strings s1 and s2 according to the current locale collation, if locale is set. 
sl@0:   Calls strcmp and returns an integer greater than, equal to, or less than 0, to whether s1 is greater than, equal to, or less than s2 if C locale is set.
sl@0:   Otherwise it will compare the strings according to the smartphone's locale collation.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: #include <locale.h>
sl@0: int main()
sl@0: {
sl@0:     int res;
sl@0:     setlocale(LC_ALL,"ar_AE.ISO-8859-6");
sl@0:     if(strcoll("abcde","abcde")==0)
sl@0:        printf("Strings are same
sl@0: ");
sl@0:     return 0;
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: Strings are same
sl@0: 
sl@0: @endcode
sl@0: @return   This  function  returns  an  integer  less than, equal to, or
sl@0: greater than zero if s1 is found, respectively, to  be  less  than,  to
sl@0: match,  or be greater than s2, when both are interpreted as appropriate
sl@0: for the current locale.
sl@0: 
sl@0: @see setlocale()
sl@0: @see strcmp()
sl@0: @see strxfrm()
sl@0: @see wcscoll()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strcpy(char *  from, const char *  to)
sl@0: @param from
sl@0: @param to
sl@0: 
sl@0: Refer to  stpcpy() for the documentation
sl@0: @see bcopy()
sl@0: @see memcpy()
sl@0: @see memmove()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strcspn(const char *s, const char *charset)
sl@0: @param s
sl@0: @param charset
sl@0: @return   The strcspn function
sl@0: returns the number of characters spanned.
sl@0: 
sl@0:   The strcspn function
sl@0: spans the initial part of the null-terminated string s as long as the characters from s do not occur in string charset (it
sl@0: spans the complement of charset). In other words, it computes the string array index in s of the first character of s which is also in charset, else the index of the first null character.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     printf("Number of characters present in s
sl@0:  which are not in charset is %d",strcspn("abcde","df"));
sl@0:     return 0;
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: Number of characters present in s
sl@0:  which are not in charset is 3
sl@0: 
sl@0: @endcode
sl@0: @see memchr()
sl@0: @see strchr()
sl@0: @see strpbrk()
sl@0: @see strrchr()
sl@0: @see strsep()
sl@0: @see strspn()
sl@0: @see strstr()
sl@0: @see strtok()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strdup(const char *str)
sl@0: @param str
sl@0: 
sl@0:   The strdup function
sl@0: allocates sufficient memory for a copy
sl@0: of the string str ,
sl@0: does the copy, and returns a pointer to it.
sl@0: The pointer may subsequently be used as an
sl@0: argument to the function free .
sl@0: 
sl@0:  If insufficient memory is available, NULL is returned and errno is set to ENOMEM .
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     char* ptr;
sl@0:     ptr = (char *)strdup("abcde");
sl@0:     printf("Duplicated string %s
sl@0: ",ptr);
sl@0:     ptr = (char *)strdup("Hello Hi");
sl@0:     printf("Duplicated string %s
sl@0: ",ptr);
sl@0:     return 0;   
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: Duplicated string abcde
sl@0: Duplicated string Hello Hi
sl@0: 
sl@0: @endcode
sl@0: @return   The  strdup()  function  returns a pointer to the duplicated string, or
sl@0: NULL if insufficient memory was available.
sl@0: 
sl@0: @see free()
sl@0: @see malloc()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strndup(const char *old, size_t sz)
sl@0: @param old
sl@0: @param sz
sl@0: 
sl@0:   The strndup function
sl@0: allocates sufficient memory for a copy
sl@0: of the string old ,
sl@0: does the copy of at most sz characters, and returns a pointer to it.
sl@0: If old is longer than sz, only sz characters are copied and a terminating NULL is added.
sl@0: The pointer may subsequently be used as an
sl@0: argument to the function free .
sl@0: 
sl@0:  If insufficient memory is available, NULL is returned and errno is set to ENOMEM .
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: #include <stdlib.h>
sl@0: int main()
sl@0: {
sl@0:     char* ptr;
sl@0:     ptr = (char *)strndup("abcde",3);
sl@0:     printf("Duplicated string %s
sl@0: ",ptr);
sl@0:     ptr = (char *)strndup("Hello Hi",5);
sl@0:     printf("Duplicated string %s
sl@0: ",ptr);
sl@0:     free(ptr);
sl@0:     return 0;   
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: Duplicated string abc
sl@0: Duplicated string Hello
sl@0: 
sl@0: @endcode
sl@0: @return   The  strdup()  function  returns a pointer to the duplicated string, or
sl@0: NULL if insufficient memory was available.
sl@0: 
sl@0: @see free()
sl@0: @see malloc()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn strnlen(const char *s, size_t len)
sl@0: @param s
sl@0: @param len
sl@0: 
sl@0: @return The  strnlen function returns strlen(s), if that is less than len, or len if there is no "\\0" character among the first len characters pointed to by s.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     char one[50];
sl@0:     int ret;
sl@0:     strcpy(one,"abcdef");
sl@0:     ret = strnlen(one,5);
sl@0:     printf("Length obtained using strnlen = %d\n",ret);
sl@0:     ret = strnlen(one,10);
sl@0:     printf("Length obtained using strnlen = %d\n",ret);
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: Length obtained using strnlen = 5
sl@0: Length obtained using strnlen = 6
sl@0: 
sl@0: @endcode
sl@0: Feedback For additional information or queries on this page send feedback
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: 
sl@0: /** @fn  strerror(int num)
sl@0: @param num
sl@0: 
sl@0: Refer to  perror() for the documentation
sl@0: @see intro()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strerror_r(int errnum, char *strerrbuf, size_t buflen)
sl@0: @param errnum
sl@0: @param strerrbuf
sl@0: @param buflen
sl@0: 
sl@0: Refer to  perror() for the documentation
sl@0: @see intro()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strlcat(char *dst, const char *src, size_t size)
sl@0: @param dst
sl@0: @param src
sl@0: @param size
sl@0: 
sl@0: Refer to  strlcpy() for the documentation
sl@0: @see snprintf()
sl@0: @see strncat()
sl@0: @see strncpy()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strlcpy(char *dst, const char *src, size_t size)
sl@0: @param dst
sl@0: @param src
sl@0: @param size
sl@0: 
sl@0: Note: This description also covers the following functions -
sl@0:  strlcat() 
sl@0: 
sl@0: @return   The strlcpy and strlcat functions return the total length of the string they tried to
sl@0: create.
sl@0: For strlcpy that means the length of src .
sl@0: For strlcat that means the initial length of dst plus
sl@0: the length of src .
sl@0: While this may seem somewhat confusing it was done to make
sl@0: truncation detection simple. Note however, that if strlcat traverses size characters without finding a NULL, the length of the string is 
sl@0:   considered to be size and the destination string will not be NULL-terminated (since there 
sl@0:   was no space for the NULL). This prevents strlcat from running off the end of a string. In practice this should 
sl@0:   not happen (as it means that either size is incorrect or that dst is not a proper "C" string). The check exists to prevent potential security problems in incorrect 
sl@0:   code.
sl@0: 
sl@0:   The strlcpy and strlcat functions copy and concatenate strings respectively. They are 
sl@0: designed to be safer, more consistent, and less error prone replacements for strncpy and strncat. Unlike those functions, strlcpy and strlcat take the full size of the buffer (not just the length) and guarantee 
sl@0: to NULL-terminate the result (as long as size is larger than 0 or, in the case of strlcat , as long as there is at least one byte free in dst ). Note that you should include a byte for the NULL in size . Also note that strlcpy and strlcat only operate on true "C" strings. This means that for strlcpy src must be NUL-terminated and for strlcat both src and dst must be NULL-terminated.
sl@0: 
sl@0:  The strlcpy function copies up to size - 1 characters from the NULL-terminated string src to dst , NULL-terminating the result.
sl@0: 
sl@0:  The strlcat function appends the NULL-terminated string src to the end of dst . It will append at most size - strlen(dst) - 1 bytes, NULL-terminating the result.
sl@0: 
sl@0: 
sl@0: 
sl@0: Examples:
sl@0:  The following code fragment illustrates the simple case:
sl@0: @code
sl@0: char *s, *p, buf[BUFSIZ];
sl@0: ...
sl@0: (void)strlcpy(buf, s, sizeof(buf));
sl@0: (void)strlcat(buf, p, sizeof(buf));
sl@0: 
sl@0: @endcode
sl@0:  To detect truncation, perhaps while building a pathname, something
sl@0: like the following might be used:
sl@0: @code
sl@0: char *dir, *file, pname[MAXPATHLEN];
sl@0: ...
sl@0: if (strlcpy(pname, dir, sizeof(pname)) >= sizeof(pname))
sl@0:         goto toolong;
sl@0: if (strlcat(pname, file, sizeof(pname)) >= sizeof(pname))
sl@0:         goto toolong;
sl@0: 
sl@0: @endcode
sl@0:  Since we know how many characters we copied the first time, we can
sl@0: speed things up a bit by using a copy instead of an append:
sl@0: @code
sl@0: char *dir, *file, pname[MAXPATHLEN];
sl@0: size_t n;
sl@0: ...
sl@0: n = strlcpy(pname, dir, sizeof(pname));
sl@0: if (n >= sizeof(pname))
sl@0:         goto toolong;
sl@0: if (strlcpy(pname + n, file, sizeof(pname) - n) >= sizeof(pname) - n)
sl@0:         goto toolong;
sl@0: 
sl@0: @endcode
sl@0:  However, one may question the validity of such optimizations, as they
sl@0: defeat the whole purpose of strlcpy and strlcat .
sl@0: As a matter of fact, the first version of this manual page got it wrong.
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     char one[50] = {"abcdefgh"};
sl@0:     printf("String before strcpy %s
sl@0: ",one);
sl@0:     strlcpy(one,"Hello");
sl@0:     printf("String after strcpy %s
sl@0: ",one);
sl@0:     strlcpy(one + 5, " ",1);
sl@0:     strlcpy(one + 6, "World",5);
sl@0:     printf("String after strncpy %s
sl@0: ",one);
sl@0:     return 0;
sl@0: }
sl@0: 
sl@0: @endcode
sl@0: @see snprintf()
sl@0: @see strncat()
sl@0: @see strncpy()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strlen(const char *str)
sl@0: @param str
sl@0: @return  The strlen() function shall return the length of s; no return value shall be reserved to indicate an error.
sl@0: 
sl@0: The strlen() function shall compute the number of bytes in the string to which s points,
sl@0:  not including the terminating null byte.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     char one[50];
sl@0:     int ret;
sl@0:     strcpy(one,"abcdef");
sl@0:     ret = strnlen(one,5);
sl@0:     printf("Length obtained using strnlen = %d
sl@0: ",ret);
sl@0:     ret = strnlen(one,10);
sl@0:     printf("Length obtained using strnlen = %d
sl@0: ",ret);
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: Length obtained using strnlen = 5
sl@0: Length obtained using strnlen = 6
sl@0: @endcode
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strncat(char * dst, const char * src, size_t n)
sl@0: @param dst
sl@0: @param src
sl@0: @param n
sl@0: 
sl@0: Refer to  strcat() for the documentation
sl@0: @see bcopy()
sl@0: @see memcpy()
sl@0: @see memmove()
sl@0: @see strcpy()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strncmp(const char *s1, const char *s2, size_t n)
sl@0: @param s1
sl@0: @param s2
sl@0: @param n
sl@0: 
sl@0: Refer to  strcmp() for the documentation
sl@0: @see bcmp()
sl@0: @see memcmp()
sl@0: @see strcasecmp()
sl@0: @see strcoll()
sl@0: @see strxfrm()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strncpy(char *  dst, const char *  src, size_t n)
sl@0: @param dst
sl@0: @param src
sl@0: @param n
sl@0: 
sl@0: Refer to  stpcpy() for the documentation
sl@0: @see bcopy()
sl@0: @see memcpy()
sl@0: @see memmove()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strnstr(const char *s, const char *find, size_t slen)
sl@0: @param s
sl@0: @param find
sl@0: @param slen
sl@0: 
sl@0: Refer to  strstr() for the documentation
sl@0: @see memchr()
sl@0: @see strchr()
sl@0: @see strcspn()
sl@0: @see strpbrk()
sl@0: @see strrchr()
sl@0: @see strsep()
sl@0: @see strspn()
sl@0: @see strtok()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strpbrk(const char *s1, const char *s2)
sl@0: @param s1
sl@0: @param s2
sl@0: 
sl@0:   The strpbrk function
sl@0: locates in the null-terminated string s1 the first occurrence of any character in the string s2 and returns a pointer to this character.
sl@0: If no characters from s2 occur anywhere in s1 strpbrk returns NULL.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     char one[50];
sl@0:     char *res;
sl@0:     strcpy(one,"acdb");
sl@0:     res = strpbrk(one, "bc");
sl@0:     if(res != NULL)
sl@0:        printf("%s
sl@0: ",res);
sl@0:     return 0;
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: cdb
sl@0: 
sl@0: @endcode
sl@0: @return   The strpbrk() function returns a pointer to the  character  in  s1  that
sl@0: matches  one  of the characters in accept, or NULL if no such character
sl@0: is found.
sl@0: 
sl@0: @see memchr()
sl@0: @see strchr()
sl@0: @see strcspn()
sl@0: @see strsep()
sl@0: @see strspn()
sl@0: @see strstr()
sl@0: @see strtok()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strrchr(const char *s, int c)
sl@0: @param s
sl@0: @param c
sl@0: 
sl@0: Refer to  strchr() for the documentation
sl@0: @see memchr()
sl@0: @see strcspn()
sl@0: @see strpbrk()
sl@0: @see strsep()
sl@0: @see strspn()
sl@0: @see strstr()
sl@0: @see strtok()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strsep(char **stringp, const char *delim)
sl@0: @param stringp
sl@0: @param delim
sl@0: @return   strsep function returns a pointer to the token, i.e it returns the original value of *stringp
sl@0: 
sl@0:   The strsep function locates, in the string referenced by *stringp ,
sl@0: the first occurrence of any character in the string delim (or the terminating ‘\\0’
sl@0: character) and replaces it with a ‘\\0’.
sl@0: The location of the next character after the delimiter character
sl@0: (or NULL, if the end of the string was reached) is stored in *stringp .
sl@0: The original value of *stringp is returned.
sl@0: 
sl@0:  An "empty"
sl@0: field (i.e., a character in the string delim occurs as the first character of *stringp )
sl@0: can be detected by comparing the location referenced by the returned pointer
sl@0: to ‘\\0’.
sl@0: 
sl@0:  If *stringp is initially NULL , strsep returns NULL .
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     char *one=(char *)malloc(12);
sl@0:     char *res;
sl@0:     char **two=&one;
sl@0:     strcpy(one,"Hello,World");
sl@0:     res=strsep(two,",");
sl@0:     if(strcmp(res,"hello"))
sl@0:     printf("%s
sl@0: ",res);      
sl@0:     return 0;
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: Hello
sl@0: 
sl@0: @endcode
sl@0: @see memchr()
sl@0: @see strchr()
sl@0: @see strcspn()
sl@0: @see strpbrk()
sl@0: @see strspn()
sl@0: @see strstr()
sl@0: @see strtok()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strspn(const char *s, const char *charset)
sl@0: @param s
sl@0: @param charset
sl@0: @return   strspn function returns the number of characters in the initial segment of s which consists only of characters from accept
sl@0: 
sl@0:   The strspn function
sl@0: spans the initial part of the null-terminated string s as long as the characters from s occur in the null-terminated string charset .
sl@0: In other words, it computes the string array index in s of the first character of s which is not in charset ,
sl@0: else the index of the first null character.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     char one[50];
sl@0:     int res;
sl@0:     strcpy(one,"abcba");
sl@0:     res = strspn(one, "abc");
sl@0:     printf(" %d times characters found in the string 
sl@0: ",res);
sl@0:     return 0;
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: 5 times characters found in the string
sl@0: 
sl@0: @endcode
sl@0: @return   The strspn function
sl@0: returns the number of characters spanned.
sl@0: 
sl@0: @see memchr()
sl@0: @see strchr()
sl@0: @see strpbrk()
sl@0: @see strsep()
sl@0: @see strstr()
sl@0: @see strtok()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strstr(const char *s, const char *find)
sl@0: @param s
sl@0: @param find
sl@0: 
sl@0: Note: This description also covers the following functions -
sl@0:  strcasestr()  strnstr() 
sl@0: 
sl@0: @return   The strstr function returns a pointer to the beginning of the substring, or NULL if the substring is not found.If find is an empty string, s is returned;
sl@0: if find occurs nowhere in s , NULL is returned;
sl@0: otherwise a pointer to the first character of the first occurrence of find is returned.
sl@0: 
sl@0: 
sl@0:   The strstr function
sl@0: locates the first occurrence of the null-terminated string find in the null-terminated string s .
sl@0: 
sl@0:  The strcasestr function is similar to strstr ,
sl@0: but ignores the case of both strings.
sl@0: 
sl@0:  The strnstr function
sl@0: locates the first occurrence of the null-terminated string find in the string s ,
sl@0: where not more than slen characters are searched.
sl@0: Characters that appear after a ‘\\0’
sl@0: character are not searched.
sl@0: Since the strnstr function is a specific API, it should only be used when portability is not a concern.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     char *ptr;
sl@0:     ptr = strstr("abcd", "z");
sl@0:     if(ptr == NULL)
sl@0:        printf("strstr: \"z\" not found in \"abcd\"
sl@0: ");
sl@0:     else
sl@0:        printf("strstr: \"z\" found in \"abcd\"
sl@0: ");
sl@0:     ptr = strstr("abcd", "ab");
sl@0:     if(ptr == NULL)
sl@0:        printf("strstr: \"ab\" not found in \"abcd\"
sl@0: ");
sl@0:     else
sl@0:        printf("strstr: \"ab\" found in \"abcd\"
sl@0: ");
sl@0:     ptr = strstr("abcd", "abcde");
sl@0:     if(ptr == NULL)
sl@0:        printf("strstr: \"abcde\" found in \"abcd\"
sl@0: ");
sl@0:     else
sl@0:        printf("strstr: \"abbcde\" not found in \"abcd\"
sl@0: ");
sl@0:     return 0;
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: strstr: "z" not found in "abcd"
sl@0: strstr: "ab" found in "abcd"
sl@0: strstr: "abcde" found in "abcd"
sl@0: 
sl@0: @endcode
sl@0: Examples:
sl@0:  The following sets the pointer ptr to the "Bar Baz"
sl@0: portion of largestring :
sl@0: @code
sl@0: const char *largestring = "Foo Bar Baz";
sl@0: const char *smallstring = "Bar";
sl@0: char *ptr;
sl@0: ptr = strstr(largestring, smallstring);
sl@0: 
sl@0: @endcode
sl@0:  The following sets the pointer ptr to NULL ,
sl@0: because only the first 4 characters of largestring are searched:
sl@0: @code
sl@0: const char *largestring = "Foo Bar Baz";
sl@0: const char *smallstring = "Bar";
sl@0: char *ptr;
sl@0: ptr = strnstr(largestring, smallstring, 4);
sl@0: 
sl@0: @endcode
sl@0: @see memchr()
sl@0: @see strchr()
sl@0: @see strcspn()
sl@0: @see strpbrk()
sl@0: @see strrchr()
sl@0: @see strsep()
sl@0: @see strspn()
sl@0: @see strtok()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strtok(char *s, const char *delim)
sl@0: @param s
sl@0: @param delim
sl@0: 
sl@0: Note: This description also covers the following functions -
sl@0:  strtok_r() 
sl@0: 
sl@0: @return   strtok function returns a pointer to the next token, or NULL if there are no more tokens.
sl@0: 
sl@0:   This interface is superceded by strsep .
sl@0: 
sl@0:  The strtok function
sl@0: is used to isolate sequential tokens in a null-terminated string, s .
sl@0: These tokens are separated in the string by at least one of the
sl@0: characters in delim .
sl@0: The first time that strtok is called, s should be specified; subsequent calls, wishing to obtain further tokens
sl@0: from the same string, should pass a null pointer instead.
sl@0: The separator string, delim ,
sl@0: must be supplied each time, and may change between calls.
sl@0: 
sl@0:  The implementation will behave as if no library function calls strtok .
sl@0: 
sl@0:  The strtok_r function is a reentrant version of strtok .
sl@0: The context pointer last must be provided on each call.
sl@0: The strtok_r function
sl@0: may also be used to nest two parsing loops within one another, as
sl@0: long as separate context pointers are used.
sl@0: 
sl@0:  The strtok and strtok_r functions
sl@0: return a pointer to the beginning of each subsequent token in the string,
sl@0: after replacing the token itself with a NUL character.
sl@0: When no more tokens remain, a null pointer is returned.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     char one[50];
sl@0:     char *res;
sl@0:     strcpy(one,"Hello,World,Hi");
sl@0:     res=strtok(one,",");
sl@0:     if(!strcmp(res,"Hello"))
sl@0:     printf("%s
sl@0: ",res);
sl@0:     res=strtok(NULL,",");
sl@0:     if(!strcmp(res,"World"))
sl@0:     printf("%s
sl@0: ",res);
sl@0:     return 0;
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: Hello
sl@0: World
sl@0: 
sl@0: @endcode
sl@0: @see memchr()
sl@0: @see strchr()
sl@0: @see strcspn()
sl@0: @see strpbrk()
sl@0: @see strsep()
sl@0: @see strspn()
sl@0: @see strstr()
sl@0: @see wcstok()
sl@0: 
sl@0: 
sl@0: Bugs:
sl@0: 
sl@0:  The System V strtok ,
sl@0: if handed a string containing only delimiter characters,
sl@0: will not alter the next starting point, so that a call to strtok with a different (or empty) delimiter string
sl@0: may return a non- NULL value.
sl@0: Since this implementation always alters the next starting point,
sl@0: such a sequence of calls would always return NULL . 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strtok_r(char *s1, const char *s2, char **lasts)
sl@0: @param s1
sl@0: @param s2
sl@0: @param lasts
sl@0: 
sl@0: Refer to  strtok() for the documentation
sl@0: @see memchr()
sl@0: @see strchr()
sl@0: @see strcspn()
sl@0: @see strpbrk()
sl@0: @see strsep()
sl@0: @see strspn()
sl@0: @see strstr()
sl@0: @see wcstok()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  strxfrm(char *  dest, const char *  src, size_t n)
sl@0: @param dest
sl@0: @param src
sl@0: @param n
sl@0: @return   Upon successful completion, strxfrm returns the length of the transformed string not including
sl@0: the terminating null character.
sl@0: If this value is n or more, the contents of dst are indeterminate.
sl@0: 
sl@0:   The strxfrm function transforms a null-terminated string pointed to by src according to the current locale collation if any,
sl@0: then copies the transformed string
sl@0: into dst .
sl@0: Not more than n characters are copied into dst ,
sl@0: including the terminating null character added.
sl@0: If n is set to 0
sl@0: (it helps to determine an actual size needed
sl@0: for transformation), dst is permitted to be a NULL pointer.
sl@0: 
sl@0:  Comparing two strings using strcmp after strxfrm is equal to comparing
sl@0: two original strings with strcoll .
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     char src2[20] = "abc";
sl@0:     char dst1[20] = {’\0’};
sl@0:     char src1[20] = "abc";
sl@0:     char dst2[20] = {’\0’};
sl@0:     int retx1;
sl@0:     int retx2;
sl@0:     int retc;
sl@0:     retx1 = strxfrm(dst1,src1,strlen(src1));
sl@0:     retx2 = strxfrm(dst2,src2,strlen(src2));
sl@0:     if((retc = strcmp(dst1,dst2))== 0)
sl@0:         printf("Strings are same
sl@0: ");
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: Strings are same
sl@0: 
sl@0: @endcode
sl@0: @see setlocale()
sl@0: @see strcmp()
sl@0: @see strcoll()
sl@0: @see wcsxfrm()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: 
sl@0: /** @fn  swab(const void *from, void *to, ssize_t len)
sl@0: @param from
sl@0: @param to
sl@0: @param len
sl@0: 
sl@0:   The function swab copies len bytes from the location referenced by from to the location referenced by to ,
sl@0: swapping adjacent bytes.
sl@0: 
sl@0:  The argument len must be an even number.
sl@0: 
sl@0: Examples:
sl@0: @code
sl@0: #include <string.h>
sl@0: #include <stdio.h>
sl@0: int main()
sl@0: {
sl@0:     int i=0x00003366,j=0x0;
sl@0:     swab((void *)&i;,(void *)&j;,2);
sl@0:     if(j==0x6633)
sl@0:        printf("Ouput val = %#x
sl@0: ",j);
sl@0:     return 0;
sl@0: }
sl@0: 
sl@0: @endcode
sl@0:  Output
sl@0: @code
sl@0: Ouput val = 0x6633
sl@0: 
sl@0: @endcode
sl@0: @see bzero()
sl@0: @see memset()
sl@0: 
sl@0: 
sl@0:  
sl@0: 
sl@0: @publishedAll
sl@0: @externallyDefinedApi
sl@0: */
sl@0: