1 |
/* strncasecmp.c -- case insensitive string comparator |
/* strncasecmp.c -- case insensitive string comparator |
2 |
Copyright (C) 1998, 1999 Free Software Foundation, Inc. |
Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
5 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
23 |
#include "strcase.h" |
#include "strcase.h" |
24 |
|
|
25 |
#include <ctype.h> |
#include <ctype.h> |
26 |
|
#include <limits.h> |
27 |
|
|
28 |
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) |
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) |
29 |
|
|
55 |
} |
} |
56 |
while (c1 == c2); |
while (c1 == c2); |
57 |
|
|
58 |
return c1 - c2; |
if (UCHAR_MAX <= INT_MAX) |
59 |
|
return c1 - c2; |
60 |
|
else |
61 |
|
/* On machines where 'char' and 'int' are types of the same size, the |
62 |
|
difference of two 'unsigned char' values - including the sign bit - |
63 |
|
doesn't fit in an 'int'. */ |
64 |
|
return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0); |
65 |
} |
} |