MISR Toolkit
1.5.1
Util
src
strcasestr.c
Go to the documentation of this file.
1
/*===========================================================================
2
= =
3
= strcasestr =
4
= =
5
=============================================================================
6
7
Jet Propulsion Laboratory
8
MISR
9
MISR Toolkit
10
11
============================================================================*/
12
13
#include "
MisrUtil.h
"
14
#include <string.h>
15
#include <ctype.h>
16
17
/* Since Windows does not include strcasestr, we carry our own implementation */
18
char
*
win_strcasestr
(
const
char
*s,
const
char
*find)
19
{
20
char
c, sc;
21
size_t
len
;
22
23
if
((c = *find++) != 0) {
24
c = tolower((
unsigned
char
)c);
25
len = strlen(find);
26
do
{
27
do
{
28
if
((sc = *s++) == 0)
29
return
NULL;
30
}
while
((
char
)tolower((
unsigned
)sc) != c);
31
}
while
(
strncasecmp
(s, find, len) != 0);
32
s--;
33
}
34
return
((
char
*)s);
35
}
len
HDFFCLIBAPI intf * len
Definition:
hproto_fortran.h:318
strncasecmp
int strncasecmp(const char *s1, const char *s2, size_t n)
Definition:
strncasecmp.c:18
win_strcasestr
char * win_strcasestr(const char *s, const char *find)
Definition:
strcasestr.c:18
MisrUtil.h
MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:52