diff options
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | kern/strings.c | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am index 0c98bfd..319b7e8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -156,7 +156,7 @@ noinst_PROGRAMS += \ gnumach.o # This is the list of routines we decide is OK to steal from the C library. -clib_routines := memcmp memcpy memmove memset \ +clib_routines := memcmp memcpy memmove \ strchr strstr strsep strtok \ htonl htons ntohl ntohs \ udivdi3 __udivdi3 \ diff --git a/kern/strings.c b/kern/strings.c index 80e410e..3676f98 100644 --- a/kern/strings.c +++ b/kern/strings.c @@ -172,3 +172,22 @@ strlen( return string - 1 - ret; } + +/* + * Abstract: + * memset writes value "c" in the "n" bytes starting at address "s". + * The return value is a pointer to the "s" string. + */ + +void * +memset( + void *_s, int c, size_t n) +{ + char *s = _s; + int i; + + for (i = 0; i < n ; i++) + s[i] = c; + + return _s; +} |