one too many levels of indirection (from ks@purdue)
[unix-history] / usr / src / lib / libc / stdio / fprintf.c
CommitLineData
586c39b1
DF
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#ifndef lint
8static char sccsid[] = "@(#)fprintf.c 5.1 (Berkeley) %G%";
9#endif not lint
10
17951b14
BJ
11#include <stdio.h>
12
13fprintf(iop, fmt, args)
41e01b3e 14register FILE *iop;
17951b14
BJ
15char *fmt;
16{
96ae61b2
RC
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;
d34884f8 28 iop->_cnt = 0;
96ae61b2
RC
29 } else
30 _doprnt(fmt, &args, iop);
17951b14
BJ
31 return(ferror(iop)? EOF: 0);
32}