- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Chris Torek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above co
| 259 | * SUCH DAMAGE. |
| 260 | */ |
| 261 | char *strcasestr(const char *s, const char *find) |
| 262 | { |
| 263 | char c, sc; |
| 264 | size_t len; |
| 265 | |
| 266 | if ((c = *find++) != 0) { |
| 267 | c = tolower((unsigned char)c); |
| 268 | len = strlen(find); |
| 269 | do { |
| 270 | do { |
| 271 | if ((sc = *s++) == 0) |
| 272 | return (NULL); |
| 273 | } while ((char)tolower((unsigned char)sc) != c); |
| 274 | } while (strncasecmp(s, find, len) != 0); |
| 275 | s--; |
| 276 | } |
| 277 | return ((char *)s); |
| 278 | } |
| 279 | #endif |
| 280 | |
| 281 | #ifdef NEED_STRDUP |
no test coverage detected