2ame<getw.cgar;licbtosclib 6jedjFOKm* Module getw.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<stdio.h>

getw(fp)
	FILE	*fp;
	{
	int	c;
	int	res;

	c = getc(fp);
	if	(c == EOF)
		return(EOF);
	res = getc(fp);
	if	(res == EOF)
		return(EOF);
	c += res << 8;
	return(c);
	}

closea.cgar;licbtosclib
 jeKdjFOKmr$* Module closea.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<ctstream.h>

extern	int	errno;
extern	char	*_openfd[];

_close(fd)
	int	fd;
	{
	int	res;

	if	(fd < 0 || fd >= 16 || _openfd[fd] == 0){
		errno = 1;
		return(1);
		}
	res = CloseByteStre0am(_openfd[fd]);
	if	(res){
		errno = res;
		return(1);
		}
	free(_openfd[fd]);
	_openfd[fd] = 0;
	return(0);
	}
<
,W	setvbuf.cgar;licbtosclibW je_djGOKmH* Module setvbuf.c  V010EM01 === 120887
* 120887 010E00 rma check for zero size
* 091487 010A00 rma initial submittal
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<stdio.h>

int	setvbuf(fp, buf, type, size)
	FILE	*fp;
	char	*buf;
	int	type;
	unsigned size;
	{
	void	*mT
alloc();

	switch	(type){
	case	_IOFBF:
		if	(size == 0)
			return(1);
		if	(buf){
			if	(fp>_f_flags  _F_BUF)
				free(fp>_f_buffer);
			fp>_f_flags = _F_BUF;
			}
		else	{
			buf = malloc(size);
			if	(buf == 0)
				return(1);
			if	(fp>_f_flags  _F_BUF)
				free(fp>_f_buffer);
			fp>_f_flags |= _F_BUF;
			}
		fp>_f_curp = fp>_f_endp = fp>_f_buffer = buf;
		fp>_f_bsize = size;
		return(0);

	case	_IOLBF:
	case	_IONBF:
		if	(fp>_f_flags  _F_BUF)
			free(fp>_f_buffer);
		fp>_f_curp = fp>_f_endp = fp>_f_buffer = fp>_f_hold;
		fp>_f_bsize = 1;
		fp>_f_flags = _F_BUF;
		return(0);

	default:
		return(1);
		}
	}
