xref: /csrg-svn/lib/libc/stdio/fprintf.c (revision 17951)
1*17951Sserge /* @(#)fprintf.c	4.4 (Berkeley) 02/13/85 */
22005Swnj #include	<stdio.h>
32005Swnj 
42005Swnj fprintf(iop, fmt, args)
5*17951Sserge register FILE *iop;
62005Swnj char *fmt;
72005Swnj {
816439Sralph 	char localbuf[BUFSIZ];
916439Sralph 
1016439Sralph 	if (iop->_flag & _IONBF) {
1116439Sralph 		iop->_flag &= ~_IONBF;
1216439Sralph 		iop->_ptr = iop->_base = localbuf;
1316439Sralph 		iop->_bufsiz = BUFSIZ;
1416439Sralph 		_doprnt(fmt, &args, iop);
1516439Sralph 		fflush(iop);
1616439Sralph 		iop->_flag |= _IONBF;
1716439Sralph 		iop->_base = NULL;
1816439Sralph 		iop->_bufsiz = NULL;
1916563Sralph 		iop->_cnt = 0;
2016439Sralph 	} else
2116439Sralph 		_doprnt(fmt, &args, iop);
222005Swnj 	return(ferror(iop)? EOF: 0);
232005Swnj }
24