strstr.c 235 B

12345678910111213
  1. /* $Id$ */
  2. /* find first occurrence of wanted in s */
  3. char *
  4. strstr(s, wanted)
  5. register char *s, *wanted;
  6. {
  7. int len = strlen(wanted);
  8. while (*s != *wanted || strncmp(s, wanted, len)) {
  9. if (*s++ == '\0') return 0;
  10. }
  11. return s;
  12. }