Annotation of coherent/b/bin/c/common/bput.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * common/bput.c
                      3:  * Standard stream library for the
                      4:  * C compiler and other compilers that use
                      5:  * C compiler factilities.
                      6:  * Output a byte.
                      7:  */
                      8: 
                      9: #include <stdio.h>
                     10: #ifdef   vax
                     11: #include "INC$LIB:mch.h"
                     12: #include "INC$LIB:stream.h"
                     13: #else
                     14: #include "mch.h"
                     15: #include "stream.h"
                     16: #endif
                     17: 
                     18: extern FILE    *ofp;
                     19: 
                     20: bput(b)
                     21: int b;
                     22: {
                     23: #if    0
                     24:        /*
                     25:         * Some versions VAX and i8086 stdio putc(b, ofp) return EOF (-1)
                     26:         * for char arg 255 (because the argument gets sign-extended from
                     27:         * char 0xFF to int 0xFFFF, and putc returns its arg on success
                     28:         * without masking it).  The following line avoids this bug.
                     29:         */
                     30:        b &= 0xFF;              /* avoid putc sign-extension bug */
                     31: #endif
                     32: #if    TEMPBUF
                     33:        if (ofp == NULL) {
                     34:                if (outbufp == outbufmax) {
                     35:                        extern char *realloc();
                     36:                        unsigned char *cp;
                     37: 
                     38:                        tempsize += tempsize / 2;
                     39:                        cp = inbuf;
                     40:                        inbuf = realloc(inbuf, tempsize);
                     41:                        inbufp += inbuf - cp;
                     42:                        inbufmax += inbuf - cp;
                     43:                        cp = outbuf;
                     44:                        outbuf = realloc(outbuf, tempsize);
                     45:                        outbufp += outbuf - cp;
                     46:                        outbufmax = outbuf + tempsize;
                     47:                        if (inbuf == NULL || outbuf == NULL)
                     48:                                cfatal("out of space in memory buffer; use \"-T0\" option");
                     49:                }
                     50:                *outbufp++ = b;
                     51:                return;
                     52:        }
                     53: #endif
                     54: #if    MSDOS
                     55:        if (_binputc(b, ofp) == EOF)
                     56: #else
                     57:        if (putc(b, ofp) == EOF)
                     58: #endif
                     59:                cfatal("temporary file write error");
                     60: }
                     61: 
                     62: /* end of common/bput.c */

unix.superglobalmegacorp.com

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