]> pd.if.org Git - pdclib/blobdiff - functions/string/strstr.c
Merged PDPCLIB and Therx code.
[pdclib] / functions / string / strstr.c
index b2494234b23df4944ef119071c7e04ed40e3be8f..a1f8b74b329c428f1e825acfdaa568bda6c75c09 100644 (file)
@@ -15,3 +15,25 @@ char * strstr( char * s1, const char * s2 ) { /* TODO */ };
 // Standard C
 
 char * strstr( const char * s1, const char * s2 ) { /* TODO */ };
+
+/* PDPC code - unreviewed
+{
+    const char *p = s1, *p1, *p2 = s2;
+
+    while (*p)
+    {
+        if (*p == *s2)
+        {
+            p1 = p;
+            p2 = s2;
+            while ((*p2 != '\0') && (*p1++ == *p2++)) ;
+            if (*p2 == '\0')
+            {
+                return (char *)p;
+            }
+        }
+        p++;
+    }
+    return NULL;
+}
+*/