]> pd.if.org Git - pdclib/blobdiff - functions/stdio/sprintf.c
Porting current working set from CVS.
[pdclib] / functions / stdio / sprintf.c
index b992dbaa32715f6c985d9c98e79a73663b97d4dc..d85b205cad73513dc42f657f47b8d636e77ee7dd 100644 (file)
@@ -1,20 +1,35 @@
-/* ----------------------------------------------------------------------------
- * $Id$
- * ----------------------------------------------------------------------------
- * Public Domain C Library - http://pdclib.sourceforge.net
- * This code is Public Domain. Use, modify, and redistribute at will.
- * --------------------------------------------------------------------------*/
+/* $Id$ */
 
-int sprintf( char * restrict s, const char * restrict format, ... ) { /* TODO */ };
+/* Release $Name$ */
 
-/* PDPC code - unreviewed
+/* sprintf( char *, const char *, ... )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdarg.h>
+
+#ifndef REGTEST
+
+int sprintf( char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, ...)
 {
-    va_list arg;
-    int ret;
+    va_list ap;
+    va_start( ap, format );
+    return vsnprintf( s, SIZE_MAX, format, ap );
+}
 
-    va_start(arg, format);
-    ret = vsprintf(s, format, arg);
-    va_end(arg);
-    return (ret);
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+int main( void )
+{
+    TESTCASE( NO_TESTDRIVER );
+    return TEST_RESULTS;
 }
-*/
+
+#endif