For NOT43 systems, get correct definition for dosynch().
[unix-history] / usr / src / lib / libc / stdio / fprintf.c
CommitLineData
586c39b1
DF
1/*
2 * Copyright (c) 1980 Regents of the University of California.
5decdf1c
KB
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
6 * provided that this notice is preserved and that due credit is given
7 * to the University of California at Berkeley. The name of the University
8 * may not be used to endorse or promote products derived from this
9 * software without specific prior written permission. This software
10 * is provided ``as is'' without express or implied warranty.
586c39b1
DF
11 */
12
2ce81398 13#if defined(LIBC_SCCS) && !defined(lint)
5decdf1c
KB
14static char sccsid[] = "@(#)fprintf.c 5.3 (Berkeley) %G%";
15#endif /* LIBC_SCCS and not lint */
586c39b1 16
5decdf1c 17#include <stdio.h>
17951b14
BJ
18
19fprintf(iop, fmt, args)
5decdf1c
KB
20 register FILE *iop;
21 char *fmt;
22 int args;
17951b14 23{
5decdf1c 24 int len;
96ae61b2
RC
25 char localbuf[BUFSIZ];
26
27 if (iop->_flag & _IONBF) {
28 iop->_flag &= ~_IONBF;
29 iop->_ptr = iop->_base = localbuf;
30 iop->_bufsiz = BUFSIZ;
5decdf1c 31 len = _doprnt(fmt, &args, iop);
96ae61b2
RC
32 fflush(iop);
33 iop->_flag |= _IONBF;
34 iop->_base = NULL;
35 iop->_bufsiz = NULL;
d34884f8 36 iop->_cnt = 0;
96ae61b2 37 } else
5decdf1c
KB
38 len = _doprnt(fmt, &args, iop);
39 return(ferror(iop) ? EOF : len);
17951b14 40}