X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstring%2Fmemset.c;h=2b50b88bd6ebe4df8ba4fa0974b9008959aa3970;hb=1216c2da42a1c3f9430ec6b8e11c851febdb2c3f;hp=2771ae1e580f0a86c242ff623657cc1cb3631668;hpb=34893ecc2200dc7017c36a54cb6c5f4c2378b5ec;p=pdclib diff --git a/functions/string/memset.c b/functions/string/memset.c index 2771ae1..2b50b88 100644 --- a/functions/string/memset.c +++ b/functions/string/memset.c @@ -1,8 +1,23 @@ -// ---------------------------------------------------------------------------- -// $Id$ -// ---------------------------------------------------------------------------- -// Public Domain C Library - http://pdclib.sourceforge.net -// This code is Public Domain. Use, modify, and redistribute at will. -// ---------------------------------------------------------------------------- - -void * memset( void * s, int c, size_t n ) { /* TODO */ }; +/* $Id$ */ + +/* Release $Name$ */ + +/* memset( void *, int, size_t ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#include + +void * memset( void * s, int c, size_t n ) +{ + unsigned char * p = (unsigned char *) s; + while ( n-- ) + { + *p++ = (unsigned char) c; + } + return s; +} + +#warning Test driver missing.