]> pd.if.org Git - pdclib/blobdiff - functions/string/memset.c
Added dummy test drivers to each *.c file, and target 'test' to Makefile.
[pdclib] / functions / string / memset.c
index 2771ae1e580f0a86c242ff623657cc1cb3631668..9318c85d57834296687f6fb2b87868fcf5a72515 100644 (file)
@@ -1,8 +1,30 @@
-// ----------------------------------------------------------------------------
-// $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 <string.h>
+
+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.
+
+#ifdef TEST
+int main()
+{
+    return 0;
+}
+#endif