xref: /csrg-svn/lib/libc/stdio/fprintf.c (revision 16439)
1*16439Sralph /* @(#)fprintf.c	4.2 (Berkeley) 05/04/84 */
22005Swnj #include	<stdio.h>
32005Swnj 
42005Swnj fprintf(iop, fmt, args)
52005Swnj FILE *iop;
62005Swnj char *fmt;
72005Swnj {
8*16439Sralph 	char localbuf[BUFSIZ];
9*16439Sralph 
10*16439Sralph 	if (iop->_flag & _IONBF) {
11*16439Sralph 		iop->_flag &= ~_IONBF;
12*16439Sralph 		iop->_ptr = iop->_base = localbuf;
13*16439Sralph 		iop->_bufsiz = BUFSIZ;
14*16439Sralph 		_doprnt(fmt, &args, iop);
15*16439Sralph 		fflush(iop);
16*16439Sralph 		iop->_flag |= _IONBF;
17*16439Sralph 		iop->_base = NULL;
18*16439Sralph 		iop->_bufsiz = NULL;
19*16439Sralph 	} else
20*16439Sralph 		_doprnt(fmt, &args, iop);
212005Swnj 	return(ferror(iop)? EOF: 0);
222005Swnj }
23