1*a2c5be77Stakemura /* $NetBSD: winprintf.c,v 1.2 2000/10/21 13:51:01 takemura Exp $ */
211ee920bScgd
311ee920bScgd /*-
411ee920bScgd * Copyright (c) 1999 Shin Takemura.
511ee920bScgd * All rights reserved.
611ee920bScgd *
711ee920bScgd * This software is part of the PocketBSD.
811ee920bScgd *
911ee920bScgd * Redistribution and use in source and binary forms, with or without
1011ee920bScgd * modification, are permitted provided that the following conditions
1111ee920bScgd * are met:
1211ee920bScgd * 1. Redistributions of source code must retain the above copyright
1311ee920bScgd * notice, this list of conditions and the following disclaimer.
1411ee920bScgd * 2. Redistributions in binary form must reproduce the above copyright
1511ee920bScgd * notice, this list of conditions and the following disclaimer in the
1611ee920bScgd * documentation and/or other materials provided with the distribution.
1711ee920bScgd * 3. All advertising materials mentioning features or use of this software
1811ee920bScgd * must display the following acknowledgement:
1911ee920bScgd * This product includes software developed by the PocketBSD project
2011ee920bScgd * and its contributors.
2111ee920bScgd * 4. Neither the name of the project nor the names of its contributors
2211ee920bScgd * may be used to endorse or promote products derived from this software
2311ee920bScgd * without specific prior written permission.
2411ee920bScgd *
2511ee920bScgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2611ee920bScgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2711ee920bScgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2811ee920bScgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2911ee920bScgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3011ee920bScgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3111ee920bScgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3211ee920bScgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3311ee920bScgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3411ee920bScgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3511ee920bScgd * SUCH DAMAGE.
3611ee920bScgd *
3711ee920bScgd */
3811ee920bScgd #include <windows.h>
39*a2c5be77Stakemura #include <stand.h>
4011ee920bScgd
4111ee920bScgd int
win_printf(LPWSTR lpszFmt,...)4211ee920bScgd win_printf(LPWSTR lpszFmt, ...)
4311ee920bScgd {
4411ee920bScgd int count;
4511ee920bScgd va_list ap;
4611ee920bScgd wchar_t buffer[2048];
4711ee920bScgd
4811ee920bScgd va_start(ap, lpszFmt);
4911ee920bScgd count = wvsprintf(buffer, lpszFmt, ap);
5011ee920bScgd va_end(ap);
5111ee920bScgd if (count > 0) {
5211ee920bScgd OutputDebugStringW(buffer);
5311ee920bScgd }
5411ee920bScgd return count;
5511ee920bScgd }
5611ee920bScgd
5711ee920bScgd
5811ee920bScgd /*
5911ee920bScgd * printf() uses this.
6011ee920bScgd */
6111ee920bScgd void
putchar(int c)6211ee920bScgd putchar(int c)
6311ee920bScgd {
6411ee920bScgd win_printf(TEXT("%C"), c);
6511ee920bScgd }
66