home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / prog_c / mklib.lzh / MKLIB / EDLIB / STRNICMP.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-16  |  407 b   |  18 lines

  1. /* edlib  version 1.0 of 04/08/88 */
  2. #include <ctype.h>
  3.  
  4. int strnicmp(str1,str2,len)
  5. char *str1,*str2;
  6. int len;
  7. {
  8.     int index = 0;
  9.  
  10.     while ( str1[index] && str2[index] && index < len &&
  11.             tolower(str1[index]) == tolower(str2[index]) )
  12.         ++index;
  13.  
  14.     return( (tolower(str1[index]) < tolower(str2[index])) ? -1 :
  15.           ( (tolower(str1[index]) > tolower(str2[index])) ?  1 : 0) );
  16. }
  17.  
  18.