ref: 07094f38b49ec4f867ea7cd8f5d453940e48951c
parent: 372d84a719b53b7672607046e335572f8ae9edf1
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Feb 16 17:42:42 EST 2017
[libc] Add memset()
--- a/libc/src/Makefile
+++ b/libc/src/Makefile
@@ -2,7 +2,8 @@
.POSIX:
LIBCOBJ = assert.o strcpy.o strcmp.o strlen.o strchr.o \
- strrchr.o strcat.o strncpy.o strncat.o
+ strrchr.o strcat.o strncpy.o strncat.o \
+ memset.o
all: libc.a
--- /dev/null
+++ b/libc/src/memset.c
@@ -1,0 +1,13 @@
+/* See LICENSE file for copyright and license details. */
+
+#include <string.h>
+
+void *
+memset(void *s, int c, size_t n)
+{
+ char *bp;
+
+ for (bp = s; n-- > 0; *bp++ = c)
+ /* nothing */;
+ return s;
+}