X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstring%2Fstrncmp.c;h=ec9c56fb2a780e1a2a40efee5451c4c7836975df;hb=e5456e3c2697c4e17fc9aa3439f2e305517b4d96;hp=d0434a54f3b53f38747b51fbd7c461899883de14;hpb=dcc8a8e99f69e090a03b7b868443addbc0817820;p=pdclib.old diff --git a/functions/string/strncmp.c b/functions/string/strncmp.c index d0434a5..ec9c56f 100644 --- a/functions/string/strncmp.c +++ b/functions/string/strncmp.c @@ -6,3 +6,22 @@ // ---------------------------------------------------------------------------- int strncmp( const char * s1, const char * s2, size_t n ) { /* TODO */ }; + +/* PDPC code - unreviewed +{ + const unsigned char *p1; + const unsigned char *p2; + size_t x = 0; + + p1 = (const unsigned char *)s1; + p2 = (const unsigned char *)s2; + while (x < n) + { + if (p1[x] < p2[x]) return (-1); + else if (p1[x] > p2[x]) return (1); + else if (p1[x] == '\0') return (0); + x++; + } + return (0); +} +*/