|
|
1.1 root 1: /*
2: * libc/stdio/_fputb.c
3: * ANSI-compliant C standard i/o library internals.
4: * _fputb(), _fputba()
5: * Write character, buffered.
6: */
7:
8: #include <stdio.h>
9:
10: int
11: _fputb(c, fp) register int c; register FILE *fp;
12: {
13: register _FILE2 *f2p;
14:
15: f2p = fp->_f2p;
16: if (--fp->_cc < 0) {
17: if (_fpseek(fp))
18: return EOF;
19: fp->_cc = f2p->_ep - f2p->_dp - 1;
20: }
21: return (*fp->_cp++ = (unsigned char)c);
22: }
23:
24: #if _ASCII
25:
26: /* ASCII: prepend '\r' before '\n'. */
27: int
28: _fputba(c, fp) register int c; register FILE *fp;
29: {
30: if ((unsigned char)c == '\n' && _binputb('\r', fp) == EOF)
31: return EOF;
32: return _binputb(c, fp);
33: }
34:
35: #endif
36:
37: /* end of libc/stdio/_fputb.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.