aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-05-19 17:46:22 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1995-05-19 17:46:22 -0400
commitc4b5dcfb9180171171a267ee82353ced376157d9 (patch)
treeb207107a5a3e33c6309fda0db299f715409c27e1
parentdca0093028438de3c689757b755f64889eba9c32 (diff)
downloadgcc-c4b5dcfb9180171171a267ee82353ced376157d9.zip
gcc-c4b5dcfb9180171171a267ee82353ced376157d9.tar.gz
gcc-c4b5dcfb9180171171a267ee82353ced376157d9.tar.bz2
(strstr): Define ifndef POSIX.
From-SVN: r9747
-rw-r--r--gcc/cplus-dem.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/cplus-dem.c b/gcc/cplus-dem.c
index 30c5eab..932b6fd 100644
--- a/gcc/cplus-dem.c
+++ b/gcc/cplus-dem.c
@@ -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