Back to index

courier  0.68.2
strncasecmp.c
Go to the documentation of this file.
00001 #include "config.h"
00002 /*
00003 ** Copyright 1998 - 1999 Double Precision, Inc.  See COPYING for
00004 ** distribution information.
00005 */
00006 
00007 
00008 /*
00009 */
00010 #include      <ctype.h>
00011 #include      <string.h>
00012 
00013 int strncasecmp(const char *a, const char *b, size_t n)
00014 {
00015        while (n && (*a || *b))
00016        {
00017        int    ca=toupper(*a);
00018        int    cb=toupper(*b);
00019 
00020               if (ca < cb)  return (-1);
00021               if (ca > cb)  return (1);
00022               ++a;
00023               ++b;
00024               --n;
00025        }
00026        return (0);
00027 }