* Find the first occurrence of find in s. */
| 42 | * Find the first occurrence of find in s. |
| 43 | */ |
| 44 | char * |
| 45 | strstr(const char *s, const char *find) |
| 46 | { |
| 47 | char c, sc; |
| 48 | size_t len; |
| 49 | |
| 50 | if ((c = *find++) != 0) { |
| 51 | len = strlen(find); |
| 52 | do { |
| 53 | do { |
| 54 | if ((sc = *s++) == '\0') |
| 55 | return (NULL); |
| 56 | } while (sc != c); |
| 57 | } while (strncmp(s, find, len) != 0); |
| 58 | s--; |
| 59 | } |
| 60 | return (__DECONST(char *, s)); |
| 61 | } |