Rev 1882 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1882 | Rev 4255 | ||
---|---|---|---|
1 | /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ |
1 | /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ |
2 | #include |
2 | #include |
3 | #include |
3 | #include |
- | 4 | #include |
|
4 | 5 | ||
5 | int |
6 | int |
6 | fprintf(register FILE *iop, const char *fmt, ...) |
7 | fprintf(register FILE *iop, const char *fmt, ...) |
7 | { |
8 | { |
8 | int len; |
9 | int len; |
9 | char localbuf[BUFSIZ]; |
10 | char localbuf[BUFSIZ]; |
10 | va_list va; |
11 | va_list va; |
11 | va_start(va, fmt); |
12 | va_start(va, fmt); |
12 | if (iop->_flag & _IONBF) |
13 | if (iop->_flag & _IONBF) |
13 | { |
14 | { |
14 | iop->_flag &= ~_IONBF; |
15 | iop->_flag &= ~_IONBF; |
15 | iop->_ptr = iop->_base = localbuf; |
16 | iop->_ptr = iop->_base = localbuf; |
16 | iop->_bufsiz = BUFSIZ; |
17 | iop->_bufsiz = BUFSIZ; |
17 | len = _doprnt(fmt, va, iop); |
18 | len = _doprnt(fmt, va, iop); |
18 | fflush(iop); |
19 | fflush(iop); |
19 | iop->_flag |= _IONBF; |
20 | iop->_flag |= _IONBF; |
20 | iop->_base = NULL; |
21 | iop->_base = NULL; |
21 | iop->_bufsiz = NULL; |
22 | iop->_bufsiz = NULL; |
22 | iop->_cnt = 0; |
23 | iop->_cnt = 0; |
23 | } |
24 | } |
24 | else |
25 | else |
25 | len = _doprnt(fmt, va, iop); |
26 | len = _doprnt(fmt, va, iop); |
26 | va_end(va); |
27 | va_end(va); |
27 | return ferror(iop) ? EOF : len; |
28 | return ferror(iop) ? EOF : len; |
28 | } |
29 | } |