summaryrefslogtreecommitdiffstats
path: root/private/crt32/stdio/wprintf.c
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/crt32/stdio/wprintf.c
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/crt32/stdio/wprintf.c')
-rw-r--r--private/crt32/stdio/wprintf.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/private/crt32/stdio/wprintf.c b/private/crt32/stdio/wprintf.c
new file mode 100644
index 000000000..b11e8406f
--- /dev/null
+++ b/private/crt32/stdio/wprintf.c
@@ -0,0 +1,79 @@
+/***
+*wprintf.c - print formatted
+*
+* Copyright (c) 1992, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* defines wprintf() - print formatted data
+*
+*Revision History:
+* 05-16-92 KRS Created from printf.c.
+*
+*******************************************************************************/
+
+#include <cruntime.h>
+#include <stdio.h>
+#include <assert.h>
+#include <stdarg.h>
+#include <file2.h>
+#include <internal.h>
+#include <os2dll.h>
+
+/***
+*int wprintf(format, ...) - print formatted data
+*
+*Purpose:
+* Prints formatted data on stdout using the format string to
+* format data and getting as many arguments as called for
+* Uses temporary buffering to improve efficiency.
+* _output does the real work here
+*
+*Entry:
+* wchar_t *format - format string to control data format/number of arguments
+* followed by list of arguments, number and type controlled by
+* format string
+*
+*Exit:
+* returns number of wide characters printed
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+int _CALLTYPE2 wprintf (
+ const wchar_t *format,
+ ...
+ )
+/*
+ * stdout 'W'char_t 'PRINT', 'F'ormatted
+ */
+{
+ va_list arglist;
+ REG1 FILE *stream = stdout;
+ REG2 int buffing;
+ REG3 int retval;
+#ifdef MTHREAD
+ int index;
+#endif
+
+// UNDONE: make va_start work with wchar_t format string
+ va_start(arglist, format);
+
+ assert(format != NULL);
+
+#ifdef MTHREAD
+ index = _iob_index(stream);
+#endif
+
+ _lock_str(index);
+
+ buffing = _stbuf(stream);
+
+ retval = _woutput(stream,format,arglist);
+
+ _ftbuf(buffing, stream);
+
+ _unlock_str(index);
+
+ return(retval);
+}