summaryrefslogtreecommitdiff
path: root/src/string/strcpy.c
blob: b6e3ed11565ca7f864fb8445005c99e119207b72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <string.h>
#include "_assert.h"

/** copy string **/

char * strcpy(char * restrict s1, const char * restrict s2)
{
	char *p = s1;

	ASSERT_NONNULL(s1);
	ASSERT_NONNULL(s2);
	ASSERT_NOOVERLAP(s1, s2, strlen(s2));

	while ((*s1++ = *s2++) != '\0') {
		continue;
	}

	/*
	RETURN_ALWAYS(ARGUMENT(s1));
	*/
	return p;
}

/***
copies the string at ARGUMENT(s2) to ARGUMENT(s1), up to and
including the terminating CHAR(\0).
***/

/*
STDC(1)
*/