X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstring%2Fstrcpy.c;h=94f54b40efc730ebd9074deb19d6b249f8d360f1;hp=03b8563393f53d141a99b6109fd4c681fb1c341f;hb=19b4cc9a30c2ede7a0cd6c417b5f26851376b708;hpb=419762f3c5da2a601e3c7427e25ae01293a73223 diff --git a/functions/string/strcpy.c b/functions/string/strcpy.c index 03b8563..94f54b4 100644 --- a/functions/string/strcpy.c +++ b/functions/string/strcpy.c @@ -5,24 +5,12 @@ // This code is Public Domain. Use, modify, and redistribute at will. // ---------------------------------------------------------------------------- -char * strcpy( char * restrict s1, const char * restrict s2 ) { /* TODO */ }; - -/* Therx code - unreviewed +char * strcpy( char * restrict dest, const char * restrict src ) { - while (*s1++ = *s2++) + char * tmp = dest; + while ( ( *dest++ = *src++ ) != '\0' ) { // EMPTY } - return s1; -} -*/ - -/* PDPC code - unreviewed -char *strcpy(char *s1, const char *s2) -{ - char *p = s1; - - while ((*p++ = *s2++) != '\0') ; - return (s1); + return tmp; } -*/ \ No newline at end of file