sl@0: /** @file ../include/strings.h sl@0: @internalComponent sl@0: */ sl@0: sl@0: /** @fn bcmp(const void *b1, const void *b2, size_t length) sl@0: @param b1 sl@0: @param b2 sl@0: @param length sl@0: @return bcmp function returns 0 if the byte sequences are equal and non-zero sl@0: otherwise. sl@0: sl@0: The bcmp function compares byte string b1 against byte string b2, returning zero if they are identical and non-zero otherwise. Both sl@0: strings are assumed to be length bytes long. Zero-length strings are always identical. sl@0: sl@0: The strings may overlap. sl@0: sl@0: Examples: sl@0: @code sl@0: #include sl@0: #include sl@0: int main() sl@0: { sl@0: int ret = 0; sl@0: ret = bcmp("a","a",1); sl@0: printf("bcmp(\"a\",\"a\",1) is %d",ret); sl@0: ret = bcmp("abcd","abce",4); sl@0: printf(" sl@0: bcmp(\"abcd\",\"abce\",1) is %d",ret); sl@0: ret = bcmp("abc","xyz",0); sl@0: printf(" sl@0: bcmp(\"abc\",\"xyz\",0) is %d",ret); sl@0: return 0; sl@0: } sl@0: sl@0: @endcode sl@0: Output sl@0: @code sl@0: bcmp("a","a",1) is 0 sl@0: bcmp("abcd","abce",1) is -1 sl@0: bcmp("abc","xyz",0) is 0 sl@0: sl@0: @endcode sl@0: @see memcmp() 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 bcopy(const void *src0, void *dst0, size_t length) sl@0: @param src0 sl@0: @param dst0 sl@0: @param length sl@0: sl@0: The bcopy function copies length bytes from string src0 to string dst0 . The two strings may overlap. If length is zero no bytes are copied. sl@0: sl@0: Examples: sl@0: @code sl@0: #include sl@0: #include sl@0: int main() sl@0: { sl@0: char dst[50]; sl@0: bcopy("Hello World",dst,12); sl@0: printf("Destination string after bcopy = %s sl@0: ",dst); sl@0: return 0; sl@0: } sl@0: sl@0: @endcode sl@0: Output sl@0: @code sl@0: Destination string after bcopy = Hello World sl@0: sl@0: @endcode sl@0: @see memccpy() 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 bzero(void *b, size_t len) sl@0: @param b sl@0: @param len sl@0: sl@0: The bzero function sl@0: writes len zero bytes to the string b. If len is zero, bzero does nothing. sl@0: sl@0: Examples: sl@0: @code sl@0: #include sl@0: #include sl@0: int main() sl@0: { sl@0: char dst[50] = "abcdef"; sl@0: bzero(dst + 2, 2); sl@0: if(!strcmp(dst, "ab")) printf("dst = %s sl@0: ",dst); sl@0: if(!strcmp(dst+3, "")) printf("zeros added to dst string sl@0: "); sl@0: if(!strcmp(dst + 4, "ef")) printf("dst + 4 = %s sl@0: ",dst); sl@0: return 0; sl@0: } sl@0: sl@0: @endcode sl@0: Output sl@0: @code sl@0: dst = ab sl@0: zeros added to dst string sl@0: dst + 4 = ab sl@0: sl@0: @endcode sl@0: @see memset() 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 ffs(int mask) sl@0: @param mask sl@0: sl@0: Note: This description also covers the following functions - sl@0: ffsl() fls() flsl() sl@0: sl@0: @return sl@0: sl@0: The ffs and ffsl functions find the first bit set in mask and return the index of that bit. sl@0: sl@0: The fls and flsl functions find the last bit set in mask and return the index of that bit. sl@0: sl@0: Bits are numbered starting from 1, starting at the right-most sl@0: (least significant) bit. sl@0: A return value of zero from any of these functions means that the sl@0: argument was zero. sl@0: sl@0: Examples: sl@0: @code sl@0: #include sl@0: #include sl@0: int main() sl@0: { sl@0: int i = 0x10; sl@0: int j = ffs(i); sl@0: if(j == 5) printf("First bit position in 0x10 is %d sl@0: ",j); sl@0: return 0; sl@0: } sl@0: sl@0: @endcode sl@0: Output sl@0: @code sl@0: First bit position in 0x10 is 5 sl@0: @endcode sl@0: sl@0: sl@0: sl@0: @publishedAll sl@0: @externallyDefinedApi sl@0: */ sl@0: sl@0: /** @fn index(const char *p, int ch) sl@0: @param p sl@0: @param ch sl@0: Note: This description also covers the following functions - sl@0: rindex() sl@0: sl@0: @return The functions index and rindex return a pointer to the located character, or NULL if the character does not appear in the string. sl@0: sl@0: The index function locates the first occurrence of ch (converted to a char ) in the string pointed to by p. The terminating null character is considered part of the string; therefore if ch is ‘\\0,’ the functions locate the terminating ‘\\0.’ sl@0: sl@0: The rindex function is identical to index, except it locates the last occurrence of ch. sl@0: sl@0: Examples: sl@0: @code sl@0: #include sl@0: #include sl@0: int main() sl@0: { sl@0: char one[50]; sl@0: char* ret; sl@0: strcpy(one,"abcd"); sl@0: ret = index(one, ’c’); sl@0: if(!strncmp(one+2,ret,1)) printf("index of \ ’c\ ’ in string \"abcd\" is %d \n",2); sl@0: ret = index(one, ’z’); sl@0: if(ret == NULL) printf("\ ’z\ ’ not found in string \"abcd\"\n"); sl@0: ret = index(one, ’\0’); sl@0: if(!strncmp(one+4,ret,1)) printf("index of \ ’\ \0\ ’ in string \"abcd\" is %d\n",4); sl@0: strcpy(one,"cdcab"); sl@0: ret = rindex(one, ’c’); sl@0: if(!strncmp(one+2,ret,1)) printf("rindex of \ ’c\ ’ in string \"cscab\" is %d\n",2); sl@0: strcpy(one,"dcab"); sl@0: ret = rindex(one, ’\0’); sl@0: if(!strncmp(one+4,ret,1)) printf("index of \ ’\ \0\ ’ in string \"dcab\" is %d\n",4); sl@0: return 0; sl@0: } sl@0: sl@0: @endcode sl@0: Output sl@0: @code sl@0: index of ’c’ in string "abcd" is 2 sl@0: ’z’ not found in string "abcd" sl@0: index of ’\0’ in string "abcd" is 4 sl@0: rindex of ’c’ in string "cscab" is 2 sl@0: index of ’\0’ in string "dcab" is 4 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 strtok() sl@0: sl@0: sl@0: sl@0: sl@0: @publishedAll sl@0: @externallyDefinedApi sl@0: */ sl@0: sl@0: /** @fn rindex(const char *p, int ch) sl@0: @param p sl@0: @param ch sl@0: sl@0: Refer to index() 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 strtok() sl@0: sl@0: sl@0: sl@0: sl@0: @publishedAll sl@0: @externallyDefinedApi sl@0: */ sl@0: sl@0: /** @fn strcasecmp(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: strncasecmp() sl@0: sl@0: @return The strcasecmp and strncasecmp return an integer greater than, equal to, or less than 0, sl@0: according to whether s1 is lexicographically greater than, equal to, or less than s2 after translation of each corresponding character to lower-case. The sl@0: strings themselves are not modified. sl@0: sl@0: The strcasecmp and strncasecmp functions sl@0: compare the null-terminated strings s1 and s2. The strcasecmp() function compares the two strings s1 and s2 , ignoring sl@0: the case of the characters. sl@0: sl@0: The strncasecmp compares at most len characters. sl@0: sl@0: Examples: sl@0: @code sl@0: #include sl@0: #include sl@0: int main() sl@0: { sl@0: int ret; sl@0: ret = strcasecmp("ABC","abc"); sl@0: printf("strcasecmp of \"ABC\" \"abc\" is %d sl@0: ",ret); sl@0: ret = strcasecmp("abc","abc"); sl@0: printf("strcasecmp of \"abc\" \"abc\" is %d sl@0: ",ret); sl@0: return 0; sl@0: } sl@0: sl@0: @endcode sl@0: Output sl@0: @code sl@0: strcasecmp of "ABC" "abc" is 0 sl@0: strcasecmp of "abc" "abc" is 0 sl@0: sl@0: @endcode sl@0: @see bcmp() sl@0: @see memcmp() sl@0: @see strcmp() sl@0: @see strcoll() sl@0: @see strxfrm() sl@0: @see tolower() sl@0: sl@0: sl@0: sl@0: sl@0: @publishedAll sl@0: @externallyDefinedApi sl@0: */ sl@0: sl@0: /** @fn strncasecmp(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 strcasecmp() for the documentation sl@0: @see bcmp() sl@0: @see memcmp() sl@0: @see strcmp() sl@0: @see strcoll() sl@0: @see strxfrm() sl@0: @see tolower() sl@0: sl@0: sl@0: sl@0: sl@0: @publishedAll sl@0: @externallyDefinedApi sl@0: */ sl@0: