BOOTSTRAP (kutils) functions


LIBRARY ROUTINE

kstrcasecmp - do a case insensitive string compare

LIBRARY CALL

int kstrcasecmp(
   const char *istr1,
   const char *istr2)

INPUT

OUTPUT

none

RETURN VALUE

If the two strings are identical, ignoring case differences, the value of 0 is returned. If the two strings differ, the difference of ASCII values between the first character in each string that differs will be returned. If the ASCII value of the differing character in 'istr1' is greater than the one in 'istr2', then the return value is positive, and implies that 'istr1' is greater than 'istr2'. If the difference between the two ASCII values is negative, the return value implies that 'istr2' is greater than 'istr1'.

DESCRIPTION

This function does a case insensitive comparison of two strings. It does a character by character comparison of both input strings, ignoring the case of alphabetic characters, until the current character for one string is not equal the current character in the other string. This continues until the end of one or both of the strings is reached. It protects against NULL on the input strings by replacing NULL pointers with a reference to an empty string.

ADDITIONAL INFORMATION

none

EXAMPLES

The following example takes two strings that are equal if you ignore case, and passes them to string compare.
char *s1 = "John Doe";
char *s2 = "john DOE";
int   result;

result = kstrcasecmp(s1, s2); kprintf("The result is '%d'\n", result);

The output that will be printed is 0.

SIDE EFFECTS

none

RESTRICTIONS

none

MODIFICATION

none

FILES

$BOOTSTRAP/objects/library/kutils/src/strings.c

SEE ALSO

kutils(3)

COPYRIGHT

Copyright (C) 1993 - 1997, Khoral Research, Inc. ("KRI") All rights reserved.