File:  [MW Coherent from dump] / coherent / b / bin / c / common / bput.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:37 2019 UTC (7 years, 2 months ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

/*
 * common/bput.c
 * Standard stream library for the
 * C compiler and other compilers that use
 * C compiler factilities.
 * Output a byte.
 */

#include <stdio.h>
#ifdef   vax
#include "INC$LIB:mch.h"
#include "INC$LIB:stream.h"
#else
#include "mch.h"
#include "stream.h"
#endif

extern	FILE	*ofp;

bput(b)
int b;
{
#if	0
	/*
	 * Some versions VAX and i8086 stdio putc(b, ofp) return EOF (-1)
	 * for char arg 255 (because the argument gets sign-extended from
	 * char 0xFF to int 0xFFFF, and putc returns its arg on success
	 * without masking it).  The following line avoids this bug.
	 */
	b &= 0xFF;		/* avoid putc sign-extension bug */
#endif
#if	TEMPBUF
	if (ofp == NULL) {
		if (outbufp == outbufmax) {
			extern char *realloc();
			unsigned char *cp;

			tempsize += tempsize / 2;
			cp = inbuf;
			inbuf = realloc(inbuf, tempsize);
			inbufp += inbuf - cp;
			inbufmax += inbuf - cp;
			cp = outbuf;
			outbuf = realloc(outbuf, tempsize);
			outbufp += outbuf - cp;
			outbufmax = outbuf + tempsize;
			if (inbuf == NULL || outbuf == NULL)
				cfatal("out of space in memory buffer; use \"-T0\" option");
		}
		*outbufp++ = b;
		return;
	}
#endif
#if	MSDOS
	if (_binputc(b, ofp) == EOF)
#else
	if (putc(b, ofp) == EOF)
#endif
		cfatal("temporary file write error");
}

/* 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.