lz brk.cgar;licbtosclib  jedjGOKm(x* Module brk.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
define	MARGIN	256

if	defined(__SMALL__) || defined(__MEDIUM__)

extern	int	_brklvl;

coreleft()
	{
	asm	mov	ax,sp
	asm	sub	ax,dgroup:_brklvl
	asm	sub	ax,MARGIN
	}

coreminleft()
	{
    int *bottom = _brklvl;

    while	(*bottom++)
		;
    return(bottom  _brklvl);
	}

brk(addr)
	char	*addr;
	{
	asm	mov	ax,addr
	asm	mov	dx,sp
	asm	sub	dx,MARGIN
	asm	cmp	ax,dx
	asm	jb	brksuc
        
	return(1);

	brksuc:
	asm	mov	dgroup:_brklvl,ax

	return(0);
	}

char	*sbrk(incr)
	unsigned	incr;
	{
	asm	mov	cx,incr
	asm	add	cx,dgroup:_brklvl
	asm	jc	sbrkerr
	asm	mov	dx,cx
	asm	add	dx,MARGIN
	asm	jc	sbrkerr
	asm	cmp	dx,sp
	asm	jb	sbrkok

	sbrkerr:

	return(1);

	sbrkok:

	asm	mov	ax,dgroup:_brklvl
	asm	mov	dgroup:_brklvl,cx
	}  
else

coreleft()
	{
	asm	mov	ax,sp
	asm	sub	ax,MARGIN
	}

coreminleft()
	{
    int *bottom = bottom;

    bottom = (int *)((long)bottom  0xffff0000);
    while	(*bottom++)
		;
    return((long)bottom 0xffff);
	}

endif
6_	bsearch.cgar;licbtosclib_jefdjHOKm * Module bsearch.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
char	*bsearch(key, base, nelem, width, fcmp)
	char	*key;
	char	*base;
	register int	nelem;
	int	width;
	int	(*fcmp)();
	{
	char	*kmin, *probe;
	int	i, j;

	kmin = base;
	while	(nelem > 0){
		i = nelem >> 1;
		probe = kmin + i * width;
		j = (*fcmp)(key, probe);
		if	(j == 0)
			return(probe);
		else if	(j < 0)
			nelem = i;
		else	{
			kmin = probe + width;
			nelem = nelem  i  1;
			}
		}
	return(0);
	}
[fflush.cgar;licbtosclibjedjHOKm$* Module fflush.c  V010BM01 === 091787
*	091787 rma  do not set _F_ERR if i < j (fix for \f phenomena)
*	082187 kcj  call _fseekeof() to force appending data
*	070287 rma  reset _f_curp before return
*	052087 rma  add _fflush() (no CheckpointBS call
*	043087 rma  fflush.c  fix to REALLY flush the file
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* C OPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<stdio.h>

extern int  CheckpointBs plm far (void *far pBSWA);
extern char *_openfd[];
extern int  kcjtest;

fflush(fp)
	register FILE	*fp;
	{
	int		i;
	int		j;

	if	((fp>_f_flags  (_F_WRIT|_F_OPEN|_F_ERR|_F_IN)) =
					(_F_WRIT|_F_OPEN))
		return(0);
	if	(fp>_f_curp > fp>_f_buffer){
		i = fp>_f_curp  fp>_f_buffer;
		if (fp>_f_flags  _F_APND){	* kcj *
			if(_fseekeof(fp, 0L)){
				fp>_f_flags |= _F_ERR;
				return(EOF);
				}
			} 							* kcj *
		j = _write(fp>_f_fd, fp>_f_buffer, i);
		fp>_f_curp = fp>_f_buffer;
		if	(i > j){ * rma 91787 *
			fp>_f_flags |= _F_ERR;
			return(EOF);
			}
		CheckpointBs(_openfd[fp>_f_fd]);
		}
	return(0);
	}

_fflush(fp)
	register FILE	*fp;
	{
	int		i;
	int		j;

	if	((fp>_f_flags  (_F_WRIT|_F_OPEN|_F_ERR|_F_IN)) =
					(_F_WRIT|_F_OPEN))
		return(0);
	if	(fp>_f_curp > fp>_f_buffer){
		i = fp>_f_curp  fp>_f_buffer;
		if (fp>_f_flags  _F_APND){	* kcj *$
			if(_fseekeof(fp, 0L)){
				fp>_f_flags |= _F_ERR;
				return(EOF);
				}
			} 							* kcj *
		j = _write(fp>_f_fd, fp>_f_buffer, i);
		fp>_f_curp = fp>_f_buffer;
		if	(i > j){ * rma 91787 *
			fp>_f_flags |= _F_ERR;
			return(EOF);
			}
		}
	return(0);
	}
5s]sss9s_ssssKs{sssDsuss^shsssXl(;i(JH2RFsssG71_)zputw.cgar;licbtosclibz jedjIOKm)(* Module putw.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<stdio.h>

putw(w, fp)
	unsigned w;
	FILE	*fp;
	{
	int	res;

	res = putc(w  0xff, fp);
	if	(res == EOF)
		return(EOF);
	res = putc(w >> 8, fp);
	if	(res == EOF)
		return(EOF);
	return(w);
	*}
 ,fgets.cgar;licbtosclib$1jedjIOKm,* Module fgets.c  V010BM01 === 092487
* 092487 010B01 rma  add backspace logic for input from [kbd]
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include <stdio.h>

char	*fgets(s, n, fp)
	register char	*s;
	int		n;
	FILE	*fp;
	{
	int		c;
	char	*ret;

	ret = s;
	c = 0;
	while	(8n > 0){
		c = getc(fp);
		if	(c == EOF || c == '\n')
			break;
		if	((c == '\b')  (fp>_f_flags  _F_KBD )) {
			if (s = ret)
				s;
			}
		else 
			*s++ = c;
		}
	if	(c == EOF  s == ret)
		return(0);
	if	(c == '\n')
		*s++ = c;
	*s = 0;
	return(ret);
	}

	p0_@0@P0@O,,O
01?;<=>?O6BPxD1T	fprintf.cgar;licbtosclib$je>djIOKmgP2* Module fprintf.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<stdio.h>
include	<ctype.h>
include	<setjmp.h>
include	<stdarg.h>

extern	int	fputc();

fprintf(FILE *fp, char *fmt, ...)
	{
	va_list	ap;

	va_start(ap, fmt);
	return(_printf(fputc, fp\4, fmt, ap));
	}

vfprintf(FILE *fp, char *fmt, va_list ap)
	{
	return(_printf(fputc, fp, fmt, ap));
	}
h6	|strcat.cgar;licbtosclib$je6?mJOKm't7	*
 *  Module: strcat.c  V011IM01 === 061390
 *
 *  061390  011I01  sbw  strncat(): Replace strlen() call on source string
 *			    (protection violation if no null); return 0 if
 *			    zero length specified.
 *
 *
 *  PROPRIETARY PROGRAM MATERIAL
 *
 *  REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
 *  OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
 *
 *  COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
 *  COPYRIGHT (C) 1990 UNISYS CORPORATION
 *

inc9	lude  <stddef.h>


char *strcat( char *dest, char *src )
{

  movmem( src, dest + strlen( dest ), strlen( src ) + 1 ) ;

  return( dest ) ;

}



char *strncat( char *dest, char *src, size_t maxlen )
{

  size_t  slen, dlen ;
  char   *ssrc       ;



  if ( maxlen )
     {
     dlen = strlen( dest ) ;


     for ( ssrc = src, slen = 0; *ssrc  slen < maxlen ; ssrc++, slen++ )
	 { ; }


     movmem( src, dest + dlen, slen ) ;

     dest[dlen + slen] = '\0' ;
     }


  return( dest ) ;

}

;
D6fputs.cgar;licbtosclibjeAdjJOKm<
* Module fputs.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<stdio.h>

fputs(s, fp)
	char	*s;
	FILE	*fp;
	{
	int	res;

	while	(*s){
		res = putc(*s, fp);
		s++;
		if	(res == EOF)
			return(EOF);
		}
	return(0);
	}
>3=sin.cgar;licbtosclibjeudjKOKm?* Module sin.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<errno.h>

define	PI2	1.570796326794896
define	YMAX	3.14159e8
define	C1	(3217.1024.)
define	C2	8.90891020676153e6

double	fabs();

static	double	R[8] = {
	0.166666666666666,	0.8333333A33333316e2,
	0.198412698412018e3,	0.275573192101527e5,
	0.250521067982745e7,	0.160589364903715e9,
	0.764291780689104e12,	0.272047909578888e14
	};

static	double	sincos(x, y, sgn, coswanted)
	double	x;
	double	y;
	int	sgn;
	int	coswanted;
	{
	int	n;
	double	xn;
	double	f;
	double	floor();
	double	fabsx;
	double	g;
	double	rg;
	int	i;

	if	(y > YMAX){
		errno = EDOM;
		return(0.0);
		}
	n = .5 + y * 0.318309886183790;
	xn = n;
	if	(n  1)
		sgn = sgn;
	if	(coswanted)
		xn = xn  .5;
	fabsx = fabs(xC);
	f = ((floor(fabsx)  xn * C1) + fabsx  floor(fabsx))  xn * C2;
	if	(fabs(f) > 1e8){
		g = f * f;
		for	(i = 7, rg = 0; i >= 0; i)
			rg = (rg + R[i]) * g;
		f = f + f * rg;
		}
	if	(sgn < 0)
		f = f;
	return(f);
	}

double	sin(x)
	double	x;
	{
	if	(x < 0)
		return(sincos(x, x, 1, 0));
	else
		return(sincos(x, x, 1, 0));
	}

double	cos(x)
	double	x;
	{
	return(sincos(x, fabs(x) + PI2, 1, 1));
	}
ED	realloc.cgar;licbtosclibjedjKOKmF* Module realloc.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
extern	void	free();
extern	char	*malloc();

char	*realloc(ptr, size)
	char	*ptr;
	unsigned size;
	{
	int *ip;
	unsigned oldsize;
	char	*newp;

	ip = (int *)ptr;      * 6 == sizeof HEADER *
	oldsHize = (ip[1] * 6)  6; * hardwire for now... rma *
	newp = malloc(size);
	if (newp == 0)
	  return(0);
	movmem(ptr, newp, oldsize < size ? oldsize : size);
	free(ptr);
	return(newp);
	}

J
(flsbuf.cgar;licbtosclib(jedjKOKm(L
* Module flsbuf.c  V010AM01 === 091487
*	052087 rma  call _fflush() (no CheckpointBS), not fflush()
*	042487 rma  fix for crash when press <FINISH>
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<stdio.h>

_flsbuf(fp)
	FILE	*fp;
	{
	if	((fp>_f_flags  (_F_WRIT|_F_OPEN
N|_F_ERR|_F_IN)) =
					(_F_WRIT|_F_OPEN)){
		fp>_f_flags |= _F_ERR;
		if	(fp>_f_flags  _F_BUF)	* malloc'ed buffer *
			fp>_f_curp = fp>_f_buffer;
		else				* _f_buffer not valid *
			fp>_f_curp = (unsigned char *)fp>_f_hold;
		return(EOF);
		}
	fp>_f_flags |= _F_OUT;
	_fflush(fp);
	if	(fp>_f_flags  _F_ERR)
		return(EOF);
	return(fp>_f_buffer[fp>_f_bsize  1]);
	}
Pdhscanf.cgar;licbtosclibh(jemdjLOKm( (Q* Module scanf.c  V010FM01 === 030988
*	030988 010F01 rma  fix 's': for format 4s 4s (last char repeats)
*	030988 010F01 rma  fix ResultCount for case of no matches
*	030788 010F01 de   fix _match for width bug
*	121587 010E01 rma  fix ResultCount for [...]
*	092987 010C01 rma  bulletproof scanf() for input>260 bytes
*	091887 010B01 rma  fix for [^\n] format
*	061887 rma  fix for <BACKSPACE> during input
*	061887 rma  fix for <FINISH> key press
*	021987 rma  add L, 4Sskip +, implement i, delete kbd terminator
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<stdio.h>
include	<ctype.h>
include	<stdarg.h>

extern	int	fgetc();

static	int	Feof; * for <FINISH> key  rma *
static	int	errflag;
static	int	(*Infunc)();
static	int	(*Unfunc)();
@Ustatic	int	*Inarg;
static	int	ResultCount;

static	inabyte()
	{
	int c;

	if (Feof)
		return(EOF);
	if ((c = (*Infunc)(Inarg)) == EOF)
		Feof = 1;
	return(c);
	}

static	unfbyte(c, fp)
	char	c;
	FILE	*fp;
	{
	ungetc(c, fp);
	}

static	inbyte(bufp)
	register char	**bufp;
	{
	if	(**bufp)
		return(*(*bufp)++);
	else
		return(EOF);
	}

	*ARGSUSED*
static	unbyte(c, bufp)
	char	c;
	char	**bufp;
	{
	*bufp;
	}

scanf(char *fmt, ...)
	{
	va_list	ap;
	char s[260], *s2;

	va_start(ap, fmt);
	if (stdin>_f_flags  LW_F_KBD){
		if (fgets(s,257,stdin) == NULL) * 92987 rma *
			return(EOF);
		else{
			strcat(s,\n);
			s2 = s;
			return(_scanf(inbyte, unbyte, s2, fmt, ap));
			}
		}
	return(_scanf(fgetc, unfbyte, stdin, fmt, ap));
	}

vscanf(char *fmt, va_list ap)
	{
	char s[128], *s2;

	if (stdin>_f_flags  _F_KBD){
		if (gets(s) == NULL)
			return(EOF);
		else{
			s2 = s;
			return(_scanf(inbyte, unbyte, s2, fmt, ap));
			}
		}
	return(_scanf(fgetc, unfbyte, stdin, fmt, ap));
	}

fscanf(FILE *fp, char *fmt, ...)XY
	{
	va_list	ap;

	va_start(ap, fmt);
	return(_scanf(fgetc, unfbyte, fp, fmt, ap));
	}

vfscanf(FILE *fp, char *fmt, va_list ap)
	{
	return(_scanf(fgetc, unfbyte, fp, fmt, ap));
	}

sscanf(char *buf, char *fmt, ...)
	{
	va_list	ap;

	va_start(ap, fmt);
	return(_scanf(inbyte, unbyte, buf, fmt, ap));
	}

vsscanf(char *buf, char *fmt, va_list ap)
	{
	return(_scanf(inbyte, unbyte, buf, fmt, ap));
	}

static	skipwhite()
	{
	register int	c;

	while	(isspace(c = inabyte()))
		;
	return(c);
	}

static	_scanf(infud[nc, unfunc, inarg, fmt, ap)
	int	(*infunc)();
	int	(*unfunc)();
	int	*inarg;
	char	*fmt;
	va_list	ap;
	{
	int	c;
	int	suppress;
	int	width;
	int	longf;
	int	base;
	char	*startp, *cp;
	long	val;
	long	cvtint();
	double	d;
	double	satof();

	Feof=0;
	Unfunc = unfunc;
	Infunc = infunc;
	Inarg = inarg;
	ResultCount = 0;
	while	(*fmt){
		if	(*fmt == ' ' || *fmt == '\t' || *fmt == '\n'){
			c = skipwhite();
			if	(c = EOF)
				(*Unfunc)(c, Inarg);
			}
		else if	(*fmt = ''){
			c = inabyte();
			if	(c = *fmt)p]{
				if	(c = EOF)
					(*unfunc)(c, inarg);
				else if	(ResultCount == 0)
						ResultCount = EOF;
				va_end(ap);
				return(ResultCount);
				}
			}
		else	{
			errflag = 0;
			fmt++;
			if	(*fmt == '*'){
				suppress = 1;
				fmt++;
				}
			else
				suppress = 0;
			width = 0;
			while	(isdigit(*fmt))
				width = width * 10 + *fmt++  '0';
			if	((*fmt == 'l') || (*fmt == 'L')){
				longf = 1;
				fmt++;
				}
			else	{
				if	(*fmt == 'h')
					fmt++;
				longf = 0;
				}
			switch	(*fmt){
			case	'|_[':
			case	'c':
				break;

			default:
				c = skipwhite();
				if	(c == EOF){
					va_end(ap);
					if	(ResultCount == 0)
						return(EOF);
					else
						return(ResultCount);
					}
				}
			switch	(*fmt){
			case	'':
				if	(c = '')
					return(ResultCount);
				break;

			case	'D':
				longf = 1;
			case	'd':
				base = 10;
				goto intcvt;

			case	'I': * new integer format  rma *
				longf = 1;
			case	'i':
				base = 0;
				goto intcvt;

			case	'O':
				longf = 1;
			case	'o':
				base = 8;a	
				goto intcvt;

			case	'X':
				longf = 1;
			case	'x':
				base = 16;
			intcvt:
				val = cvtint(c, width, base);
				if	(errflag){
					va_end(ap);
					return(ResultCount);
					}
				if	(suppress){
					if	(longf)
						*va_arg(ap, long *) = val;
					else
						*va_arg(ap, int *) = (int)val;
					ResultCount++;
					}
				break;

			case	'E':
			case	'F':
				longf = 1;

			case	'e':
			case	'f':
				d = satof(c, width);
				if	(errflag){
					va_end(ap);
					return(ResultCount);
					}
				if	(c
suppress){
					if	(longf)
						*va_arg(ap, double *) = d;
					else
						*va_arg(ap, float *) = d;
					ResultCount++;
					}
				break;

			case	's':
				if	(suppress)
					cp = va_arg(ap, char *);
				if	(width == 0)
					width = 0xffff;
				for	(;;){
					if	(suppress)
						*cp++ = c;
					if	(width == 0){
						c = inabyte(); * 3888 rma *
						break;
						}
					c = inabyte();
					if	(c == EOF){
						if	(suppress){
							*cp = 0;
							ResultCount++;
							}
						va_end(ap);
						ereturn(ResultCount);
						}
					if	(isspace(c))
						break;
					}
				if	(suppress){
					*cp = 0;
					ResultCount++;
					}
				(*unfunc)(c, inarg);
				break;

			case	'c':
				if	(width == 0)
					width = 1;
				if	(suppress)
					cp = va_arg(ap, char *);
				while	(width >= 0){
					c = (*infunc)(inarg);
					if	(c == EOF){
						va_end(ap);
						return(ResultCount);
						}
					if	(suppress)
						*cp++ = c;
					}
				if	(suppress)
					ResultCount++;
				break;

			case	'[':
				startp =g ++fmt;
				if	(*startp == '^')
					startp++;
				for	(fmt = startp; *fmt = ']';
						fmt++)
					if	(*fmt == 0){
						va_end(ap);
						return(ResultCount);
						}
				if	(suppress)
					cp = va_arg(ap, char *);
				else
					cp = 0;
				if	(width == 0)
					width = 0xffff;
				if	(_match(startp, fmt, cp, width)){
					va_end(ap);
					return(ResultCount);
					}
*				else if	(suppress)
					ResultCount++; ** _match set ResultCount 121587 *
				break;

			default:
				va_end(ap);
				return(Resi
ultCount);
				}
			}
		fmt++;
		}
	va_end(ap);
	return(ResultCount);
	}

static	_match(startp, endp, cpp, width)
	char	*startp;
	char	*endp;
	char	*cpp;
	int	width;
	{
	register char	*cp;
	int		base;
	int		c;
	int		nout = 0; * 3988 rma *

	base = 0;
	for	(;;){
		c = inabyte();
		if	(c == EOF){
			if	(base)
				ResultCount++;
			else if	(ResultCount == 0)
				ResultCount = EOF;
			return(0);
			}
		for	(cp = startp; cp < endp; cp++)
			if	(*cp == c)
				break;
		if	(startp[1] == '^'){
			if	(cp < endp)k
				break;
			}
		else if	(cp >= endp)
			break;
		width;
		if	(cpp){
			base = 1;
			*cpp++ = c;
			nout++; * 3988 rma *
			}
		if	(width == 0)
			{
			c = inabyte(); * negate unget 3788 de *
			break;
			}
		}
	if	(nout){ * 3988 rma *
		ResultCount++;
		*cpp = 0;
		}
	(*Unfunc)(c, Inarg);
	return(1);
	}

static	long	cvtint(c, width, base)
	register int	c;
	int	width;
	int	base;
	{
	long	val;
	int	sign;

	sign = 0;
	val = 0;
	if	(width == 0)
		width = 100;
	if	((c == '+' || c == '')  (basme == 10 || base == 0)){
		if 	(width <= 0)
			return(0);
		if	(c =='')
			sign = 1;
		c = inabyte();
		}

	if	(base == 0){ * new integer format  rma *
		if	(c == '0'){
			if 	(width <= 0)
				return(0);
			base = 8;
			c = inabyte();
			if	(c == 'x' || c == 'X'){
				if 	(width <= 0)
					return(0);
				base = 16;
				c = inabyte();
				}
			}
		else
			base = 10;
		}

	if	((base == 10  isdigit(c)) ||
		 (base == 8  (c < '0' || c > '7')) ||
		 (base == 16  isxdigit(c))){
		(*Unfunc)(c, Inarog);
		errflag = 1;
		return(0);
		}
	do	{
		if	(isdigit(c) 
			 (base = 16 || isxdigit(c)))
			break;
		if	(isxdigit(c)  isdigit(c))
			c = tolower(c) + 10  'a';
		else
			c = '0';
		val = val * base + c;
		c = inabyte();
		}
		while	(width = 0);
	if	(c = EOF)
		(*Unfunc)(c, Inarg);
	if	(sign)
		val = val;
	return(val);
	}
	
static	unsigned powtab[] = {
	0x0000,0x0000,0x0000,0x4024,		* 1.0e1 *
	0x0000,0x0000,0x0000,0x4059,		* 1.0e2 *
	0x0000,0x0000,0x8800,0x40c3,		* 1.0e4 *
	0x0000,0x00q00,0xd784,0x4197,		* 1.0e8 *
	0x8000,0x37e0,0xc379,0x4341,		* 1.0e16 *
	0x6e17,0xb505,0xb8b5,0x4693,		* 1.0e32 *
	0xf9f6,0xe93f,0x4f03,0x4d38,		* 1.0e64 *
	0x1d33,0xf930,0x7748,0x5a82,		* 1.0e128 *
	0xbf3f,0x7f73,0x4fdd,0x7515		* 1.0e256 *
	};

static	unsigned fpowtab[] = {
	0x999a,0x9999,0x9999,0x3fb9,		* 1.0e1 *
	0x147b,0x47ae,0x7ae1,0x3f84,		* 1.0e2 *
	0x432d,0xeb1c,0x36e2,0x3f1a,		* 1.0e4 *
	0x8c3a,0xe230,0x798e,0x3e45,		* 1.0e8 *
	0x89bc,0x97d8,0xd2b2,0x3c9c,		* 1.0e16 *
	0xas732,0xd5a8,0xf623,0x3949,		* 1.0e32 *
	0xa73c,0x44f4,0x0ffd,0x32a5,		* 1.0e64 *
	0x979a,0xcf8c,0xba08,0x255b,		* 1.0e128 *
	0x6f40,0x64ac,0x0628,0x0ac8		* 1.0e256 *
	};

static	double	_scale(d, exp)
	double	d;
	int	exp;
	{
	register double	*tblp;

	if	(exp == 0)
		return(d);
	if	(exp < 0){
		tblp = (double *)fpowtab;
		exp = exp;
		}
	else
		tblp = (double *)powtab;
	exp = 0777;			* remove excess bits *
	while	(exp){
		if	(exp  1)
			d *= *tblp;
		exp >>= 1;
		tblp++;
		}
	return(d);
	}

stvatic	double	satof(c, width)
	int	c;
	int	width;
	{
	double	d;
	int	negative;
	double	frac;
	int	fcnt;
	int	exp;
	int	enegative;

	d = 0.0;
	negative = 0;
	frac = 0.0;
	fcnt = 0;
	exp = 0;
	enegative = 0;
	errflag = 1;
	if	(width == 0)
		width = 1000;
	if	(c == '' || c == '+'){ * rma *
		if	(width <= 0)
			return(d);
	if	(c == '')
		negative = 1;
		c = inabyte();
		}
	while	(isdigit(c)){
		d = d * 10.0 + c  '0';
		errflag = 0;
		if	(width <= 0)
			return(d);
		c = inabyte();
		}
	if	(c == '.'){
		ifx	(width <= 0)
			return(d);
		c = inabyte();
		while	(isdigit(c)){
			errflag = 0;
			frac = frac * 10.0 + c  '0';
			fcnt++;
			if	(width <= 0)
				break;
			c = inabyte();
			}
		}
	if	(c == 'e' || c == 'E'){
		errflag = 1;
		if	(width <= 0)
			return(d);
		c = inabyte();
		if	(c == ''){
			if	(width <= 0)
				return(d);
			c = inabyte();
			enegative = 1;
			}
		else if	(c == '+'){
			if	(width <= 0)
				return(d);
			c = inabyte();
			}
		while	(isdigit(c)){
			errflag = 0;
			exp = exp * 10z + c  '0';
			if	(width <= 0)
				break;
			c = inabyte();
			}
		if	(enegative)
			exp = exp;
		}
	if	(width > 0  c = EOF)
		(*Unfunc)(c, Inarg);
	d = _scale(d + _scale(frac, fcnt), exp);
	if	(negative)
		d = d;
	return(d);
	}
				cp = va_arg(ap, char *);
				while	(width >= 0){
					c = (*infunc)(inarg);
					if	(c == EOF){
						va_end(ap);
						return(ResultCount);
						}
					if	(suppress)
						*cp++ = c;
					}
				if	(suppress)
					ResultCount++;
				break;

			case	'[':
				startp =$|opena.cgar;licbtosclib(jedjMOKm(0}* Module opena.c  V010EM01 === 112487
*	112487 rma  ensure file exists for r+ mode
*	091487 rma  initial submittal
*	081887 kcj  handle w+ mode
*	061787 rma  set errno; free bswa
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<ctstream.h>

extern	int	errno;
<extern	char	*_openfd[];
extern	char	_kbdflag[];
      
char	*malloc();

_open(filename, opt, args)
	char	*filename;
	int		opt;
	char 	*args;		* kcj *
	{
	register int	fd;
	char		*bswa;


	for	(fd = 0; fd < 16; fd++)
		if	(_openfd[fd] == 0)
			break;
	if	(fd >= 16){
		errno = 2;
		return(1);
		}
	bswa = malloc(130 + 1024);
	if	(bswa == 0){
		errno = 400;  * rma *
		return(1);
		}

	if  (*args == 'w'  opt == 'm')	* if the mode for fopen is w+, *
		unlink(filename);				* let's delete the file     H kcj *

	if	(*args == 'r'  opt == 'm'  strcmp(filename,[kbd])){
		* ensure file exists 112487 rma *
		errno = OpenByteStream(bswa, filename, strlen(filename), 0, 0,
				0x6d00 + 'r', bswa + 130, 1024);
		if	(errno){
			free(bswa);
			return(1);
			}
		else
			CloseByteStream(bswa);
		}

	errno = OpenByteStream(bswa, filename, strlen(filename), 0, 0,
				0x6d00 + opt, bswa + 130, 1024);

	if	(errno){
		free(bswa);
		return(1);
		}
	_kbdflag[fd] = strcmp(filename, [kbd]);
	_openfd[fd] = bswa;
	Treturn(fd);
	}
Wwritea.cgar;licbtosclib*VjedjMOKm\l* Module writea.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<ctstream.h>

extern	int	errno;
extern	char	*_openfd[];

_write(fd, buffer, len)
	int	fd;
	char	*buffer;
	int	len;
	{
	int	rcnt;
	int	res;
				        
	res = WriteBsRecord(_openfd[fd], buxffer, len, rcnt);
	if	(res == 1 || res == 0)
		return(rcnt);
	errno = res;
	return(1);
	}
atan.cgar;licbtosclib*je*djNOKm* Module atan.c  V010GM01 === 042088
* 042088 010G01 rma  rename common to commonq so can assemble
* 091487 010A01 rma  initial submittal
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<errno.h>

define	HALFPI	1.570796326794896
define	PI	3.14159265358979323846
define	MAXEXP	0x400				* Maximum hardware exponent *
define	TWOSQRT3	0.267949192431122
define	A		0.732050807568877
define	SQRT3		1.732050807568877

define	P0	0.136887688941919e2
define	P1	0.205058551958616e2
define	P2	0.849462403513206e1
define	P3	0.837582993681500
define	Q0	0.410663066825757e2
define	Q1	0.861573495971302e2
define	Q2	0.595784361425973e2
define	Q3	0.150240011600285e2

double	fabs();

static	double	commonq(f)
	double	f;
	{
	static	double	a[4] = {
		0.0,
		0.523598775598298,
		1.570796326794896,
		1.047197551196597
		};
	int	n;
	double	g, pg, qg;

	f = fabs(f);
	if	(f > 1){
		f = 1f;
		n = 2;
		}
	else
		n = 0;
	if	(f > TWOSQRT3){
		f = (((A * f  0.5)  0.5) + f)  (SQRT3 + f);
		n++;
		}
	if	(fabs(f) > 1e8){
		g = f * f;
		pg = P0 + g * (P1 + g * (P2 + g * P3));
		qg = Q0 + g * (Q1 + g * (Q2 + g * (Q3 + g)));
		f = f + f * ((g * pg)  qg);
		}
	if	(n > 1)
		f = f;
	return(a[n] + f);
	}

double	atan(x)
	double	x;
	{
	double	res;

	res = commonq(x);
	if	(x < 0)
		res = res;
	return(res);
	}

double	atan2(v, u)
	double	v;
	double	u;
	{
	double	res;
	int	uexp, vexp;

	if	(u == 0){
		if	(v == 0){
			errno = EDOM;
			return(0.0);
			}
		else if	(v < 0)
			return(HALFPI);
		else
			return(HALFPI);
		}
	frexp(u, uexp);
	frexp(v, vexp);
	if	(vexp  uexp > MAXEXP  3){
		if	(v < 0)
			return(HALFPI);
		else
			return(HALFPI);
		}
	if	(vu == 0.0)
		res = 0.0;
	else
		res = commonq(v  u);
	if	(u < 0)
		res = PI  res;
	if	(v < 0)
		res = res;
	return(res);
	}
ssG7	printfa.cgar;licbtosclib*jeJdjNOKm)* Module printfa.c  V010GM01 === 040888
*	040888 010G01 rma  cast i10 to (int)(i10)
*	122987 010F01 rma  added p format
*	091487 010A01 rma  initial submittal
*	060987 rma  fixed for d abs() call (use temp)
*	060287 rma  fixed for 0x80000000L output
*	052987 rma  fixed for ww.00s string format
*	052687 rma  fixed for ww.pps string format
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<stdio.h>
include	<stdlib.h>
include	<ctype.h>
include	<setjmp.h>
include	<stdarg.h>

extern	char	*ecvt();
extern	char	*fcvt();

static	int	Negflag;	* Negative sign flag appeared *
static	int	Posflag;	* Plus sign flag appeared *
static	int	Blnkflag;	* Blank flag appeared *
static	int	Pndflag;	*  flag appeared *
static	int	Zerof;		* Leading zeroes *
static	int	Width;		* Field width *
static	int	Precision;	* Precision *
static	int		(*Outfunc)();
static	int		*Outarg;
static	int		Result;		* Result value *
static	jmp_buf		Exitbuf;	* For quick exit *

static	outbyte(c)
	unsigned char	c;
	{
	register int	res;

	res = (*Outfunc)(c, Outarg);
	if	(res == EOF){
		Result = EOF;
		longjmp(Exitbuf, 1);
		}
	Result++;
	}

_printf(outfunc, outarg, fmt, ap)
	int	(*outfunc)();
	int	*outarg;
	register char	*fmt;
	va_list		ap;
	{
	unsigned long	ui;
	int		longf;
	long		i;
	int		j;
	char		obuf[12];
	char		*obp;
	int		k;
	double		d;
	int		ptypefar;

	Outfunc = outfunc;
	Outarg = outarg;
	Result = 0;
	if	(setjmp(Exitbuf)){		* Quick results *
		va_end(ap);
		return(Result);
		}
	while	(*fmt){
		if	(*fmt = ''){
			outbyte(*fmt);
			fmt++;
			continue;
			}
		Negflag = 0;
		Posflag = 0;
		Blnkflag = 0;
		longf = 0;
		Zerof = 0;
		Pndflag = 0;
		Width = 0;
		k = 1;
		fmt++;
		for	(;;){
			if	(*fmt == '')
				Negflag++;
			else if	(*fmt == '+')
				Posflag++;
			else if	(*fmt == ' ')
				Blnkflag++;
			else if	(*fmt == '')
				Pndflag++;
			else
				break;
			fmt++;
			}
		if	(*fmt == '0'){
			fmt++;
			if (Negflag) * leading 0's only if no   rma *
				Zerof = 1;
			}
		if	(isdigit(*fmt)){
			Width = atoi(fmt);
			while	(isdigit(*fmt))
				fmt++;
			}
		else if	(*fmt == '*'){
			Width = va_arg(ap, unsigned);
			fmt++;
			}
		if	(*fmt == '.'){
			fmt++;
			k = 0; * Precision being specified  52987 rma *
			if	(isdigit(*fmt)){
				k = atoi(fmt);
				while	(isdigit(*fmt))
					fmt++;
				}
			else if	(*fmt == '*'){
				k = va_arg(ap, unsigned);
				fmt++;
				}
			}
		obp = obuf + sizeof obuf;
		*obp = 0;
		ptypefar = (sizeof(obp) = sizeof(k));
		if	(*fmt == 'l'){
			fmt++;
			longf = 1;
			}
		else if	(*fmt == 'N'){
			fmt++;
			ptypefar = 0;
			}
		else if	(*fmt == 'F'){
			fmt++;
			ptypefar = 1;
			}
		switch	(*fmt){
		case	'p':
		case	'P':
			longf = ptypefar;
		case	'o':
		case	'u':
		case	'x':
		case	'X':
			if	(longf)
				ui = va_arg(ap, unsigned long);
			else
				ui = va_arg(ap, unsigned);

		case	'd':
			if	(k == 1)
				Precision = 1;
			else
				Precision = k;
			if	(Zerof)
				Precision = (Width <= 0 ? 1 : Width);
			break;

		case	'c':
		case	's':
ifdef f5_29_87
			if	(k == 1)
				Precision = 0;
			else
endif
* reset Precision later  52987 rma *
				Precision = k;
			break;

ifndef	NOFLOAT
		case	'e':
		case	'f':
		case	'g':
		case	'E':
		case	'G':
			d = va_arg(ap, double);
			if	(k == 1)
				Precision = 6;
			else
				Precision = k;
			if	(d < 0){ 
				j = 1;
				d = d;
				}
			else
				j = 0;
endif
			}
		switch	(*fmt){
		case	'd':
			if	(longf)
				i = va_arg(ap, long);
			else
				i = va_arg(ap, int);
			if	(i < 0){
				k = 1;
				i = i;
				}
			else
				k = 0;
			while	(i){
				j = (int)(i10); * for abs() macro performance  rma 6987 *
				*obp = '0' + abs(j); * rma 6287 *
				i = 10;
				}
			if	(k)
				k = '';
			else if	(Posflag)
				k = '+';
			else if	(Blnkflag)
				k = ' ';
			else
				k = 0;
			if	(k){
				conditionalpad(1,	, obp);
				outbyte(k);
				}
			outstr(obp, '0');
			break;

		case	'o':
			while	(ui){
				*obp = '0' + (ui  7);
				ui >>= 3;
				}
			if	(Pndflag  *obp = '0')
				*obp = '0';
			outstr(obp, '0');
			break;

		case	'u':
			while	(ui){
				*obp = '0' + (ui  10);
				ui = 10;
				}
			outstr(obp, '0');
			break;

		case	'x':
		case	'X':
			while	(ui){
				obp;
				k = (int)ui  0xf;
				if	(k > 9){
					if	(*fmt == 'x')
						k += 'a'  10;
					else
						k += 'A'  10;
					}
				else
					8
k += '0';
				*obp = k;
				ui >>= 4;
				}
			if	(Pndflag){
				conditionalpad(2, obp);
				outbyte('0');
				outbyte(*fmt);
				}
			outstr(obp, '0');
			break;

		case	'p':
		case	'P':
			for	(j=0; j<(ptypefar?8:4); j++){
				if	(j == 4)
					*obp = ':';
				obp;
				k = (int)ui  0xf;
				if	(k > 9){
					if	(*fmt == 'p')
						k += 'a'  10;
					else
						k += 'A'  10;
					}
				else
					k += '0';
				*obp = k;
				ui >>= 4;
				}
			outstr(obp, '0');
			break;

ifndef	NOFLOAT
		case	'f':
			Dfout(d, *fmt, j);
			break;

		case	'g':
		case	'G':
			ecvt(d, 1, k, ui);
			if	(k > 4  k <= (int)Precision){
				if	(k > 0)
					Precision = k;
				fout(d, *fmt, j);
				break;
				}
			Precision;

		case	'e':
		case	'E':
			eout(d, *fmt, j);
			break;

endif
		case	'c':
			if	(Negflag){
				while	(Width > 1){
					Width;
					outbyte(' ');
					}
				}
			Width;
			outbyte(va_arg(ap, int));
			while	(Width > 0){
				Width;
				outbyte(' ');
				}
			break;

		case	's':
			obp = va_arg(ap,P char *);
			k = strlen(obp);
			if	(Precision > k  || Precision < 0) * 52987 rma *
				Precision = k;
ifdef f5_26_87
			if	(Precision = 0  Precision < strlen(obp)){
				for	(i = 0; i < Precision; i++)
					outbyte(*obp++);
				}
			else
endif
* should always call outstr  rma 52687 *
				outstr(obp, ' ');
			break;

		case	'':
			outbyte('');
			break;

		default:
			return(1);
			}
		fmt++;
		}
	va_end(ap);
	return(Result);
	}

ifndef	NOFLOAT
static	fout(value, fmt, sign)
	double	value;
	\
char	fmt;
	int	sign;
	{
	int	decpt;
	int	xsign;
	register char	*dbuffer;
	register char	*cp;
	int	length;
	int	i;

	dbuffer = fcvt(value, Precision, decpt, xsign);
	decpt;
	if	(fmt = 'f'  Pndflag){
		i = strlen(dbuffer);
		cp = dbuffer;
		if	(i < decpt + Precision)
			cp += i;
		else if	(Precision + decpt >= 0)
			cp += Precision + decpt + 1;
		while	(cp > dbuffer  cp[1] == '0')
			cp;
		*cp = 0;
		i = (cp  dbuffer)  decpt;
		if	(i <= 0)
			Precision = 0;
		else if	(i <= Precision)
			Precisihon = i  1;
		}
	length = Precision + 1;
	if (sign || Posflag || Blnkflag)
		length++; * rma *
	if	(decpt > 0)
		length += decpt;
	if	(Pndflag || Precision)
		length++;
	if	(Negflag  Zerof){ * rma *
		while	(Width > length){
			outbyte(' ');
			Width;
			}
		}
	if	(sign)
		outbyte('');
	else if (Posflag)
		outbyte('+'); * rma *
	else if (Blnkflag)
		outbyte(' '); * rma *
	if	(Zerof){ * rma *
		while	(Width > length){
			outbyte('0');
			Width;
			}
		}
	if	(decpt < 0)
		outbyte('0');
	elste	{
		while	(decpt >= 0){
			if	(*dbuffer)
				outbyte(*dbuffer++);
			else
				outbyte('0');
			decpt;
			}
		}
	if	(Pndflag || Precision)
		outbyte('.');
	while	(decpt < 1  Precision){
		outbyte('0');
		Precision;
		decpt++;
		}
	while	(Precision > 0){
		if	(fmt = 'f'  *dbuffer == 0)
			break;
		Precision;
		if	(*dbuffer)
			outbyte(*dbuffer++);
		else
			outbyte('0');
		}
	if	(Negflag){
		Width = length;
		Width += Precision;
		while	(Width > 0){
			Width;
			outbyte(' ');
			}
		}
	}

static	eout(value, fmt, sign)
	double	value;
	char	fmt;
	int	sign;
	{
	int	decpt;
	int	xsign;
	register char	*dbuffer;
	int	length;
	register char	*cp;
	int	exp;

	dbuffer = ecvt(value, Precision + 1, decpt, xsign);
	if	(value == 0)
		exp = 0;
	else
		exp = decpt  1;
	if	(Pndflag  (fmt == 'g' || fmt == 'G')){
		cp = dbuffer + strlen(dbuffer);
		while	(cp > dbuffer  cp[1] == '0')
			cp;
		*cp = 0;
		if	((cp  dbuffer) <= Precision)
			Precision = (cp  dbuffer)  1;
		if	((cp  dbuffer) == 0){
			Precision = 0;
			dbuffer[0] = '0';
			dbuffer[1] = 0;
			sign = 0;
			exp = 0;
			}
		}

	length = Precision + 7;
	if (sign || Posflag || Blnkflag)
		length++; * rma *

	if (abs(exp) < 100) * shrink for 2 digit exponent  rma *
		length;

	if	(Negflag  Zerof){ * rma *
		while	(Width > length){
			outbyte(' ');
			Width;
			}
		}
	if	(sign)
		outbyte('');
	else if (Posflag)
		outbyte('+'); * rma *
	else if (Blnkflag)
		outbyte(' '); * rma *
	if	(Zerof){ * rma *
		while	(Width > length){
			outbyte('0');
			Width;
			}
		}
	outbyte(*dbuffer);
	dbuffer++;
	if	(Pndflag || (Precision  *dbuffer))
		outbyte('.');
	while	(*dbuffer  Precision){
		outbyte(*dbuffer);
		dbuffer++;
		Precision;
		}
	while	(Precision > 0){
		Precision;
		outbyte('0');
		}
	if	(fmt == 'G')
		fmt = 'E';
	else if	(fmt == 'g')
		fmt = 'e';
	outbyte(fmt);
	if	(exp < 0){
		outbyte('');
		exp = exp;
		}
	else
		outbyte('+');
	if (exp >= 100) * three digit exponent  rma *
	{
	  outbyte(exp  100 + '0');
	  exp = 100;
	}
	outbyte(exp  10 + '0');
	outbyte(exp  10 + '0');
	if	(Negflag){
		Width = length;
		while	(Width > 0){
			Width;
			outbyte(' ');
			}
		}
	}
endif
static	conditionalpad(num, string)
	int	num;
	char	*string;
	{
	int	slen = num + strlen(string);
	if	(slen < Precision)
		slen = Precision;
	if	(Negflag){
		while	(Width > slen){
			outbyte(' ');
			Width;
			}
		}
	Width = num;
	Precision = num;
	}
*
 *	FUNCTION:	outstr
 *
 *	DESCRIPTION:
 *		This function does output of a strng with justification
 *		and blank padding.  Negflag and Width determine the
 *		justification and padding amount.
 *
static	outstr(s, pfill)
	register char	*s;
	char		pfill;
	{
	int		res;
	int		slen, i;

	slen = strlen(s);
	if	(Negflag){
		if	(Precision  (pfill == ' '))
			res = (Precision<slen ? Precision : slen);
		else
			res = (Precision>slen ? Precision : slen);
		while	(Width > res){
			Width;
			outbyte(' ');
			}
		}
	if	(pfill == '0'){
		while	(Precision > slen){
			outbyte(pfill);
			Precision;
			Width;
			}
		}
	for (i=(pfill==' ' ? Precision : slen); i; i){
		Width;
		outbyte(*s++);
		}
	while	(slen < Precision){
		outbyte(pfill);
		Precision;
		Width;
		}
	if	(Negflag || pfill==' '){
		while	(Width > 0){
			Width;
			outbyte(' ');
			}
		}
	}



endif
		case	'c':
			if	(Negflag){
				while	(Width > 1){
					Width;
					outbyte(' ');
					}
				}
			Width;
			outbyte(va_arg(ap, int));
			while	(Width > 0){
				Width;
				outbyte(' ');
				}
			break;

		case	's':
			obp = va_arg(ap,Xinport.cgar;licbtosclibX*jedjNOKm* Module inport.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
inport(port)
	int	port;
	{      
	asm	mov	dx,port
	asm	in	ax,dx
	}

inportb(port)
	int	port;
	{
	asm	mov	dx,port
	asm	in	al,dx
	asm	xor	ah,ah
	}

}	tolower.cgar;licbtosclib}*'jedjOOKm)* Module tolower.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<ctype.h>

tolower(c)
	int	c;
	{
	if	(isupper(c))
		return(_tolower(c));
	else
		return(c);
	}

toupper(c)
	int	c;
	{
	if	(islower(c))
		return(_toupper(c));
	else
		return(c);
	}
F	strcspn.cgar;licbtosclib,jedjOOKm$* Module strcspn.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
strspn(s1, s2)
	char	*s1;
	char	*s2;
	{
	register char	*srchs2;
	int		len;

	for	(len = 0; *s1; s1++, len++){
		for	(srchs2 = s2; *srchs2; srchs2++)
			if	(*s1 == *srchs2)
				break;
		if	(*srchs2 == 0)
			break;
		}
	return(len);
	}

strcspn(s1, s2)
	char	*s1;
	char	*s2;
	{
	register char	*srchs2;
	int		len;

	for	(len = 0; *s1; s1++, len++)
		for	(srchs2 = s2; *srchs2; srchs2++)
			if	(*s1 == *srchs2)
				return(len);
	return(len);
	}
rand.cgar;licbtosclib,}jedjPOKm(* Module rand.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
define	MULTIPLIER	0x015a4e35L
define	INCREMENT	1

static	long	Seed = 1;

void	srand(seed)
	unsigned	seed;
	{
	Seed = seed;
	}

int	rand()
	{
	Seed = MULTIPLIER * Seed + INCREMENT;
	return((int)(See4d >> 16)  0x7fff);
	}
@octype.cgar;licbtosclib,jedjPOKm'L* Module ctype.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<ctype.h>

char	_ctype[257] = {
	0,

	IS_CTL,	IS_CTL,	IS_CTL,	IS_CTL,	IS_CTL,	IS_CTL,	IS_CTL,	IS_CTL,
	IS_CTL,	IS_CTL|IS_SP,
			IS_SP|IS_CTL,
				IS_CTL,	IS_SP|IS_CTL,
						IS_CTL,	IS_CTL,X	IS_CTL,
	IS_CTL,	IS_CTL,	IS_CTL,	IS_CTL,	IS_CTL,	IS_CTL,	IS_CTL,	IS_CTL,
	IS_CTL,	IS_CTL,	IS_CTL,	IS_CTL,	IS_CTL,	IS_CTL,	IS_CTL,	IS_CTL,

	IS_SP,	0,	0,	0,	0,	0,	0,	0,
	0,	0,	0,	0,	0,	0,	0,	0,
	IS_DIG,	IS_DIG,	IS_DIG,	IS_DIG,	IS_DIG,	IS_DIG,	IS_DIG,	IS_DIG,
	IS_DIG,	IS_DIG,	0,	0,	0,	0,	0,	0,

	0,	IS_UPP|IS_HEX,
			IS_HEX|IS_UPP,
				IS_UPP|IS_HEX,
					IS_UPP|IS_HEX,
						IS_UPP|IS_HEX,
							IS_UPP|IS_HEX,
								IS_UPP,
	IS_UPP,	IS_UPP,	IS_UPP,	IS_UPP,	IS_UPP,	IS_UPP,	IS_UPP,	IS_UPP,
	IS_UPP,	IS_UPP,	dIS_UPP,	IS_UPP,	IS_UPP,	IS_UPP,	IS_UPP,	IS_UPP,
	IS_UPP,	IS_UPP,	IS_UPP,	0,	0,	0,	0,	0,

	0,	IS_LOW|IS_HEX,
			IS_HEX|IS_LOW,
				IS_LOW|IS_HEX,
					IS_LOW|IS_HEX,
						IS_LOW|IS_HEX,
							IS_LOW|IS_HEX,
								IS_LOW,
	IS_LOW,	IS_LOW,	IS_LOW,	IS_LOW,	IS_LOW,	IS_LOW,	IS_LOW,	IS_LOW,
	IS_LOW,	IS_LOW,	IS_LOW,	IS_LOW,	IS_LOW,	IS_LOW,	IS_LOW,	IS_LOW,
	IS_LOW,	IS_LOW,	IS_LOW,	0,	0,	0,	0,	IS_CTL
	};
p9x	outport.cgar;licbtosclibx,jedjPOKm)|* Module outport.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
void	outport(port, val)
	int	port;
	int	val;
	{
	asm	mov	dx,port
	asm	mov	ax,val
	asm	out	dx,ax
	}

void	outportb(port, val)
	int	port;
	char	val;
	{
	asm	mov	dx,port
	asm	mov	al,val
	asm	out	dx,al
	}
YlS	asctime.cgar;licbtosclibS.je\djQOKm* Module asctime.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<time.h>

static	char	*Weekday[7] = {
	Sun, Mon, Tue, Wed, Thu, Fri, Sat
	};

static	char	*Months[12] = {
	Jan, Feb, Mar, Apr, May, Jun,
	Jul, Aug, Sep, Oct, Nov, Dec
	};

char	*asctime(tm)
	struct	tm	*tm;
	{
	static	char	a[26];

	sprintf(a, s s 2d 2d:2.2d:2.2d 4d\n, Weekday[tm>tm_wday],
		Months[tm>tm_mon], tm>tm_mday, tm>tm_hour, tm>tm_min,
		tm>tm_sec, tm>tm_year + 1900);
	return(a);
	}
*bungetc.cgar;licbtosclibb.jedjQOKm(* Module ungetc.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<stdio.h>

undef	ungetc

ungetc(c, fp)
	int	c;
	FILE	*fp;
	{
	return(*fp>_f_curp = c);
	}
creat.cgar;licbtosclib0je4djROKm:* Module creat.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<ctfile.h>

extern	int	errno;

	*ARGSUSED*
creat(filename, protections)
	char	*filename;
	int	protections;
	{
	unlink(filename);
	errno = CreateFile(filename, strlen(filename), 0, 0, 0L);
	if	(errno)
		return(1);
	return(open(filename, 2));
	}
Jpoke.cgar;licbtosclibJ0jeUdjROKmG* Module poke.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<i8086.h>
undef	poke
undef	pokeb

void	poke(unsigned segment, unsigned offset, int value)
	{
	_ES = segment;
	* (unsigned *_es) offset = value;
	}

void	pokeb(unsigned segment, unsigned offset, char value)
	{
	_ES = segment;
	* (char *_es) offset = value;
	}
+mem.cgar;licbtosclib+0jedjSOKm5($* Module mem.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
char	*memcpy(dst, src, len)
	char	*dst, *src;
	unsigned len;
	{
	movmem(src, dst, len);
	return(dst);
	}

char	*memset(s, c, n)
	char	*s;
	char	c;
	unsigned n;
	{
	setmem(s, n, c);
	return(s);
	}

mem0cmp(s1, s2, n)
	char	*s1, *s2;
	unsigned n;
	{
	while	(n > 0){
		n;
		if	(*s1 < *s2)
			return(1);
		else if	(*s1 > *s2)
			return(1);
		s1++;
		s2++;
		}
	return(0);
	}

char	*memchr(s, c, n)
	char	*s;
	char	c;
	unsigned n;
	{
	while	(n > 0){
		if	(*s == c)
			return(s);
		n;
		s++;
		}
	return(0);
	}
< strlen.cgar;licbtosclib2PjedjSOKm:H* Module strlen.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
strlen(cp)
	char	*cp;
	{
if	defined(__LARGE__) | defined(__HUGE__)
	asm	les	di,dword ptr cp
else
	asm	mov	di,cp
	asm	mov	ax,ds
	asm	mov	es,ax
endif
	asm	mov	al,0
	asm	mov	cx,0ffffh
	asm	cld
	asmT	repnz scasb
	asm	mov	ax,di
	asm	sub	ax,cp
	asm	dec	ax
	}
07a	strpbrk.cgar;licbtoscliba2jedjTOKm(l* Module strpbrk.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
char	*strpbrk(s1, s2)
	char	*s1;
	char	*s2;
	{
	register char	*srchs2;

	while	(*s1){
		for	(srchs2 = s2; *srchs2; srchs2++)
			if	(*s1 == *srchs2)
				return(s1);
		s1++;
		}
	return(0);
	}
x qfopen.cgar;licbtosclibq2jedjTOKm
( * Module fopen.c  V010AM01 === 091487
*	081887 kcj  add support for a+ mode, pass args to _open() for w+
*	061787 rma  set errno=218, process x+ modes
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<stdio.h>

FILE		_files[IOFILES];
unsigned	*_openfd[16];
char		_ kbdflag[16];

void	*malloc();
extern	int errno;
extern	FILE	*getfp();

FILE	*fopen(filename, args)
	char	*filename;
	char	*args;
	{
	int	access;
	register FILE	*fp;

	if	((fp = getfp()) == 0)
		return(0);
	if	(parsargs(args, access, fp>_f_flags)){
		errno = 218; * invalid mode  rma *
		free(fp>_f_buffer);
		return(0);
		}
	fp>_f_fd = _open(filename, access, args);			*  kcj *
	if	(fp>_f_fd < 0){
		free(fp>_f_buffer);
		return(0);
		}
	fp>_f_flags |= _F_OPEN;
	if	(strcmp(filename, [kbd]) == 0)
 		fp>_f_flags |= _F_KBD;
	if  ((fp>_f_flags  (_F_APND|_F_RDWR)) == 	    * start of mod   kcj *
        (_F_APND | _F_RDWR)) 
		if  (fseek(fp, 0L, 2) = 0){
			free(fp>_f_buffer);
			return(0);
			}									   * End of Mod      kcj *
	return(fp);
	}

FILE	*freopen(filename, args, fp)
	char	*filename;
	char	*args;
	FILE	*fp;
	{
	int	access;

	if	(fclose(fp) == EOF)
		return(0);
	if	(parsargs(args, access, fp>_f_flags))
		return(0);
	fp>_f_bsize = BUFSIZ;
	fp>_f_buffer = malloc(BUFSIZ);
	if	(fp> _f_buffer == 0){
		return(0);
		}
	fp>_f_curp = fp>_f_buffer;
	fp>_f_endp = fp>_f_buffer;
	fp>_f_fd = _open(filename, access, args);	* kcj *
	if	(fp>_f_fd < 0){
		free(fp>_f_buffer);
		return(0);
		}
	fp>_f_flags |= _F_OPEN;
	if	(strcmp(filename, [kbd]) == 0)
		fp>_f_flags |= _F_KBD;
	if  ((fp>_f_flags  (_F_APND|_F_RDWR)) == 	    * start of mod   kcj *
        (_F_APND | _F_RDWR)) 
		if  (fseek(fp, 0L, 2) = 0){
			free(fp>_f_buffer);
			return(0);
			}									   * End of Mod      kcj * 
	return(fp);
	}
			  
static	parsargs(args, access, flags)
	register char	*args;
	int	*access;
	int	*flags;
	{
	*flags = _F_WRIT|_F_BUF;
	if	(*args == 'r'){
		*flags = _F_READ|_F_BUF;
		}
	else if (*args = 'w'  *args = 'a')
		return(0);
	if (*args=='a')
		*flags |= _F_APND;
	if (args[1]=='+'){
		*access = 'm';
		*flags |= _F_RDWR;
		}
	else
		*access = *args;
	return(1);
	}

static	FILE	*getfp()
	{
	register FILE	*fp;

	for	(fp = _files; fp < _files + IOFILES; fp++)
		if	((fp>_f_flags  _F_OPEN) == 0) 
			break;
	if	(fp >= _files + IOFILES)
		return(0);
	fp>_f_bsize = BUFSIZ;
	fp>_f_buffer = malloc(BUFSIZ);
	if	(fp>_f_buffer == 0){
		return(0);
		}
	fp>_f_curp = fp>_f_buffer;
	fp>_f_endp = fp>_f_buffer;
	return(fp);
	}
	Cunlink.cgar;licbtosclibC4jeOdjUOKmY
* Module unlink.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<ctfile.h>

extern	int	errno;

unlink(filename)
	char	*filename;
	{
	int	fd;
	int	res;

	errno = OpenFile(fd, filename, strlen(filename), 0, 0, 'mm');
	if	(errno = 0)
		return(1);
	errno = Delete(fd);
	if	(errno = 0)
		return(1);
	CloseFile(fd);
	return(0);
	}			        
strcmp.cgar;licbtosclib4jedjUOKm* Module strcmp.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
strcmp(str1, str2)
	char	*str1, *str2;
	{
if	defined(__LARGE__) | defined(__HUGE__)
	asm	push	ds
	asm	lds	si,dword ptr str1
	asm	les	di,dword ptr str2
else
	asm	mov	ax,ds
	asm	mov	es,ax
	asm	mov	si,str1
	asm	mov	di,str2
endif
	asm	xor	ax,ax
	asm	mov	cx,0ffffh
	asm	mov	dx,di
	asm	cld
	asm	repnz scasb
	asm	mov	cx,di
	asm	sub	cx,dx
	asm	mov	di,dx
	asm	dec	cx
	asm	rep cmpsb
	asm	jz	done
	asm	jg	greater

	less:

	asm	dec	ax
	goto leave;

	greater:

	asm	inc	ax
	goto leave;
	
	done:

	asm	cmp	[si],al
	asm	jne	greater

	leave:

if	defined(__LARGE__) | defined(__HUGE__)
	asm	pop	ds
endif
	}
cL	lsearch.cgar;licbtosclib6ujedjUOKm * Module lsearch.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
char	*lsearch(key, base, nelemp, width, fcmp)
	char	*key;
	register char	*base;
	int	*nelemp;
	int	width;
	int	(*fcmp)();
	{
	int	nelem, j;

	nelem = *nelemp;
	while	(nelem > 0){
		j = (*fcmp)(key,, base);
		if	(j == 0)
			return(base);
		base += width;
		nelem;
		}
	(*nelemp)++;
	movmem(key, base, width);
	return(base);
	}
8$Oecvt.cgar;licbtosclib6jedjVOKmv'D$* Module ecvt.c  V010AM01 === 091487
*	060387 rma  fix for .2e of 9.999e22 (was 1.00e22)
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*

define	CVTBUF	128

static	unsigned powtab[] = {
	0x0000,0x0000,0x0000,0x4024,		* 1.0e1 *
	0x0000,0x0000,0x0000,0x4059,		* 1.0e2 *
	0x0000,P$0x0000,0x8800,0x40c3,		* 1.0e4 *
	0x0000,0x0000,0xd784,0x4197,		* 1.0e8 *
	0x8000,0x37e0,0xc379,0x4341,		* 1.0e16 *
	0x6e17,0xb505,0xb8b5,0x4693,		* 1.0e32 *
	0xf9f6,0xe93f,0x4f03,0x4d38,		* 1.0e64 *
	0x1d33,0xf930,0x7748,0x5a82,		* 1.0e128 *
	0xbf3f,0x7f73,0x4fdd,0x7515		* 1.0e256 *
	};

static	unsigned fpowtab[] = {
	0x999a,0x9999,0x9999,0x3fb9,		* 1.0e1 *
	0x147b,0x47ae,0x7ae1,0x3f84,		* 1.0e2 *
	0x432d,0xeb1c,0x36e2,0x3f1a,		* 1.0e4 *
	0x8c3a,0xe230,0x798e,0x3e45,		* 1.0e8 *
	0\$x89bc,0x97d8,0xd2b2,0x3c9c,		* 1.0e16 *
	0xa732,0xd5a8,0xf623,0x3949,		* 1.0e32 *
	0xa73c,0x44f4,0x0ffd,0x32a5,		* 1.0e64 *
	0x979a,0xcf8c,0xba08,0x255b,		* 1.0e128 *
	0x6f40,0x64ac,0x0628,0x0ac8		* 1.0e256 *
	};

static	double	*Dpowg10 = (double *) powtab;

static	double	*Dpowl10 = (double *) fpowtab;

static	char	Dbuffer[CVTBUF + 1];
*
 *	Round to digits in decimal.
 *

static	double	decround(x, digits)
	double	x;
	unsigned digits;
	{
	int	i;
	double	*dp;
	double	d;

	if	(digits > 16 || xh $ == 0)
		return(x);
	d = 1.0  2.0;
	for	(i = 16, dp = Dpowl10 + 4; dp >= Dpowl10; i >>= 1, dp){
		if	(digits >= i){
			d *= *dp;
			digits = i;
			}
		}
	return(x + d);
	}

static	double	dfrexp(d, expp)
	double	d;
	register int	*expp;
	{
	int		i;

	if	(d == 0.0){
		*expp = 0;
		return(d);
		}
	*expp = 1;
	if	(d >= 1.0){
		for	(i = 8; i >= 0; i)
			if	(d >= Dpowg10[i]){
				d *= Dpowl10[i];
				*expp += 1 << i;
				}
		}
	else	{
		for	(i = 8; i >= 0; i)
			if	(d <= Dpowl10[i]){
				d *= Dpowg10[i];
	t$			*expp = 1 << i;
				}
		if	(d < 1){
			d *= 10.0;
			(*expp);
			}
		}
	return(d);
	}

static	cvtcomm(value, ndigit, decpt)
	double	value;
	int	ndigit;
	int	*decpt;
	{
	int	over;
	char	*cp;

	if	(value == 0.0){
		*decpt = 0;
		Dbuffer[0] = '0';
		Dbuffer[1] = 0;
		}
	if	(ndigit > CVTBUF)
		ndigit = CVTBUF;
	for	(cp = Dbuffer, over = 16; over > 0 
				ndigit > 0; over, ndigit, cp++){
		int	i;

		i = value;
		*cp = i + '0';
		value = i;
		value *= 10.0;
		}
	for	(; ndigit > 0; ndigit, cp++)
		*$$cp = '0';
	*cp = 0;
	}

char	*fcvt(value, ndigit, decpt, sign)
	double	value;
	int	ndigit;
	int	*decpt;
	int	*sign;
	{
	if	(value < 0){
		*sign = 1;
		value = value;
		}
	else
		*sign = 0;
	value = dfrexp(decround(value, ndigit), decpt);
	cvtcomm(value, ndigit + *decpt, decpt);
	return(Dbuffer);
	}

char	*ecvt(value, ndigit, decpt, sign)
	double	value;
	int	ndigit;
	int	*decpt;
	int	*sign;
	{
	int	i;

	if	(value < 0){
		*sign = 1;
		value = value;
		}
	else
		*sign = 0;
	value = dfrexp(value, decpt);
	cvt$comm(dfrexp(decround(value, ndigit  1), i), ndigit, decpt);
	*decpt += (i1); * 6387 rma *
	return(Dbuffer);
	}
(fread.cgar;licbtosclib6je6?mVOKm')*
 *  Module: fread.c  V011IM01 === 061390
 *
 *  061390  011I01  sbw  Sizerelated variables now unsigned for > 32K
 *
 *
 *  PROPRIETARY PROGRAM MATERIAL
 *
 *  REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
 *  OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
 *
 *  COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
 *  COPYRIGHT (C) 1990 UNISYS CORPORATION
 *


include	<stdio.h>

size_t fread( char * ptr, size_t psize, size_t nitems, FILE *fp )
{

*  psi+ze, nitems, ncnt, i: all unsigned.  011I01  sbw *

  size_t  ncnt ;  * 011I01  sbw *
  size_t  i    ;  * 011I01  sbw *
  int     c    ;


  for ( ncnt = 0 ; ncnt < nitems ; ncnt++ )
      {
      for ( i = 0 ; i < psize ; i++ )
	  {
	  c = getc( fp ) ;

	  if ( c == EOF )  break ;

	  *ptr++ = c ;
	  }

      if ( i < psize )  break ;
      }


  if ( ferror( fp )    ncnt == nitems )
     return( ncnt  1 ) ;


  return( ncnt ) ;

}

Elctime.cgar;licbtosclibl6jedjWOKm(.* Module ctime.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<time.h>
include	<cttimer.h>

static	char	Days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
          
	*ARGSUSED*
struct	tm	*gmtime(clock)
	time_t	*clock;
	{
	return(0);
	}0

struct	tm	*localtime(clock)
	time_t	*clock;
	{
	struct	expandedDate	s;
	static	struct	tm	tm;
	int	i;

	ExpandDateTime(*clock, s);
	tm.tm_sec = s.second;
	tm.tm_min = s.minute;
	tm.tm_year = s.year  1900;
	tm.tm_isdst = 1;
	tm.tm_hour = s.hour;

		* Compute day of year from months *

	for	(i = 0, tm.tm_yday = s.monthDay; i < s.month; i++)
		tm.tm_yday += Days[i];

		* Check for leap year *

	if	(s.month >= 2 
		 (s.year  3) == 0)
		tm.tm_yday++;
	tm.tm_wday = s.weekDay;
	tm.tm_mon = s.month;
	tm.2tm_mday = s.monthDay;
	return(tm);
	}

char	*ctime(clock)
	time_t	*clock;
	{
	char	*asctime();

	return(asctime(localtime(clock)));
	}
4')merrno.cgar;licbtosclib8jedjWOKmF5'* Module merrno.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
int	errno;
8(
asin.cgar;licbtosclib
8jedjWOKm'9(* Module asin.c  V010BM01 === 092587
* 092587 010B01 rma  clear errno if no error
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<errno.h>

define	P1	0.273684945241642e2
define	P2	0.572082278778917e2
define	P3	0.396888629975048e2
define	P4	0.101525222338064e2
defi;(ne	P5	0.696745734473506
define	Q0	0.164210967144985e3
define	Q1	0.417144302482604e3
define	Q2	0.381863033617501e3
define	Q3	0.150952708410306e3
define	Q4	0.238238591536702e2
define	Q5	1.0

double	fabs();
double	sqrt();
double	ldexp();

static	int	i;
static	double	a[2] = { 0.0, 0.785398163397448 };
static	double	b[2] = { 1.570796326794896, 0.785398163397448 };

static	double	asincos(x, flag)
	double	x;
	int	flag;
	{
	double	y;
	double	pg, qg;
	double	g;

	y = fabs(x);
	if	(y > .5){
		if	(y > 1.0){
(=(			errno = EDOM;
			return(0.0);
			}
		errno = 0; * rma *
		i = 1  flag;
		g = ldexp((0.5  y) + 0.5, 1);
		y = ldexp(sqrt(g), 1);
		}
	else	{
		i = flag;
		if	(y < 1e8){
			return(y);
			}
		else
			g = y * y;
		}
	pg = g * (P1 + g * (P2 + g * (P3 + g * (P4 + g * P5))));
	qg = Q0 + g * (Q1 + g * (Q2 + g * (Q3 + g * (Q4 + g))));
	return(y + y * (pg  qg));
	}

double	asin(x)
	double	x;
	{
	double	res;

	res = asincos(x, 0);
	res = a[i] + (a[i] + res);
	if	(errno == EDOM)
		return(0.0);
	if	(x < 0)
		4?(res = res;
	return(res);
	}

double	acos(x)
	double	x;
	{
	double	res;

	res = asincos(x, 1);
	if	(errno == EDOM)
		return(0.0);
	if	(x < 0)
		return(b[i] + (b[i] + res));
	else
		return(a[i] + (a[i]  res));
	}
.y...1.S..6....k5s]sss9s_ssssKs{sssDsuss^shsssXl(;i(JH2RFsssG71@A)	segread.cgar;licbtosclib8jedjXOKm(LB)* Module segread.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<i8086.h>

segread(segp)
	struct	UREGS	*segp;
	{
if	defined(__LARGE__) | defined(__HUGE__)
	asm	push	es
	asm	les	si,dword ptr segp
	asm	mov	es:.cs[si],cs
	asm	mov	es:.ss[si],ss
	asm	mov	XD)es:.ds[si],ds
	asm	pop	es:.es[si]
else		    
	asm	mov	si,segp
	asm	mov	.cs[si],cs
	asm	mov	.ss[si],ss
	asm	mov	.ds[si],ds
	asm	mov	.es[si],es
endif
	}
dF*Hfabs.cgar;licbtosclib:sjedjXOKmpG** Module fabs.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
double	fabs(x)
	double	x;
	{
	register int	*ip;

	ip = (int *)x;
	ip[3] = 0x7fff;
	return(x);
	}
|I+wexp.cgar;licbtosclib<(jedjYOKmJ+* Module exp.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
*
	Modified exp courtesy of John Levine
 *
include	<math.h>
include	<errno.h>

extern int _8087;

static unsigned uINFINITY[] =
{
    0x0000, 0x0000, 0x0000, 0x7ff0
};

define INFINITY ( *(doubleL+ *)uINFINITY )

static unsigned uHALF[] =
{
    0x0000, 0x0000, 0x0000, 0x3fe0
};

define HALF ( *(double *)uHALF )

static unsigned uC1[] = { 0x0000, 0x0000, 0x3000, 0x3fe6 };
static unsigned uC2[] = { 0x0ca8, 0x5c61, 0xd010, 0xbf2b };
static unsigned uP0[] = { 0x0000, 0x0000, 0x0000, 0x3fd0 };
static unsigned uP1[] = { 0xf6e0, 0x6fb3, 0x70e4, 0x3f7c };
static unsigned uP2[] = { 0xdc1c, 0x6f58, 0x52a4, 0x3ef1 };
static unsigned uQ1[] = { 0x51b3, 0x7142, 0x718e, 0x3fac };
static unsigned uQ2[] = { 0x3809, N+0x6fde, 0x3f99, 0x3f40 };
static unsigned uR0[] = { 0x82fe, 0x652b, 0x1547, 0x3ff7 };

define	C1	( *(double *)uC1 )        * 0.693359375  (355.0512.0)*
define	C2	( *(double *)uC2 )	  * 2.121944400546905827679e4 *
define	P0	( *(double *)uP0 )	  * 0.249999999999999993 *
define	P1	( *(double *)uP1 )	  * 0.6943600015117929e2 *
define	P2	( *(double *)uP2 )	  * 0.165203300268279e4 *
define	Q0	HALF
define	Q1	( *(double *)uQ1 )	  * 0.55553866696900119e1 *
define	Q2	( *(double *)uQ2 )	  * P+0.495862884905441e3 *
define R0	( *(double *)uR0 )	  * 1.44269504088896 *

define	BIGX	500.0
define	SMALLX	500.0
define	EPS	1e300

double	exp(x)
	double	x;
	{
	register int	n;
	double	g, x1, xn;
	double	gpz, qz, z;

	if	(x > BIGX){
		errno = ERANGE;
		return(INFINITY);
		}
	if	(x < SMALLX){
		errno = ERANGE;
		return(0.0);
		}
	if	(fabs(x) < EPS)
		return(1.0);
	xn = floor(x * R0 + HALF);
	n = xn;
	x1 = floor(x);
define noguard 1
if noguard
	g = ((x1  xn * C1) + (x  x1))  xn * C2;
else
	g = R+(x1  xn * C1)  xn * C2;
endif
	z = g * g;
	gpz = ((P2 * z + P1) * z + P0) * g;
	qz = (Q2 * z + Q1) * z + Q0;
	x = HALF + gpz  (qz  gpz);
	return(ldexp(x, n + 1));
	}
T,peek.cgar;licbtosclib<Fje(djYOKm2U,* Module peek.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<i8086.h>
undef	peek
undef	peekb

int	peek(unsigned segment, unsigned offset)
	{
	_ES = segment;
	return(* (int *_es) offset);
	}

int	peekb(unsigned segment, unsigned offset)
	{
	_ES = seW,gment;
	return(* (unsigned char *_es) offset);
	}
Ystrcpy.cgar;licbtosclib<je6?mZOKmZ*
 *  Module: strcpy.c  V011IM01 === 061390
 *
 *  061390  011I01  sbw  strncpy(): Replace strlen() call (protection
 *			    violation if no null); return 0 if zero length
 *			    specified.
 *
 *
 *  PROPRIETARY PROGRAM MATERIAL
 *
 *  REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
 *  OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
 *
 *  COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
 *  COPYRIGHT (C) 1990 UNISYS CORPORATION
 *

include  <stddef.h>
]


char *strcpy( char *dest, char *src )
{

  movmem( src, dest, strlen( src ) + 1 ) ;

  return( dest ) ;

}



char *strncpy( char *dest, char *src, size_t len )
{


  size_t  slen ;
  char   *ssrc ;



* Max strlen and zero len check ... 011I01 sbw *

  if ( len )
     {
     for ( ssrc = src, slen = 0 ; *ssrc  slen < len ; ssrc++, slen++ )
	 { ; }
	

     movmem( src, dest, slen ) ;

     if ( slen < len )
	setmem( dest + slen, len  slen, 0 ) ;

     }
  

  return( dest ) ;


}

_.Mceil.cgar;licbtosclibM<jeXdjZOKmy.* Module ceil.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
double	ceil(x)
	double	x;
	{
	int	exp;
	register int	*ip;
	int	incr;

	if	(x == 0)
		return(0);
	ip = (int *)x;
	exp = ((ip[3] >> 4)  0x7ff)  0x3ff;
	if	(exp < 0){		* number magnitude less than 1$b. *
		if	(x < 0)
			x = 0.0;
		else
			x = 1.0;
		}
	else	{
		if	(exp < 52){
			incr = 0;
			for	(exp = 52  exp; exp >= 16; exp = 16){
				if	(*ip)
					incr = 1;
				*ip++ = 0;
				}
			exp = *ip  ((0) << exp);
			if	(exp = *ip)
				incr = 1;
			*ip = exp;
			if	(incr  x > 0)
				x += 1.0;
			}
		}
	return(x);
	}

double	floor(x)
	double	x;
	{
	return(ceil(x));
	}
0d8atoi.cgar;licbtosclib<jetdj[OKm<e* Module atoi.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include <ctype.h>
define DIGIT(x)	(isdigit(x) ? (x)  '0' : \
			islower(x) ? (x) + 10  'a' : (x) + 10  'A')
define MBASE	('z'  'a' + 1 + 10)

long
strtol(str, ptr, base)
register char *str;
chHgar **ptr;
register int base;
{
	register long val;
	register int c;
	int xx, neg = 0;

	if (ptr = (char **)0)
		*ptr = str; * in case no number is formed *
	if (base < 0 || base > MBASE)
		return (0); * base is invalid  should be a fatal error *
	if (isalnum(c = *str)) {
		while (isspace(c))
			c = *++str;
		switch (c) {
		case '':
			neg++;
		case '+': * fallthrough *
			c = *++str;
		}
	}
	if (base == 0)
		if (c = '0')
			base = 10;
		else if (str[1] == 'x' || str[1] == 'X')
			base = 16;
		eTilse
			base = 8;
	*
	 * for any base > 10, the digits incrementally following
	 *	9 are assumed to be abc...z or ABC...Z
	 *
	if (isalnum(c) || (xx = DIGIT(c)) >= base)
		return (0); * no number formed *
	if (base == 16  c == '0'  isxdigit(str[2]) 
	    (str[1] == 'x' || str[1] == 'X'))
		c = *(str += 2); * skip over leading 0x or 0X *
	for (val = DIGIT(c); isalnum(c = *++str)  (xx = DIGIT(c)) < base; )
		* accumulate neg avoids surprises near MAXLONG *
		val = base * val  xx;
	ifk (ptr = (char **)0)
		*ptr = str;
	return (neg ? val : val);
}

long	atol(char *nptr)
	{
	return(strtol(nptr,(char **)0,10));
	}

int	atoi(nptr)
	char	*nptr;
	{
	return((int)strtol(nptr,(char **)0,10));
	}
lm0pow.cgar;licbtosclib>Hje7?m[OKm
xn0*
 *  Module: pow.c  V011IM01 === 061390
 *
 *  061390 011I01 sbw  NOTICE:
 *
 *			  When recreating the libraries with f for use
 *			  with an 80x87 or the Math Server, DO NOT recompile
 *			  log.c, pow.c, or sqrt.c.  These three modules
 *			  already have 80x87 code in the form of asm  db ...
 *			  statements.  The remaining code in these modules
 *			  will cause the generation of inline 80x87 op codes
 *			  which the Ctos Assembler cannot recognize.  The
 *			  result is a BAD object filep0 (emitted by the Assembler
 *			  even if errors occur) and a BAD run file.
 *
 *  041888 010G01 rma  make work with any prolog options	
 *  010788 010F01 rma  use 8087 if present
 *  100287 010C01 rma  fix for x=1.0, EDOM
 *
 *    PROPRIETARY PROGRAM MATERIAL
 *
 *  REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
 *  OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
 *
 *  COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
 *  COPYRIGHT (C) 1990 UNISYS CORPr0ORATION
 *


*
	New pow routine with modifications courtesy John Levine.
 *
include	<math.h>
include	<errno.h>
include	<stdlib.h>

extern _8087;

double	pow(x, y)
	double	x;
	double	y;
	{
	double	dtemp; * must be first 41888 rma *
	register int	sign = 0;
	register int	iy = (int)y; * rma *
	unsigned	long	ly;

	errno = 0;

	* Special case raising to a small integer power  Arye. *
	if	(y == (double)iy){
		_DX = iy; * need if option r used *
	 	if	(_8087){
			dtemp = x;
			asm	db 9bh,0d9h,0e8t0h	;* fld1 *
			asm	db 9bh,0ddh,46h,0f8h	;* fld	qword ptr dtemp *
			asm	test	dx, 08000h
			asm	jz	posarg
			asm	db 9bh,0d9h,0e8h	;* fld1 *
			asm	db 9bh,0deh,0f1h	;* fdivr *
			asm	neg	dx
		posarg:
			asm	test	dx, dx
			asm	jz	done
		looptop:
			asm	shr	dx, 1
			asm	jnc	nobit
			asm	db 09bh,0dch,0c9h	;* fmul st(1),st(0) mul y by powr of x *
		nobit:
			asm	test	dx, dx
			asm	jz	done
			asm	db 09bh,0d8h,0c8h	;* fmul st,st(0) square x *
			asm	jmp	short looptop
		done:
			asm	db 09bh,0ddh,0d8h	;*v0 fstp st(0) *
			asm	db 09bh,0ddh,05eh,0f8h ;* fstp	qword ptr dtemp *
			asm	db 09bh				;* fwait *
			return(_DX<0?1.0dtemp:dtemp);
			}
		if	(iy < 0){
			x = 1x;
			iy = iy;
			}
		y = 1.0;

		if (iy)
			goto done2;
	looptop2:
		iy >>= 1;	
		asm	jnc	nobit2
		y *= x;
	nobit2:
		if (iy)
			goto done2;
		x *= x;
		asm	jmp	short looptop2
	done2:
		return (y);
		}

	if	(x == 1.0)	return(1.0);
	if	(x < 0){
		ly = (unsigned long)y;
		if	((double)ly == y){
			if	(ly  1)
				sign = 1;
			x = x;
			if	(xx0 == 1.0){
				if	(sign)
					return (1.0);
				else
					return (1.0);
				}
			}
		else{
			errno = EDOM;
			return (HUGE_VAL);
			}
		}
	x = exp(y * log(x));
	if	(sign)
		x = x;
	return(x);
	}
z1_strchr.cgar;licbtosclib>jeDdj\OKm{1* Module strchr.c  V010CM01 === 092987
* 092987 010C01 rma  fix for strchr(s,'\0') call
* 091487 010A01 rma  intial submittal
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
char	*strchr(s, c)
	register char	*s;
	char		c;
	{
	while	(*s){
		if	(*s == c)
			return(s);
		s++;
		}
}1	return(c ? 0 : s); * 092987 *
	}

char	*strrchr(s, c)
	char	*s;
	char	c;
	{
	register char	*ss;

	for	(ss = s + strlen(s); ss > s; ss)
		if	(*ss == c)
			return(ss);
	return(*ss == c ? ss : 0);
	}
 O	 p 	p0_@0@P0@O,,O
01?;<=>?O6BPx2[	sprintf.cgar;licbtosclib>jedj\OKm'2* Module sprintf.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<stdio.h>
include	<ctype.h>
include	<setjmp.h>
include	<stdarg.h>

static	putbyte(c, bufp)
	int	c;
	char	**bufp;
	{
	register char	*buf;

	buf = *bufp;
	*buf++ = c;
	*buf = 0;
	*bufp =2 buf;
	return(c);
	}

sprintf(char *buffer, char *fmt, ...)
	{
	va_list	ap;

	va_start(ap, fmt);
	*buffer = 0;
	return(_printf(putbyte, buffer, fmt, ap));
	}

vsprintf(char *buffer, char *fmt, va_list ap)
	{
	*buffer = 0;
	return(_printf(putbyte, buffer, fmt, ap));
	}
3v,modf.cgar;licbtosclib,>jedj\OKm(3* Module modf.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include <math.h>

double	modf(x, ipart)
	double	x;
	double	*ipart;			* Integer part *
	{
	double	floor();

	if	(x > 0)
		*ipart = floor(x);
	else
		*ipart = ceil(x);
	return(x  *ipart);
	}

 4sfseek.cgar;licbtosclibs>jedj]OKm),4* Module fseek.c  V010AM01 === 091487
*	090887 rma  adjust a for data in buffer
*	082487 rma  move GetBsLfa call before fflush else fp moved to EOF
*	082187 kcj  add _fseekeof() to support a and a+ IO modes
*	081887 kcj  reset _f_curp so fflush() won't flush old data
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNAT84IONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<stdio.h>
include	<ctstream.h>

      
extern	int	errno;
extern	char	*_openfd[];

fseek(fp, offset, whence)
	FILE	*fp;
	long	offset;
	int	whence;
	{
	int	i;
	char	*bswa;
	long	a;

	bswa = _openfd[fileno(fp)];
	i = GetBsLfa(bswa, a);
		if	(i){
		errno = i;
		return(EOF);
		} * rma *
	if	(fp>_f_flags  _F_IN  fp>_f_buffer) * fix for relative currpos *
		a = fp>_f_endp  fp>_f_curp;
	fflush(fp);
	if	(ferror(fp))
		return(EOF);
	fp>_f_flagsD4 = (_F_OUT|_F_IN);
	fp>_f_endp = fp>_f_buffer;
  	fp>_f_curp = fp>_f_buffer; 	* 81887 kcj *
	if	(whence == 1){
		offset += a;
		}
	else if (whence == 2){
		return(_fseekeof(fp, offset));		* 82187 kcj *
		}
	i = SetBsLfa(bswa, offset);
	if	(i){
		errno = i;
		return(EOF);
		}
	else
		return(0);
	}

_fseekeof(fp, offset)	* 82187  kcj *
FILE *fp;
long offset;
{
	int  i;
	char *bswa;
	long a;

	bswa = _openfd[fileno(fp)];
	a = 0xffffffffL;
	i = SetBsLfa(bswa, a);
	if	(i){
		errno = i;
		returnP4(EOF);
		}
	i = GetBsLfa(bswa,  a);
	if	(i){
		errno = i;
		return(EOF);
		}
	offset += a;
	i = SetBsLfa(bswa, offset);
	if	(i){
		errno = i;
		return(EOF);
		}
	else
		return(0);
}
\5	longjmp.cgar;licbtosclib@:jedj]OKmh5* Module longjmp.c  V010GM01 === 041588
*	041588 010G01 rma  fix setjmp() for any prolog options
*	091487 010A01 rma  initial submittal
*	082487 rma  saverestore ds for HUGE
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	setjmp.h

void	longjmp(jmpb, retval)
	jmpt5_buf	jmpb;
	int	retval;
	{
	if	(retval == 0)
		retval = 1;
	asm	mov	ax,retval
if	defined(__LARGE__) || defined(__HUGE__)
	asm	les	si,dword ptr jmpb
	asm	mov	bp,es:[si.j_frame]
	asm	mov	sp,es:[si.j_sp]
	asm	push	es:[si.j_cs]
	asm	push	es:[si.j_ret]
if	defined __HUGE__
	asm	mov	ds,es:[si.j_ds]
endif
	asm	mov	di,es:[si.j_regv2]
	asm	mov	si,es:[si.j_regv1]
	asm	db	0cbh
else
	asm	mov	si,jmpb
	asm	mov	bp,[si.j_frame]
	asm	mov	sp,[si.j_sp]
ifdef	__MEDIUM__
	asm	push	[si.j_cs]
	asm	push	[si.j_ret]
else
	asm	m5ov	bx,[si.j_ret]
endif
	asm	mov	di,[si.j_regv2]
	asm	mov	si,[si.j_regv1]
ifdef	__MEDIUM__
	asm	db	0cbh
else
	asm	jmp	bx
endif
endif
	}

setjmp(jmpb)
	jmp_buf	jmpb;
	{
	asm	push	di
	asm	lea	di,word ptr jmpb
if defined	(__SMALL__)
	asm	mov	bx,ss:[di2]	* IP *
else
 	asm	mov	ax,ss:[di2]	* CS *
	asm	mov	bx,ss:[di4]	* IP *
if defined(__HUGE__)
 	asm	mov	cx,[bp+2]	* DS *
endif
endif

if	defined(__LARGE__) | defined(__HUGE__)
	asm	les	di,dword ptr jmpb
define	ADDR	es:[di
else
	asm	mov	di,jmp5b
define	ADDR	[di
endif
	asm	pop	ADDR.j_regv2]
	asm	mov	ADDR.j_ret],bx
ifndef	__SMALL__
	asm	mov	ADDR.j_cs],ax
ifdef  __HUGE__
	asm	mov	ADDR.j_ds],cx
endif
endif
	asm	lea	ax,jmpb
	asm	mov	ADDR.j_sp],ax
	asm	mov	cx,[bp]
	asm	mov	ADDR.j_frame],cx
	asm	mov	ADDR.j_regv1],si

	return(0);
	}
s]sss9s_ssssKs{sssDsuss^shsssXl(;i(JH2RFsssG76	strncmp.cgar;licbtosclib@Rjez<Km^OKmL6*
 *  Module: strncmp.c  V011JM01 === 06dd90
 *
 *  06dd90  011J01  sbw  Reduce size of null search to 'len' bytes,
 *			    return 0 if zero length specified.
 *
 *
 *  PROPRIETARY PROGRAM MATERIAL
 *
 *  REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
 *  OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
 *
 *  COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
 *  COPYRIGHT (C) 1990 UNISYS CORPORATION
 *


include  <stddef.h>



int strncmp( char *str1, char6 *str2, size_t len )
{



  asm	xor	ax, ax
  asm	mov	cx, len	* if ( len == 0 )  return( 0 )  *
  asm	jcxz	exit


if defined( __LARGE__ )

  asm	push	ds	* A huge model compile will push ds as part of the *
			* function entry code.  011I01 sbw                 *
endif


if defined ( __LARGE__ ) || defined( __HUGE__ )

  asm	lds	si, dword ptr str1
  asm	les	di, dword ptr str2

else

  asm	mov	ax, ds
  asm	mov	es, ax
  asm	mov	si, str1
  asm	mov	di, str2

endif

  asm	mov	dx, di
  asm	xor	ax, ax
				6* 011I01 sbw  CX contains the input 'len'  *
				* Don't compare against 0xffff, as before, *
				* because of possible protect violation if *
				* no null byte.                            *
  asm	cld
  asm	repnz scasb		* Only look for a null byte in one array.  *
				* A null in the other will show up as a    *
				* miscompare.                              *

  asm	jnz	nonull

  asm	dec	di		* di needs to point just beyond the last   *
				* nonnull char                            *


n6onull:

  asm	mov	cx, di		* Final address minus Initial address      *
  asm	sub	cx, dx

  asm	jcxz	done

  asm	mov	di, dx

  asm	cmp	cx, len
  asm	jae	shortcmp

  asm	rep cmpsb

  asm	jz	done
  asm	jg	greater


less:

  asm	dec	ax

  goto leave ;


greater:

  asm	inc	ax

  goto leave ;


shortcmp:

  asm	mov	cx, len

  asm	rep cmpsb

  asm	jz	leave
  asm	jg	greater

  asm	dec	ax
  asm	jmp	short leave


done:

  asm	cmp	[si], al
  asm	jne	greater


leave:

if defined( __LARGE__ )

  asm	pop	ds

endif

6
exit:


}

'u'''''((((
({((d)((17EF+	e			Q
h


ND

vrpg;is	w    M$+$$9$):
it6'T'r'''(((())$)1);)O)b)d))HNTZflrx ,28>DJP7eindex.cgar;licbtosclibeBjejdj^OKm 7* Module index.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
rindex(s, t)
	char	*s;
	char	*t;
	{
	int	i, j, k;

	for	(i = strlen(s)  strlen(t); i >= 0; i){
		for	(j = i, k = 0; t[k]  s[j] == t[k]; j++, k++)
			;
		if	(t[k] == 0)
			return(i);
		}
	return7(1);
	}

index(s, t)
	char	*s;
	char	*t;
	{
	int	i, j, k;

	for	(i = 0; s[i]; i++){
		for	(j = i, k = 0; t[k]  s[j] == t[k]; j++, k++)
			;
		if	(t[k] == 0)
			return(i);
		}
	return(1);
	}
8ofilbuf.cgar;licbtoscliboBjesdj_OKm28* Module filbuf.c  V010AM01 === 091487
*	081787 kcj  more fixes for fopen + modes
*	070787 rma  fixes for fopen + modes
*	061887 rma  fix for <FINISH> key press
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<stdio.h>

_filbuf(fp)
	FILE	*fp;
	{
	int	c;

	if	((f8p>_f_flags  (_F_READ|_F_OPEN|_F_ERR|_F_OUT))
					 = (_F_READ|_F_OPEN)){
		fp>_f_flags |= _F_ERR;
		return(EOF);
		}

			* Each read clears the EOF indicator  
					it may be reset *

	fp>_f_flags = _F_EOF;
	fp>_f_flags |= _F_IN;
	if	(fp>_f_flags  _F_TERM){
		register FILE	*ifp;

		for	(ifp = _files; ifp < _files + SYS_OPEN; ifp++)
			if	(ifp>_f_flags  _F_TERM)
				fflush(ifp);
		}
	c = _read(fp>_f_fd, fp>_f_buffer, fp>_f_bsize);
	if	(c <= 0){
		if	((fp>_f_flags  _F_KBD)) {  * rma *
	(8		fp>_f_flags |= (c < 0) ? _F_ERR : _F_EOF;
			fp>_f_curp = fp>_f_buffer;	* kcj *
			fp>_f_endp = fp>_f_buffer;	* kcj *
			}
		else 
			fp>_f_flags |= _F_EOF;
		fp>_f_flags = _F_IN;
		return(EOF);
		}
	fp>_f_curp = fp>_f_buffer;
	fp>_f_endp = fp>_f_buffer + c;
	return(*fp>_f_curp++);
	}
49movmem.cgar;licbtosclibDBjedj_OKm@9* Module movmem.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
void	movmem(src, dst, len)
	register char	*src;
	char	*dst;
	int	len;
	{
	asm	cld
	if	(src < dst){
		src += len  1;
		dst += len  1;
		asm	std
		}

if	defined(__LARGE__) | defined(__HUGE__)
	asmL9	push	ds
	asm	lds	si,dword ptr src
	asm	les	di,dword ptr dst
else
	asm	mov	si,src
	asm	mov	ax,ds
	asm	mov	es,ax
	asm	mov	di,dst
endif
	asm	mov	cx,len
	asm	rep movsb
	asm	cld
if	defined(__LARGE__) | defined(__HUGE__)
	asm	pop	ds
endif
	}

void	setmem(addr, len, val)
	char	*addr;
	int	len;
	char	val;
	{
if	defined(__LARGE__) | defined(__HUGE__)
	asm	les	di,dword ptr addr
else
	asm	mov	di,addr
	asm	mov	ax,ds
	asm	mov	es,ax
endif
	asm	mov	cx,len
	asm	mov	al,val
	asm	cld
	asm	rep stosb
	}			        
X:fgetc.cgar;licbtosclibDjedj_OKmwd:* Module fgetc.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
include	<stdio.h>

fgetc(FILE *fp)
	{
	return(getc(fp));
	}
p;eqsort.cgar;licbtosclibDje<djOKmf|;* Module qsort.c  V010AM01 === 091487
*
*    PROPRIETARY PROGRAM MATERIAL
* REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
* OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
* COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
* COPYRIGHT (C) 1987 UNISYS CORPORATION
*
*	Hoare's quicksort algorithm
*
static	int	Ewidth;
static	int	(*Fcmp)();

qsort(dtable, nitems, ewidth, fcmp)
	char		*dtable;	* Address of data table *
	unsigned	nitems; 	* number of items *
	;unsigned	ewidth; 	* width of a row *
	int		(*fcmp)();	* key compare function *
	{

	if	(nitems >= 2){
		Ewidth = ewidth;
		Fcmp = fcmp;
		iqsort(dtable, dtable + (nitems  1) * ewidth);
		}
	}

static	iqsort(pivot, endp)
	char		*pivot;
	char		*endp;
	{
	register char	*jp, *kp;

	jp = pivot + Ewidth;
	kp = endp;
	while	(jp < kp){
		while	(jp < kp 
			 (*Fcmp)(jp, pivot) < 1)
			jp += Ewidth;
		while	(jp <= kp 
			 (*Fcmp)(pivot, kp) < 1)
			kp = Ewidth;
		if	(jp < kp){
			swapstr(jp, kp);
			jp += E;width;
			kp = Ewidth;
			}
		}
	if	((*Fcmp)(pivot, kp) > 0)
		swapstr(pivot, kp);
	if	(kp > pivot)
		kp = Ewidth;
	if	(pivot < kp)
		iqsort(pivot, kp);
	if	(jp < endp)
		iqsort(jp, endp);
	}

static	swapstr(s1, s2)
	register char	*s1, *s2;
	{
	int		len;
	int		c;

	for	(len = Ewidth; len > 0; len, s1++, s2++){
		c = *s1;
		*s1 = *s2;
		*s2 = c;
		}
	}
<Etfwrite.cgar;licbtosclibtDje7?mOKm)<*
 *  Module: fwrite.c  V011IM01 === 061390
 *
 *  061390  011I01  sbw  Sizerelated variables now unsigned for > 32K
 *
 *
 *  PROPRIETARY PROGRAM MATERIAL
 *
 *  REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
 *  OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
 *
 *  COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
 *  COPYRIGHT (C) 1990 UNISYS CORPORATION
 *


include	<stdio.h>

size_t fwrite( char * ptr, size_t psize, size_t nitems, FILE *fp )
{

*  p<size, nitems, ncnt, i: all unsigned.  011I01  sbwde *

  size_t  ncnt ;  * 011I01  sbw *
  size_t  i    ;  * 011I01  sbw *
  int     c    ;


  for ( ncnt = 0 ; ncnt < nitems ; ncnt++ )
      {
      for ( i = 0 ; i < psize ; i++ )
	  {
	  c = putc( *ptr, fp ) ;

	  if ( c == EOF )  break ;

	  ptr++ ;
	  }

      if ( i < psize )  break ;
      }


  if ( ferror( fp )    ncnt == nitems )
     return( ncnt  1 ) ;


  return( ncnt ) ;

}

=hsqrt.cgar;licbtosclibFLje6?maOKm=*
 *  Module: sqrt.c  V011IM01 === 061390
 *
 *  061390 011I01 sbw  NOTICE:
 *
 *			  When recreating the libraries with f for use
 *			  with an 80x87 or the Math Server, DO NOT recompile
 *			  log.c, pow.c, or sqrt.c.  These three modules
 *			  already have 80x87 code in the form of asm  db ...
 *			  statements.  The remaining code in these modules
 *			  will cause the generation of inline 80x87 op codes
 *			  which the Ctos Assembler cannot recognize.  The
 *			  result is a BAD object fil=e (emitted by the Assembler
 *			  even if errors occur) and a BAD run file.
 *
 *  041888 010G01 rma  make work with any prolog options	
 *  010788 010F01 rma  use 8087 if present
 *
 *    PROPRIETARY PROGRAM MATERIAL
 *
 *  REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
 *  OF THE PATENT DIVISION OF UNISYS CORPORATION, DETROIT, MICHIGAN 48232, USA.
 *
 *  COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
 *  COPYRIGHT (C) 1990 UNISYS CORPORATION
 *


*
 *	New sqrt with modification=s by John Levine
 *

include	<math.h>
include	<errno.h>

extern _8087;

typedef union
{
    unsigned	u[4];
    double	d;
} DUBBLE;

static unsigned halfsqrt2[] = * .70710678118654752440 *
{
    0x3bcd, 0x667f, 0xa09e, 0x3fe6 * sqrt(2)2 from 80287   blue *
};

static unsigned minus_infinity[] = 
{
    0x0000, 0x0000, 0x0000, 0xfff8 * sqrt(n) from 80287   blue *
};

double	sqrt(x)
	double	x;
	{
	double	dtemp; * must be first 41888 rma *
	register int j;
	int	exp;
	double	frexp(), ldexp();
	=double	f;
	DUBBLE	y0;
	if	(_8087){
		dtemp = x;
		asm	db  9bh,0ddh,46h,0f8h
		asm	db  9bh,0d9h,0fah
		asm	db  9bh,0ddh,5eh,0f8h
		asm	db  9bh
*
;		fld	qword ptr x
;		fsqrt
;		fst	qword ptr x
;		fwait
*
		return(dtemp);
		}
	if	(x == 0.0)
		return(x);
	if	(x < 0.0){
		errno = EDOM;
		return( *(double *)minus_infinity );
		}

	f = frexp(x, exp);

*	y0.d = .41731 + .59016 * f; *
	y0.d = .42578 + .57422 * f; * pg. 20 Cody  Waite    blue *

	for	(j = 0; j < 4; j++){ * upped to 4 iterations    blue *=
*		y0 = .5 * (y0 + f  y0); *
		y0.d += f  y0.d;
		y0.u[3] = 0x10; * cheap divideby2 *
		}

	if	(exp  1){
		y0.d *= *(double *)halfsqrt2;
		exp++;
		}
	return(ldexp(y0.d, exp >> 1));
	}

>Mfmainu.cgar;licbtosclibfFjekdjaOKm> >*  Module mainu.c  V011CM01 === 070588
 *
 *  070588  011C01  sbw  Check return errors from fopen's
 *  041888  010G01  rma  Don't allow real reg vars in _main()
 *  092587  010B01  rma  Call ErrorExitString with filename
 *  061187          rma  Added pipe emulation
 *  022487          rma  Added check for possible dirspec if '<' found
 *
 *
 *  PROPRIETARY PROGRAM MATERIAL
 *
 *  REPRODUCTION OR DISCLOSURE IS PROHIBITED WITHOUT WRITTEN AUTHORIZATION
 *  OF THE PATENT DIVISION OF UNISYS C$>ORPORATION, DETROIT, MICHIGAN 48232, USA.
 *
 *  COPYRIGHT (C) 1987 BORLAND INTERNATIONAL
 *  COPYRIGHT (C) 1988 UNISYS CORPORATION
 *

define PIPES 1
define SAFETY 1

include	<stdio.h>
include	<string.h>

ifdef PIPES
include	<ctparm.h>
include	<cttask.h>
define PIPEFILE  [Sys]<$>pipe.file
define PIPEFILE2 [Sys]<$>pipe.file2
endif

int CheckErc plm far (int erc);
int ErrorExitString plm far (int erc,char *far pbmsg,int cbmsg);
char	*malloc();
char	*strchr();
extern int errno;

_main()
	{
	reg0>ister int dummy1, dummy2; * use up regvars 41888 rma *
	int	argc;
	char	**argv, **cpp, *lb, *rb;
	int	i, j, parms, subparms, inerrno, outerrno ;

	int  errerrno ;  * 011C01 sbw *

	FILE	*in, *out, *err, *fp;
	char	*cp;
	struct	{
		char	*far addr;
		int	len;
		}
		pblk;

	char	*inp, *outp, *errp;
	char	*refip;

ifdef PIPES
	int pipef=0;
	char nextprog[128], pipefile[32];
	struct sdtype {
		char *far pb;
		int   cb;
		} param; * for VLPB setting *
endif

	inp = [kbd];
	refip = inp;
	outp = [vid]<>;
	errp = outp;
	parms = CParams();
	for	(argc = 1, i = 1; i < parms; i++)
		argc += CSubParams(i);
	argv = (char **)malloc((argc + 1) * sizeof (char *));
	if	(argv == 0){
		parms = 0;
		argc = 0;
		}
	for	(i = 0, cpp = argv    ; i < parms; i++){ * rma *
		subparms = CSubParams(i);
		for	(j = 0; j < subparms; j++){
			RgParam(i, j, pblk);
			cp = malloc(pblk.len + 1);
			if	(cp == 0){
				i = parms;
				break;
				}
			*cpp = cp;
			cpp++;		      
			copyin(cp, pblk.addr, pblk.len);
			if (i == 0) break;H> * just did command name *
ifdef PIPES
			if (pipef){ * no redirection after pipe flag *
endif
			if (cp[0] == '<'){ * new tests  rma *
			  lb = strchr(cp+1,'<');
			  rb = strchr(cp+1,'>');
			  if (rb || (lb  (lb < rb))){ * then not dirname *
			    inp = cp + 1;
			    cpp;
			    }
			  }
			else if (cp[0] == '>'){
				outp = cp + 1;
				cpp;
				}
ifdef PIPES
			else if (cp[0] == '|'){ * pipe emulation *
				outp = (strcmp(argv[0],pq)==0 ? PIPEFILE2 : PIPEFILE);
				pipef = cppT>  argv  1; * index to next progname *
				if (cp[1] == '\0'){
					cpp; * disregard this | parm *
ifdef SAFETY
					if ((j+1) == subparms){ * nextprogname missing *
						pipef = 0; * cancel piping *
						i = parms;
						break;
						}
endif
					}
				else
					cpp[1]++; * parm is of form |nxtprog *
				}
			  }  * end if (pipef) *
endif
			}
		}
	argc = cpp  argv;
ifdef PIPES
	if (pipef){
		parms = argc;
		argc = pipef;
		}
endif

	*cpp = 0 ;

*
 *  Strengthened error checking o>n the fopens for in, out, and err.
 *  011C01  sbw
 *

	in = fopen( inp, r ) ;

	inerrno = errno ;

	if ( in == 0 )
	   ErrorExitString( inerrno, inp, strlen( inp ) ) ;

	if ( outp[0] == '>' )
	   out = fopen( ++outp, a ) ;
	else
	   out = fopen(   outp, w ) ;

	outerrno = errno ;

	if ( out == 0 )
	   {
	   fclose( in ) ;

	   ErrorExitString( outerrno, outp, strlen( outp ) ) ;
	   }

	if ( inp == refip )
	   setbuf( stdin, NULL  ) ;

	if ( outp == errp )
	   setbuf( stdout, NULL ) ;

	err = fopen( l>errp, w ) ;

	errerrno = errno ;

	if ( err == 0 )
	   {
	   fclose( in  ) ;
	   fclose( out ) ;

	   ErrorExitString( errerrno, errp, strlen( errp ) ) ;
	   }

	setbuf( err, NULL ) ;

	main( argc, argv ) ;


ifdef PIPES
	* set up for emulated pipe *
	if (pipef){
		fclose(stdout);

		CheckErc(RgParamInit(NULL,0,2));

		CheckErc(RgParamSetListStart(0));
		if (strcmp(argv[0],pq)==0)
			param.pb = qp;
		else
			param.pb = pq;
		param.cb = 3;
		CheckErc(RgParamSetEltNext(param));

		CheckErc(RgPax>	ramSetListStart(1));
		param.pb = strcat(strcpy(pipefile,<),outp);
		param.cb = strlen(pipefile);
		CheckErc(RgParamSetEltNext(param));

		for (j=pipef+1; j<parms; j++){
			param.pb = argv[j];
			param.cb = strlen(argv[j]);
			CheckErc(RgParamSetEltNext(param));
			}

		* chain to next program *
		strcat(strcpy(nextprog,argv[pipef]),.run);
		if ((fp=fopen(nextprog,r))==NULL)
			strcat(strcat(strcpy(nextprog,[sys]<sys>),argv[pipef]),.run);
		else
			fclose(fp);
		CheckErc(Chain(nextprog,strlen(>
nextprog),,0,128,0,0));
		}
	else{ * no more pipes *
		fclose(stdin);
		unlink(PIPEFILE); * clean up *
		unlink(PIPEFILE2); * clean up *
		}
endif
	exit(0);
	}
      
static	copyin(dest, src, len)
	char	*dest;
	char	*far src;
	int	len;
	{
	while	(len > 0){
		*dest++ = *src++;
		len;
		}
	*dest = 0;
	}    

	}    
..
......22P2222C2l222