|
|
1.1 root 1: /*
2: * libc/stdio/_fputc.c
3: * C Standard I/O Library internals.
4: * Unbuffered output.
5: */
6:
7: #include <stdio.h>
8: #include <errno.h>
9:
10: int
11: _fputc(c, fp) register unsigned int c; register FILE *fp;
12: {
13: register int n, oerrno;
14: char s[1] = c;
15:
16: fp->_cc = 0;
17: oerrno = errno;
18: errno = 0;
19: n = (unsigned char)c;
20: if (fp->_ff&_FERR || _fpseek(fp))
21: n = EOF;
22: else if (write(fileno(fp), s, 1) != 1) {
23: if (errno != EINTR)
24: fp->_ff |= _FERR;
25: n = EOF;
26: }
27: if (errno == 0)
28: errno = oerrno;
29: return n;
30: }
31:
32: /* end of libc/stdio/_fputc.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.