mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 07:53:36 +00:00
COMMON: Added scumm_strcasestr()
This commit is contained in:
parent
1ca0510284
commit
6059566777
@ -1323,3 +1323,22 @@ char *scumm_strdup(const char *in) {
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// Portable implementation of strcasestr.
|
||||
const char *scumm_strcasestr(const char *s, const char *find) {
|
||||
char c, sc;
|
||||
size_t len;
|
||||
|
||||
if ((c = *find++) != 0) {
|
||||
c = (char)tolower((unsigned char)c);
|
||||
len = strlen(find);
|
||||
do {
|
||||
do {
|
||||
if ((sc = *s++) == 0)
|
||||
return (NULL);
|
||||
} while ((char)tolower((unsigned char)sc) != c);
|
||||
} while (scumm_strnicmp(s, find, len) != 0);
|
||||
s--;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
@ -568,4 +568,6 @@ extern char *scumm_strdup(const char *in);
|
||||
extern int scumm_compareDictionary(const char *s1, const char *s2);
|
||||
extern const char *scumm_skipArticle(const char *s1);
|
||||
|
||||
extern const char *scumm_strcasestr(const char *s, const char *find);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user