summaryrefslogtreecommitdiff
path: root/src/string/strcpy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/string/strcpy.c')
-rw-r--r--src/string/strcpy.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/string/strcpy.c b/src/string/strcpy.c
new file mode 100644
index 00000000..cf4eeb21
--- /dev/null
+++ b/src/string/strcpy.c
@@ -0,0 +1,29 @@
+#include <string.h>
+#include "nonstd/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)
+*/