/* $Header:fprintf.c 12.0$ */
/* $ACIS:fprintf.c 12.0$ */
/* $Source: /ibm/acis/usr/src/lib/libc/stdio/RCS/fprintf.c,v $ */

#ifndef lint
static char *rcsid = "$Header:fprintf.c 12.0$";
#endif

/*
 * Copyright (c) 1980 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 */

#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)fprintf.c	5.2 (Berkeley) 3/9/86";
#endif LIBC_SCCS and not lint

#include	<stdio.h>

fprintf(iop, fmt, args, DUMMY)
register FILE *iop;
register char *fmt;
{
	char localbuf[BUFSIZ];

	if (iop->_flag & _IONBF) {
		iop->_flag &= ~_IONBF;
		iop->_ptr = iop->_base = localbuf;
		iop->_bufsiz = BUFSIZ;
		_doprnt(fmt, &args, iop);
		fflush(iop);
		iop->_flag |= _IONBF;
		iop->_base = NULL;
		iop->_bufsiz = NULL;
		iop->_cnt = 0;
	} else
		_doprnt(fmt, &args, iop);
	return(ferror(iop)? EOF: 0);
}
