121405Sdist /* 221405Sdist * Copyright (c) 1980 Regents of the University of California. 321405Sdist * All rights reserved. The Berkeley software License Agreement 421405Sdist * specifies the terms and conditions for redistribution. 521405Sdist */ 621405Sdist 7*26648Sdonn #if defined(LIBC_SCCS) && !defined(lint) 8*26648Sdonn static char sccsid[] = "@(#)fprintf.c 5.2 (Berkeley) 03/09/86"; 9*26648Sdonn #endif LIBC_SCCS and not lint 1021405Sdist 112005Swnj #include <stdio.h> 122005Swnj 132005Swnj fprintf(iop, fmt, args) 1417951Sserge register FILE *iop; 152005Swnj char *fmt; 162005Swnj { 1716439Sralph char localbuf[BUFSIZ]; 1816439Sralph 1916439Sralph if (iop->_flag & _IONBF) { 2016439Sralph iop->_flag &= ~_IONBF; 2116439Sralph iop->_ptr = iop->_base = localbuf; 2216439Sralph iop->_bufsiz = BUFSIZ; 2316439Sralph _doprnt(fmt, &args, iop); 2416439Sralph fflush(iop); 2516439Sralph iop->_flag |= _IONBF; 2616439Sralph iop->_base = NULL; 2716439Sralph iop->_bufsiz = NULL; 2816563Sralph iop->_cnt = 0; 2916439Sralph } else 3016439Sralph _doprnt(fmt, &args, iop); 312005Swnj return(ferror(iop)? EOF: 0); 322005Swnj } 33