]> pd.if.org Git - pdclib/blob - functions/string/strcpy.c
PDCLib includes with quotes, not <>.
[pdclib] / functions / string / strcpy.c
1 /* strcpy( char *, const char * )
2
3    This file is part of the Public Domain C Library (PDCLib).
4    Permission is granted to use, modify, and / or redistribute at will.
5 */
6
7 #include <string.h>
8
9 #ifndef REGTEST
10
11 char * strcpy( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 )
12 {
13     char * rc = s1;
14     while ( ( *s1++ = *s2++ ) );
15     return rc;
16 }
17
18 #endif
19
20 #ifdef TEST
21 #include "_PDCLIB_test.h"
22
23 int main( void )
24 {
25     char s[] = "xxxxx";
26     TESTCASE( strcpy( s, "" ) == s );
27     TESTCASE( s[0] == '\0' );
28     TESTCASE( s[1] == 'x' );
29     TESTCASE( strcpy( s, abcde ) == s );
30     TESTCASE( s[0] == 'a' );
31     TESTCASE( s[4] == 'e' );
32     TESTCASE( s[5] == '\0' );
33     return TEST_RESULTS;
34 }
35 #endif