PE> /* strstr by Frank Adam */
FA> char *strstr(const char *s1, const char *s2)
FA> {
FA> const char *p = s1, *p1 = s2, *p2;
FA> while (*p) /* this ++ is suspicous. No, it's not, just wrong:) */
FA> {
FA> if (*p == *p1)
FA> {
FA> p2 = p;
FA> while (*p++ == *p1 && *p1++) /* ";" whoops! */
I think you want a ";" here. ";" is equivalent to
"{}". You
want a do-nothing loop, no? BFN. Paul.
FA> if (!*p1)
FA> {
FA> return (char *)p2;
FA> }
FA> p = p2; /* p = ++p2; ah-oh, another bug morteined. */
FA> p1 = s2;
FA> }
FA> p++;
FA> }
FA> return NULL;
FA> }
BFN. Paul.
@EOT:
---
* Origin: X (3:711/934.9)
|