X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstring%2Fstrcpy.c;h=f9b340ef691d6944cf000eb59d117f43be71a9bd;hb=c8f799d852e3698468a78954d82588e841cc0b70;hp=1cc1c8e9eedfbec677d2008949211770da261d71;hpb=dcc8a8e99f69e090a03b7b868443addbc0817820;p=pdclib.old diff --git a/functions/string/strcpy.c b/functions/string/strcpy.c index 1cc1c8e..f9b340e 100644 --- a/functions/string/strcpy.c +++ b/functions/string/strcpy.c @@ -1,8 +1,16 @@ -// ---------------------------------------------------------------------------- -// $Id$ -// ---------------------------------------------------------------------------- -// Public Domain C Library - http://pdclib.sourceforge.net -// This code is Public Domain. Use, modify, and redistribute at will. -// ---------------------------------------------------------------------------- +/* ---------------------------------------------------------------------------- + * $Id$ + * ---------------------------------------------------------------------------- + * Public Domain C Library - http://pdclib.sourceforge.net + * This code is Public Domain. Use, modify, and redistribute at will. + * --------------------------------------------------------------------------*/ -char * strcpy( char * restrict s1, const char * restrict s2 ) { /* TODO */ }; +char * strcpy( char * restrict dest, const char * restrict src ) +{ + char * tmp = dest; + while ( ( *dest++ = *src++ ) != '\0' ) + { + /* EMPTY */ + } + return tmp; +}