home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / alde_c / misc / lib / dlibssrc / strnicmp.c < prev    next >
Encoding:
Text File  |  1987-06-14  |  357 b   |  17 lines

  1. int strnicmp(str1, str2, limit)
  2. register char *str1;
  3. register char *str2;
  4. register int limit;
  5. /*
  6.  *    Compare strings as with strncmp(), but ignore the case of any
  7.  *    alphabetic characters.
  8.  */
  9. {
  10.     register char c1, c2;
  11.  
  12.     while(((c1 = tolower(*str1++)) == (c2 = tolower(*str2++))) && --limit)
  13.         if(c1 == '\0')
  14.             return(0);
  15.     return(c1 - c2);
  16. }
  17.