]> pd.if.org Git - pdclib/blobdiff - functions/string/strcmp.c
Merged PDPCLIB and Therx code.
[pdclib] / functions / string / strcmp.c
index 9906f49aa07b140883fc420c0c2dd1b91e50c285..17e138cdf2b989a389e385982112bbda9e6cd42f 100644 (file)
@@ -6,3 +6,33 @@
 // ----------------------------------------------------------------------------
 
 int strcmp( const char * s1, const char * s2 ) { /* TODO */ };
+
+/* Therx code
+{
+    while ((*s1 != '\0') && (*s1 == *s2))
+    {
+        s1++;
+        s2++;
+    }
+    return (*(unsigned char *) s1) - (*(unsigned char *) s2);
+}
+*/
+
+/* PDPC code - unreviewed
+{
+    const unsigned char *p1;
+    const unsigned char *p2;
+    
+    p1 = (const unsigned char *)s1;
+    p2 = (const unsigned char *)s2;
+    while (*p1 != '\0')
+    {
+        if (*p1 < *p2) return (-1);
+        else if (*p1 > *p2) return (1);
+        p1++;
+        p2++;
+    }
+    if (*p2 == '\0') return (0);
+    else return (-1);
+}
+*/