From: solar Date: Sun, 18 Jan 2004 15:47:39 +0000 (+0000) Subject: Reviewed. X-Git-Tag: OLD~15 X-Git-Url: https://pd.if.org/git/?p=pdclib;a=commitdiff_plain;h=fedb223525324e7ce171f5fe6903430fbd9557bb Reviewed. --- diff --git a/functions/string/strcat.c b/functions/string/strcat.c index a0cef0e..dfbc135 100644 --- a/functions/string/strcat.c +++ b/functions/string/strcat.c @@ -5,32 +5,19 @@ // This code is Public Domain. Use, modify, and redistribute at will. // ---------------------------------------------------------------------------- -char * strcat( char * restrict s1, const char * restrict s2 ) { /* TODO */ }; - -/* Therx code +char * strcat( char * restrict dest, const char * restrict src ) { - while (*s1) + char * dest_p = dest; + if ( *dest_p != '\0' ) { - s1++; + while ( *++dest_p != '\0' ) + { + // EMPTY + } } - while (*s1++ = *s2++) + while ( (*dest_p++ = *src++) != '\0' ) { // EMPTY } - return s1; -} -*/ - -/* PDPC code - unreviewed -{ - char *p = s1; - - while (*p != '\0') p++; - while ((*p = *s2) != '\0') - { - p++; - s2++; - } - return (s1); + return dest; } -*/