xref: /original-bsd/lib/libc/stdio/fprintf.c (revision 7ecb520c)
1 /* @(#)fprintf.c	4.4 (Berkeley) 02/13/85 */
2 #include	<stdio.h>
3 
4 fprintf(iop, fmt, args)
5 register FILE *iop;
6 char *fmt;
7 {
8 	char localbuf[BUFSIZ];
9 
10 	if (iop->_flag & _IONBF) {
11 		iop->_flag &= ~_IONBF;
12 		iop->_ptr = iop->_base = localbuf;
13 		iop->_bufsiz = BUFSIZ;
14 		_doprnt(fmt, &args, iop);
15 		fflush(iop);
16 		iop->_flag |= _IONBF;
17 		iop->_base = NULL;
18 		iop->_bufsiz = NULL;
19 		iop->_cnt = 0;
20 	} else
21 		_doprnt(fmt, &args, iop);
22 	return(ferror(iop)? EOF: 0);
23 }
24