]> Zhao Yanbai Git Server - minix.git/commitdiff
stdio: split vsprintf and vsnprintf
authorBen Gras <ben@minix3.org>
Tue, 2 Nov 2010 22:05:40 +0000 (22:05 +0000)
committerBen Gras <ben@minix3.org>
Tue, 2 Nov 2010 22:05:40 +0000 (22:05 +0000)
  - workaround for linking problems

lib/libc/stdio/Makefile.inc
lib/libc/stdio/vsnprintf.c [new file with mode: 0644]
lib/libc/stdio/vsprintf.c

index 098733c895f5fd46bd57adb35986d8e59d056414..3e04be2765cf26ae2518372e30878827a9aa980d 100644 (file)
@@ -53,5 +53,6 @@ SRCS+=  \
        vfprintf.c \
        vprintf.c \
        vscanf.c \
+       vsnprintf.c \
        vsprintf.c \
        vsscanf.c
diff --git a/lib/libc/stdio/vsnprintf.c b/lib/libc/stdio/vsnprintf.c
new file mode 100644 (file)
index 0000000..429a332
--- /dev/null
@@ -0,0 +1,28 @@
+/* $Header$ */
+
+#include       <stdio.h>
+#include       <stdarg.h>
+#include       <limits.h>
+#include       "loc_incl.h"
+
+int
+vsnprintf(char *s, size_t n, const char *format, va_list arg)
+{
+       int retval;
+       FILE tmp_stream;
+
+       tmp_stream._fd     = -1;
+       tmp_stream._flags  = _IOWRITE + _IONBF + _IOWRITING;
+       tmp_stream._buf    = (unsigned char *) s;
+       tmp_stream._ptr    = (unsigned char *) s;
+       tmp_stream._count  = n-1;
+
+       retval = _doprnt(format, arg, &tmp_stream);
+       if(n > 0) {
+               tmp_stream._count  = 1;
+               (void) putc('\0',&tmp_stream);
+       }
+
+       return retval;
+}
+
index 38b4964f385558eb631da1ca6734317e984b7f9d..84925316c61c66a972367756b636385eb40f9e9b 100644 (file)
@@ -8,27 +8,6 @@
 #include       <limits.h>
 #include       "loc_incl.h"
 
-int
-vsnprintf(char *s, size_t n, const char *format, va_list arg)
-{
-       int retval;
-       FILE tmp_stream;
-
-       tmp_stream._fd     = -1;
-       tmp_stream._flags  = _IOWRITE + _IONBF + _IOWRITING;
-       tmp_stream._buf    = (unsigned char *) s;
-       tmp_stream._ptr    = (unsigned char *) s;
-       tmp_stream._count  = n-1;
-
-       retval = _doprnt(format, arg, &tmp_stream);
-       if(n > 0) {
-               tmp_stream._count  = 1;
-               (void) putc('\0',&tmp_stream);
-       }
-
-       return retval;
-}
-
 int
 vsprintf(char *s, const char *format, va_list arg)
 {