home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / clib / progs / utilslib / c / Strnlcmp < prev    next >
Encoding:
Text File  |  1991-04-20  |  433 b   |  20 lines

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