summaryrefslogtreecommitdiffstats
path: root/winsup/mingw/mingwex/stdio/snprintf.c
diff options
context:
space:
mode:
authorKeith Marshall <keithmarshall@@users.sf.net>2008-07-28 23:24:20 +0000
committerKeith Marshall <keithmarshall@@users.sf.net>2008-07-28 23:24:20 +0000
commitf2cb69fd8e2f29eb098fa16d03adef1031ea7728 (patch)
tree8f7a93c6273eb0937c049d538c000971ad8f3e4a /winsup/mingw/mingwex/stdio/snprintf.c
parent8c7a3134ddf1f43a283fafc1d96b76cc2327540c (diff)
downloadcygnal-f2cb69fd8e2f29eb098fa16d03adef1031ea7728.tar.gz
cygnal-f2cb69fd8e2f29eb098fa16d03adef1031ea7728.tar.bz2
cygnal-f2cb69fd8e2f29eb098fa16d03adef1031ea7728.zip
Replace __mingw_snprintf() with new generic family implementation; likewise, replace __mingw_vsnprintf().
Diffstat (limited to 'winsup/mingw/mingwex/stdio/snprintf.c')
-rw-r--r--winsup/mingw/mingwex/stdio/snprintf.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/winsup/mingw/mingwex/stdio/snprintf.c b/winsup/mingw/mingwex/stdio/snprintf.c
new file mode 100644
index 000000000..4d022e7dc
--- /dev/null
+++ b/winsup/mingw/mingwex/stdio/snprintf.c
@@ -0,0 +1,44 @@
+/* snprintf.c
+ *
+ * $Id$
+ *
+ * Provides an implementation of the "snprintf" function, conforming
+ * generally to C99 and SUSv3/POSIX specifications, with extensions
+ * to support Microsoft's non-standard format specifications. This
+ * is included in libmingwex.a, replacing the redirection through
+ * libmoldnames.a, to the MSVCRT standard "_snprintf" function; (the
+ * standard MSVCRT function remains available, and may be invoked
+ * directly, using this fully qualified form of its name).
+ *
+ * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
+ *
+ * This is free software. You may redistribute and/or modify it as you
+ * see fit, without restriction of copyright.
+ *
+ * This software is provided "as is", in the hope that it may be useful,
+ * but WITHOUT WARRANTY OF ANY KIND, not even any implied warranty of
+ * MERCHANTABILITY, nor of FITNESS FOR ANY PARTICULAR PURPOSE. At no
+ * time will the author accept any form of liability for any damages,
+ * however caused, resulting from the use of this software.
+ *
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "pformat.h"
+
+int __cdecl __snprintf (char *, size_t, const char *fmt, ...) __MINGW_NOTHROW;
+int __cdecl __mingw_alias(snprintf) (char *, size_t, const char *, ...) __MINGW_NOTHROW;
+
+int __cdecl __vsnprintf (char *, size_t, const char *fmt, va_list) __MINGW_NOTHROW;
+
+int __cdecl __snprintf( char *buf, size_t length, const char *fmt, ... )
+{
+ va_list argv; va_start( argv, fmt );
+ register int retval = __vsnprintf( buf, length, fmt, argv );
+ va_end( argv );
+ return retval;
+}
+
+/* $RCSfile$Revision$: end of file */