X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstring%2Fstrcpy.c;h=94f54b40efc730ebd9074deb19d6b249f8d360f1;hb=5f75278ec2ac5240da801193a7b0cf93cb02e461;hp=03b8563393f53d141a99b6109fd4c681fb1c341f;hpb=e5456e3c2697c4e17fc9aa3439f2e305517b4d96;p=pdclib.old 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