1: /* 2: * Copyright (c) 1980 Regents of the University of California. 3: * All rights reserved. The Berkeley software License Agreement 4: * specifies the terms and conditions for redistribution. 5: */ 6: 7: #if defined(LIBC_SCCS) && !defined(lint) 8: static char sccsid[] = "@(#)fprintf.c 5.2 (Berkeley) 3/9/86"; 9: #endif LIBC_SCCS and not lint 10: 11: #include <stdio.h> 12: 13: fprintf(iop, fmt, args) 14: register FILE *iop; 15: char *fmt; 16: { 17: char localbuf[BUFSIZ]; 18: 19: if (iop->_flag & _IONBF) { 20: iop->_flag &= ~_IONBF; 21: iop->_ptr = iop->_base = localbuf; 22: iop->_bufsiz = BUFSIZ; 23: _doprnt(fmt, &args, iop); 24: fflush(iop); 25: iop->_flag |= _IONBF; 26: iop->_base = NULL; 27: iop->_bufsiz = NULL; 28: iop->_cnt = 0; 29: } else 30: _doprnt(fmt, &args, iop); 31: return(ferror(iop)? EOF: 0); 32: }