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