1*6a54128fSAndroid Build Coastguard Worker /*
2*6a54128fSAndroid Build Coastguard Worker * Copyright (c) 1988 Regents of the University of California.
3*6a54128fSAndroid Build Coastguard Worker * All rights reserved.
4*6a54128fSAndroid Build Coastguard Worker *
5*6a54128fSAndroid Build Coastguard Worker * Redistribution and use in source and binary forms are permitted
6*6a54128fSAndroid Build Coastguard Worker * provided that the above copyright notice and this paragraph are
7*6a54128fSAndroid Build Coastguard Worker * duplicated in all such forms and that any documentation,
8*6a54128fSAndroid Build Coastguard Worker * advertising materials, and other materials related to such
9*6a54128fSAndroid Build Coastguard Worker * distribution and use acknowledge that the software was developed
10*6a54128fSAndroid Build Coastguard Worker * by the University of California, Berkeley. The name of the
11*6a54128fSAndroid Build Coastguard Worker * University may not be used to endorse or promote products derived
12*6a54128fSAndroid Build Coastguard Worker * from this software without specific prior written permission.
13*6a54128fSAndroid Build Coastguard Worker * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14*6a54128fSAndroid Build Coastguard Worker * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15*6a54128fSAndroid Build Coastguard Worker * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16*6a54128fSAndroid Build Coastguard Worker */
17*6a54128fSAndroid Build Coastguard Worker
18*6a54128fSAndroid Build Coastguard Worker #if defined(LIBC_SCCS) && !defined(lint)
19*6a54128fSAndroid Build Coastguard Worker static char sccsid[] = "@(#)vfprintf.c 5.2 (Berkeley) 6/27/88";
20*6a54128fSAndroid Build Coastguard Worker #endif /* LIBC_SCCS and not lint */
21*6a54128fSAndroid Build Coastguard Worker
22*6a54128fSAndroid Build Coastguard Worker #include "config.h"
23*6a54128fSAndroid Build Coastguard Worker #if !HAVE_VPRINTF && HAVE_DOPRNT
24*6a54128fSAndroid Build Coastguard Worker #include <stdio.h>
25*6a54128fSAndroid Build Coastguard Worker #include <varargs.h>
26*6a54128fSAndroid Build Coastguard Worker
27*6a54128fSAndroid Build Coastguard Worker int
vfprintf(iop,fmt,ap)28*6a54128fSAndroid Build Coastguard Worker vfprintf(iop, fmt, ap)
29*6a54128fSAndroid Build Coastguard Worker FILE *iop;
30*6a54128fSAndroid Build Coastguard Worker char *fmt;
31*6a54128fSAndroid Build Coastguard Worker va_list ap;
32*6a54128fSAndroid Build Coastguard Worker {
33*6a54128fSAndroid Build Coastguard Worker int len;
34*6a54128fSAndroid Build Coastguard Worker char localbuf[BUFSIZ];
35*6a54128fSAndroid Build Coastguard Worker
36*6a54128fSAndroid Build Coastguard Worker if (iop->_flag & _IONBF) {
37*6a54128fSAndroid Build Coastguard Worker iop->_flag &= ~_IONBF;
38*6a54128fSAndroid Build Coastguard Worker iop->_ptr = iop->_base = localbuf;
39*6a54128fSAndroid Build Coastguard Worker len = _doprnt(fmt, ap, iop);
40*6a54128fSAndroid Build Coastguard Worker (void) fflush(iop);
41*6a54128fSAndroid Build Coastguard Worker iop->_flag |= _IONBF;
42*6a54128fSAndroid Build Coastguard Worker iop->_base = NULL;
43*6a54128fSAndroid Build Coastguard Worker iop->_bufsiz = 0;
44*6a54128fSAndroid Build Coastguard Worker iop->_cnt = 0;
45*6a54128fSAndroid Build Coastguard Worker } else
46*6a54128fSAndroid Build Coastguard Worker len = _doprnt(fmt, ap, iop);
47*6a54128fSAndroid Build Coastguard Worker
48*6a54128fSAndroid Build Coastguard Worker return (ferror(iop) ? EOF : len);
49*6a54128fSAndroid Build Coastguard Worker }
50*6a54128fSAndroid Build Coastguard Worker #endif /* !HAVE_VPRINTF */
51