|
|
1.1 ! root 1: /* ! 2: * libc/stdio/_fputc.c ! 3: * ANSI-compliant C standard i/o library internals. ! 4: * _fputc(), _fputca() ! 5: * Write character, unbuffered. ! 6: * Conditional for _FASCII and errno == EINTR code. ! 7: */ ! 8: ! 9: #include <stdio.h> ! 10: #if COHERENT || GEMDOS ! 11: #include <errno.h> ! 12: #endif ! 13: ! 14: int ! 15: _fputc(c, fp) register int c; register FILE *fp; ! 16: { ! 17: unsigned char s; ! 18: ! 19: if (fp->_ff1 & _FERR) ! 20: return EOF; ! 21: s = c; ! 22: if (write(fileno(fp), &s, 1) == 1) ! 23: return s; ! 24: #if COHERENT || GEMDOS ! 25: if (errno == EINTR) ! 26: errno = 0; ! 27: else ! 28: #endif ! 29: fp->_ff1 |= _FERR; ! 30: return EOF; ! 31: } ! 32: ! 33: #if _ASCII ! 34: ! 35: /* ASCII: prepend '\r' before '\n'. */ ! 36: int ! 37: _fputca(c, fp) register int c; register FILE *fp; ! 38: { ! 39: if ((unsigned char)c == '\n' && _fputc('\r', fp) == EOF) ! 40: return EOF; ! 41: return (_fputc(c, fp)); ! 42: } ! 43: ! 44: #endif ! 45: ! 46: /* 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.