home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / clib / progs / utilslib / utils_old / c / Strnlcmp < prev    next >
Encoding:
Text File  |  1994-02-22  |  419 b   |  18 lines

  1. /*      > C.Strnlcmp    - compare two strings for n bytes, ignoring case */
  2.  
  3. #include <ctype.h>
  4. #include "utils.h"
  5.  
  6. int strnlcmp (const char *s, const char *t, int n)
  7. {
  8.         while ( --n >= 0 )
  9.         {
  10.                 if ( *s == '\0' || *t == '\0' || tolower(*s) != tolower(*t) )
  11.                         return (tolower(*s) - tolower(*t));
  12.                 ++s;
  13.                 ++t;
  14.         }
  15.  
  16.         return (0);
  17. }
  18.