summaryrefslogtreecommitdiff
path: root/src/string/memset_s.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-08-16 15:55:19 -0400
committerJakob Kaivo <jkk@ung.org>2020-08-16 15:55:19 -0400
commite223e635cc53fa11e473cdbc864eb69a3da5f290 (patch)
treed481ca6fb0b7f4184f3ec259a6f9c37d76e56a26 /src/string/memset_s.c
parent700fbd205a1a428677876d322606b9a354221892 (diff)
add skeleton of symbols from C11 LIB_EXT1
Diffstat (limited to 'src/string/memset_s.c')
-rw-r--r--src/string/memset_s.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/string/memset_s.c b/src/string/memset_s.c
new file mode 100644
index 00000000..71e3add1
--- /dev/null
+++ b/src/string/memset_s.c
@@ -0,0 +1,33 @@
+#include "string.h"
+
+/** fill memory **/
+errno_t memset_s(void *s, rsize_t smax, int c, rsize_t n)
+{
+ __C_EXT(1, 201112L);
+ __ASSERT_NONNULL(s);
+
+ unsigned char *_s = (unsigned char *)s;
+ int i = 0;
+
+ while (i < n) {
+ _s[i] = (unsigned char)c;
+ }
+
+ return s;
+}
+
+/***
+The fn(memset) function fills the first arg(n) bytes of memory at arg(s) with
+the value arg(c) (converted to an type(unsigned char)).
+***/
+
+/* UNSPECIFIED: - */
+/* UNDEFINED: - */
+/* IMPLEMENTATION: - */
+/* LOCALE: - */
+
+/* RETURN: the value of arg(s) */
+
+/*
+CEXT1(201112)
+*/