FA> Yes, they are. But i thought re-writing standard library functions
FA> would be a no-no,
You aren't rewriting standard library functions, since there is
no case-insensitive strstr() in the standard library!
FA> Btw, perhaps you've posted the wrong one, that was case sensitive.
That was the only one I had.
FA> I've pinched your variable names, hope you don't mind, but it makes
FA> it more readable than the way it was with mine.
It is public domain, I don't care what you do with it. Actually,
if your strstr() is better than mine, I might use yours in
PDPCLIB. BFN. Paul.
P.S. I used it, but it didn't work properly. Wanna modify this
(formatted) version so that it works?
/* strstr by Frank Adam */
char *strstr(const char *s1, const char *s2)
{
const char *p = s1, *p1 = s2, *p2;
while (*p++) /* this ++ is suspicous */
{
if (*p == *p1)
{
p2 = p;
while (*p++ == *p1 && *p1++) ;
if (!*p1)
{
return (char *)p2;
}
p = ++p2;
p1 = s2;
}
}
return NULL;
}
@EOT:
---
* Origin: X (3:711/934.9)
|