xref: /csrg-svn/lib/libc/stdio/fprintf.c (revision 16439)
1 /* @(#)fprintf.c	4.2 (Berkeley) 05/04/84 */
2 #include	<stdio.h>
3 
4 fprintf(iop, fmt, args)
5 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 	} else
20 		_doprnt(fmt, &args, iop);
21 	return(ferror(iop)? EOF: 0);
22 }
23