4 /* Copyright 1998 by the Massachusetts Institute of Technology.
6 * Permission to use, copy, modify, and distribute this
7 * software and its documentation for any purpose and without
8 * fee is hereby granted, provided that the above copyright
9 * notice appear in all copies and that both that copyright
10 * notice and this permission notice appear in supporting
11 * documentation, and that the name of M.I.T. not be used in
12 * advertising or publicity pertaining to distribution of the
13 * software without specific, written prior permission.
14 * M.I.T. makes no representations about the suitability of
15 * this software for any purpose. It is provided "as is"
16 * without express or implied warranty.
20 #include "ares_strcasecmp.h"
22 #ifndef HAVE_STRCASECMP
23 int ares_strcasecmp(const char *a, const char *b)
25 #if defined(HAVE_STRCMPI)
27 #elif defined(HAVE_STRICMP)
32 for (i = 0; i < (size_t)-1; i++) {
33 int c1 = ISUPPER(a[i]) ? tolower(a[i]) : a[i];
34 int c2 = ISUPPER(b[i]) ? tolower(b[i]) : b[i];
45 #ifndef HAVE_STRNCASECMP
46 int ares_strncasecmp(const char *a, const char *b, size_t n)
48 #if defined(HAVE_STRNCMPI)
49 return strncmpi(a, b, n);
50 #elif defined(HAVE_STRNICMP)
51 return strnicmp(a, b, n);
55 for (i = 0; i < n; i++) {
56 int c1 = ISUPPER(a[i]) ? tolower(a[i]) : a[i];
57 int c2 = ISUPPER(b[i]) ? tolower(b[i]) : b[i];