diff options
author | Jakob Kaivo <jkk@ung.org> | 2020-08-16 15:55:19 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2020-08-16 15:55:19 -0400 |
commit | e223e635cc53fa11e473cdbc864eb69a3da5f290 (patch) | |
tree | d481ca6fb0b7f4184f3ec259a6f9c37d76e56a26 /src/string/strcpy_s.c | |
parent | 700fbd205a1a428677876d322606b9a354221892 (diff) |
add skeleton of symbols from C11 LIB_EXT1
Diffstat (limited to 'src/string/strcpy_s.c')
-rw-r--r-- | src/string/strcpy_s.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/string/strcpy_s.c b/src/string/strcpy_s.c new file mode 100644 index 00000000..15e624b4 --- /dev/null +++ b/src/string/strcpy_s.c @@ -0,0 +1,29 @@ +#include "string.h" +#include <limits.h> + +/** copy string **/ +errno_t strcpy_s(char * restrict s1, rsize_t s1max, const char * restrict s2) +{ + __C_EXT(1, 201112L); + __ASSERT_NONNULL(s1); + __ASSERT_NONNULL(s2); + __ASSERT_NOOVERLAP(s1, s2, strlen(s2)); + + return strncpy(s1, s2, strlen(s2)); +} + +/*** +The fn(strcpy) function copies the string at arg(s2) to arg(s1), up to and +including the terminating char(\0). +***/ + +/* UNSPECIFIED: - */ +/* UNDEFINED: if arg(s1) and arg(s2) overlap */ +/* IMPLEMENTATION: - */ +/* LOCALE: - */ + +/* RETURN: the value of arg(s1) */ + +/* +CEXT1(201112) +*/ |