summaryrefslogtreecommitdiffstats
path: root/private/crt32/stdio/vfwprint.c
blob: 0979617b62dfe9445c6df274cbc498b16dde8138 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/***
*vfwprintf.c - fwprintf from variable arg list
*
*	Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved.
*
*Purpose:
*	defines vfwprintf() - print formatted output, but take args from
*	a stdargs pointer.
*
*Revision History:
*	05-16-92  KRS	Created from vfprintf.c.
*
*******************************************************************************/

#include <cruntime.h>
#include <stdio.h>
#include <wchar.h>
#include <assert.h>
#include <stdarg.h>
#include <file2.h>
#include <internal.h>
#include <os2dll.h>

/***
*int vfwprintf(stream, format, ap) - print to file from varargs
*
*Purpose:
*	Performs formatted output to a file.  The arg list is a variable
*	argument list pointer.
*
*Entry:
*	FILE *stream - stream to write data to
*	wchar_t *format - format string containing data format
*	va_list ap - variable arg list pointer
*
*Exit:
*	returns number of correctly output wide characters
*	returns negative number if error occurred
*
*Exceptions:
*
*******************************************************************************/

int _CALLTYPE1 vfwprintf (
	FILE *str,
	const wchar_t *format,
	va_list ap
	)
/*
 * 'V'ariable argument 'F'ile (stream) 'W'char_t 'PRINT', 'F'ormatted
 */
{
	REG1 FILE *stream;
	REG2 int buffing;
	REG3 int retval;
#ifdef MTHREAD
	int index;
#endif

	assert(str != NULL);
	assert(format != NULL);

	/* Init stream pointer */
	stream = str;

#ifdef MTHREAD
	index=_iob_index(stream);
#endif
	_lock_str(index);
	buffing = _stbuf(stream);
	retval = _woutput(stream,format,ap );
	_ftbuf(buffing, stream);
	_unlock_str(index);

	return(retval);
}