(strstr): Define ifndef POSIX.
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 19 May 1995 21:46:22 +0000 (21:46 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 19 May 1995 21:46:22 +0000 (21:46 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@9747 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cplus-dem.c

index 30c5eab..932b6fd 100644 (file)
@@ -37,6 +37,30 @@ extern char *xmalloc PARAMS((unsigned));
 extern char *xrealloc PARAMS((char *, unsigned));
 extern char *strstr ();
 
+#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
+
 /* In order to allow a single demangler executable to demangle strings
    using various common values of CPLUS_MARKER, as well as any specific
    one set at compile time, we maintain a string containing all the