X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstring%2Fstrncat.c;h=1bc202398636595fb72da31940acc6c4d47bdd88;hp=624ac0387933ed1210f859e67f78a9519febfdd4;hb=0a5395faab237ba9008352b0f4bee9659bbd3d5f;hpb=34893ecc2200dc7017c36a54cb6c5f4c2378b5ec diff --git a/functions/string/strncat.c b/functions/string/strncat.c index 624ac03..1bc2023 100644 --- a/functions/string/strncat.c +++ b/functions/string/strncat.c @@ -6,3 +6,21 @@ // ---------------------------------------------------------------------------- char * strncat( char * restrict s1, const char * restrict s2, size_t n ) { /* TODO */ }; + +/* PDPC code - unreviewed +{ + char *p = s1; + size_t x = 0; + + while (*p != '\0') p++; + while ((*s2 != '\0') && (x < n)) + { + *p = *s2; + p++; + s2++; + x++; + } + *p = '\0'; + return (s1); +} +*/