Commit 27a2e668 by Jason Merrill

Define strstr.

From-SVN: r9696
parent 8bd57699
...@@ -363,6 +363,30 @@ my_strerror (e) ...@@ -363,6 +363,30 @@ my_strerror (e)
return buffer; return buffer;
#endif #endif
} }
#ifndef POSIX
char *
strstr (s1, s2)
char *s1, *s2;
{
register char *p = s1;
extern char *strchr ();
extern int strncmp ();
#if __GNUC__==2
extern __SIZE_TYPE__ strlen ();
#endif
register int len = strlen (s2);
for (; (p = strchr (p, *s2)) != 0; p++)
{
if (strncmp (p, s2, len) == 0)
{
return (p);
}
}
return (0);
}
#endif
/* Delete tempfiles and exit function. */ /* Delete tempfiles and exit function. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment