File: strncasecmp.c

package info (click to toggle)
courier 1.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 54,444 kB
  • sloc: ansic: 130,619; cpp: 33,255; sh: 10,437; perl: 4,250; makefile: 3,447; sed: 39
file content (27 lines) | stat: -rw-r--r-- 391 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "config.h"
/*
** Copyright 1998 - 1999 Double Precision, Inc.  See COPYING for
** distribution information.
*/


/*
*/
#include	<ctype.h>
#include	<string.h>

int strncasecmp(const char *a, const char *b, size_t n)
{
	while (n && (*a || *b))
	{
	int	ca=toupper(*a);
	int	cb=toupper(*b);

		if (ca < cb)	return (-1);
		if (ca > cb)	return (1);
		++a;
		++b;
		--n;
	}
	return (0);
}