--- Gnu-Mach/kern/strings.c 2020/09/02 04:36:56 1.1.1.1 +++ Gnu-Mach/kern/strings.c 2020/09/02 04:45:13 1.1.1.2 @@ -31,7 +31,7 @@ * String functions. */ -#include /* make sure we sell the truth */ +#include #ifdef strcpy #undef strcmp @@ -84,7 +84,7 @@ int strncmp( register const char *s1, register const char *s2, - unsigned long n) + size_t n) { register unsigned int a, b; @@ -137,7 +137,7 @@ char * strncpy( register char *to, register const char *from, - register unsigned long count) + register size_t count) { register char *ret = to; @@ -161,7 +161,7 @@ strncpy( * the terminating null character. */ -unsigned long +size_t strlen( register const char *string) { @@ -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; +}