Annotation of coherent/b/lib/libc/stdio/_fputt.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * libc/stdio/_fputt.c
        !             3:  * ANSI-compliant C standard i/o library internals.
        !             4:  * _fputt(), _fputta()
        !             5:  * Write character, line buffered.
        !             6:  */
        !             7: 
        !             8: #include <stdio.h>
        !             9: 
        !            10: int
        !            11: _fputt(c, fp) int c; register FILE *fp;
        !            12: {
        !            13:        register int uc;
        !            14:        register _FILE2 *f2p;
        !            15: 
        !            16:        uc = (unsigned char)c;
        !            17:        f2p = fp->_f2p;
        !            18: #if    1
        !            19:        if (fp->_cp==f2p->_ep && fflush(fp)
        !            20:         || (*fp->_cp++ = c) == '\n' && fflush(fp))
        !            21:                return EOF;
        !            22: #else
        !            23:        if (putb(uc, fp) == EOF || (uc == '\n' && fflush(fp)))
        !            24:                return EOF;
        !            25: #endif
        !            26:        return uc;
        !            27: }
        !            28: 
        !            29: #if    _ASCII
        !            30: 
        !            31: /* ASCII: prepend '\r' before '\n'. */
        !            32: int
        !            33: _fputta(c, fp) int c; register FILE *fp;
        !            34: {
        !            35:        register int uc;
        !            36: 
        !            37:        if ((uc = (unsigned char)c) == '\n') {
        !            38:                if (_binputb('\r', fp) == EOF
        !            39:                 || _binputb(uc, fp) == EOF
        !            40:                 || fflush(fp))
        !            41:                        return EOF;
        !            42:                return (uc);
        !            43:        }
        !            44:        return _binputb(uc, fp);
        !            45: }
        !            46: 
        !            47: #endif
        !            48: 
        !            49: /* end of libc/stdio/_fputt.c */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.