MKTEMP C FWRITE C PRINTF C ISATTY C  STRCPY C MALLOCNDC STRNCAT C STRNCMP C DOPRT C FfghijklmnMAKE SUBopqrstuvwxyz{|}~MAKE SUBRSGTTY C #include "portab.h" MLOCAL BYTE _mktchar = { 'A' }; BYTE * mktemp(template) /* CLEAR FUNCTION ***********/ REG BYTETTYINRAWC !:;<=>PRTINT C ?PUTS C @APUTW C BCring ending in 6 X's. * It will replace the last 6 chars with the process id * and a letter (different on each invocation). *GETL C FREAD C GETPID C PUTL C STRNCPY C SWAB C XSTRCMP C CHANNELSC 1SCANF C ABORT S YESFLOATC PARSEFN C A *template; { REG BYTE *ss; for( ss=template; *ss != 'x' && *ss != 'X'; ss++) if(*ss == NULL) return(template); /QSORT C DEFRAND C GREADASC C 2HIJKLMNRENAME C OPQ REALLY "mktemp" replaces everything after the 1st x... * this is a feature... * Note that the process id does not change undGETS C GETW C FGETS C LSEEK C WRITEASCC -ERRNO C ALDIV S ALMUL S STRCHR C STRRCHR C ACCESS C BLKMOVE C * resign */ if( _mktchar < 'A' || _mktchar >'Z' ) _mktchar = 'A'; sprintf(ss,"X%04.4d%c",getpid(),_mktchar); _mkSETBUF C RSPRINTF C STSSCANF C UVTTYIN C (WXYZ[er CP/M, * therefore the name itself will not be very unique... * * Calling sequence: * string = mktemp(string) * Where: TTYOUT C UNGETC C MALLOC C ` !"#$%&'()*READ C +,-/*********************************************************************** * * m k t e m p F u n c t i o n * ------------INDEX C RINDEX C STRCAT C STRCMP C tchar++; return(template); } UNLINK C \]WRTCHR C ^_`aATOL C bWRITE C cde* * string -> null terminated string with 6 x's * *************************************************************************/XOPEN C ./01OPEN C 2345OPTOFF C 6GETPASS C 789----------------- * Copyright 1982 by Digital Research Inc. All rights reserved. * * "mktemp" assumes it is called with a stchar++; return(template); } sp) == FAILURE ) /* used for side effects */ return(NULL); return(num); } > where to write from * size = number bytes in each item * nitems = number bytes written/to write * stream -> file * * n/************************************************************************ * * p r i n t f F u n c t i o n * -----------char++; return(template); } p) == FAILURE ) /* used for side effects */ return(NULL); return(num); } items is set to 0 if an error occurs (including EOF). * **********************************************************************------------------ * Copyright 1982 by Digital Research Inc. All rights reserved. * * "printf" prints args specified in form/************************************************************************** * * f w r i t e F u n c t i o n * ---------p) == FAILURE ) /* used for side effects */ return(NULL); return(num); } *******/ #include "stdio.h" WORD fwrite(buff,siz,num,sp) /* CLEAR FUNCTION ***********/ REG BYTE *buff; WORD siz, at string to stdout. * * Calling sequence: * nchrs = printf(fmt,arg1,arg2,...argn); * Where: * nchrs = # chars output by -------------------- * Copyright 1982 by Digital Research Inc. All rights reserved. * * "fwrite" writes NI items of size SZ num; REG FILE *sp; { REG WORD jj, kk; for( jj=0; jj a string specifying how arg1-n are to be printed. * ********************************************************from memory at BUFF into stream * SP. * * Calling sequence: * nitems = fwrite(buff,size,nitems,stream) * Where: * buff -******************/ #include "stdio.h" WORD printf(fmt,args) /* CLEAR FUNCTION ***********/ BYTE *fmt, *args; ----- * Copyright 1982,83 by Digital Reserach Inc. All rights reserved. * * "isatty(fd)" == TRUE iff the file on channel fd / return(FALSE); /* isno TTY ifnot open */ return(fp->flags&(ISTTY|ISLPT|ISAUX)); /* test these flags */ } **************************************************************************/ WORD fprintf(sp,fmt,args) /* CLEAR FUNCTION ****hkc(fd)) == NULLFD) /* make sure its open MGL */ return(FALSE); /* isno TTY ifnot open */ return( (fp->flags & IS{ return(_doprt(stdout,fmt,&args)); } /************************************************************************ * * is a 'CON:' device. * "isdev(fd)" == TRUE iff fd is 'CON:', 'LST:', 'AUX:' * * Where: * fd = file descriptor returned by ' /****************************/ /* ttyname - find name of a terminal */ /* returns "CON:" if isatty, NULLPTR o.w., under C*******/ FILE *sp; BYTE *fmt, *args; { return(_doprt(sp,fmt,&args)); } TTY) != 0 ); /* test this flag */ } /****************************/ BOOLEAN isdev(fd) /* CLEAR FUNCTION *********f p r i n t f F u n c t i o n * ------------------------------- * Copyright 1982 by Digital Research Inc. All rights reseopen' * **************************************************************************/ #include "portab.h" #include "osif.h" P/M */ EXTERN BYTE __tname[]; /* CON: String */ BYTE * ttyname(fd) /* CLEAR FUNCTION ***********/ WORD fd; { if( ******/ FILE *sp; BYTE *fmt, *args; { return(_doprt(sp,fmt,&args)); } **/ WORD fd; /* file des returned by open*/ { /****************************/ REG FD *fp; /* ptr to ccb */ rved. * * "fprintf" prints args specified in format string to a stream file. * * Calling sequence: * nchrs = fprintf(fmt,a BOOLEAN isatty(fd) /* CLEAR FUNCTION ***********/ WORD fd; /* file des returned by open*/ { /********************/************************************************************************* * * Channel Info Functions * -----------------isatty(fd) ) return(__tname); return(NULLPTR); } ******/ FILE *sp; BYTE *fmt, *args; { return(_doprt(sp,fmt,&args)); }  FD *_chkc(); /* validates fd, cvt to fp */ /* */ if((fp=_chkc(fd)) == NULLFD) /* make sure its open MGL *rg1,arg2,...argn); * Where: * nchrs = number of chars output * fmt -> a string specifying how arg1-n are to be printed. * ********/ REG FD *fp; /* ptr to ccb */ FD *_chkc(); /* validates fd, cvt to fp */ /* */ if((fp=_csatty(fd) ) return(__tname); return(NULLPTR); }  */ } /****************************/ ************/ p = (char *)&l; /* point to l */ *p++ = getc(sp); /* no way to distinguish */ *p++ = getc(sp); ber items successfully read * * Edits: * 8-Feb-84 whf return nitems actually read for EOF. * ******************************at's written by a * 68K (NUXI: hi byte, lo byte) system. * * Calling sequence: * l = getl(stream) * Where: * l = a 3/************************************************************************** * * f r e a d F u n c t i o n * -----------satty(fd) ) return(__tname); return(NULLPTR); }  /* twixt EOF & -1 */ *p++ = getc(sp); /* */ *p++ = getc(sp); /* */ return(l); /* there it is ***********************************************/ #include "stdio.h" WORD fread(buff,siz,num,sp) /* CLEAR FUNCTION ******2-bit long value * stream-> a (FILE *) input stream * **********************************************************************---------------- * Copyright 1982 by Digital Research Inc. All rights reserved. * * "fread" reads NI items of size SZ from s/************************************************************************** * * g e t l F u n c t i o n * ------------- */ } /****************************/ *****/ REG BYTE *buff; WORD siz, num; REG FILE *sp; { REG WORD jj, kk, ch; for( jj=0; jj w------------ * Copyright 1982 by Digital Research Inc. All rights reserved. * * "getl" gets an LONG (4 byte) value from the  */ } /****************************/ r( kk=0; kk file * * rval = numinput stream. * Note that what's written (binary) by a PDP 11 (UNIX: lo byte, hi byte) * system will NOT be compatible with wh *buff++ = ch; } return(num); } d() /* CLEAR FUNCTION ***********/ { return(PHONYPID); } G lnum; /* the LONG to be put */ FILE *sp; /* the stream to put to */ { /* */ REG WORD i; /* inutput stream. * Note that what's written (binary) by a UNIX (lo byte, hi byte) * system (PDP 11) will NOT be compatible with w*buff++ = ch; } return(num); } () /* CLEAR FUNCTION ***********/ { return(PHONYPID); } dex */ REG BYTE *p; /* make ptr to w */ /****************************/ p = (char *)&lnum; /* point to l hat's written by a * NUXI (hi byte, lo byte) system (68K). * * Calling sequence: * ret = putl(l, stream) * Where: * ret *buff++ = ch; } return(num); } () /* CLEAR FUNCTION ***********/ { return(PHONYPID); }  */ for( i=0; i<4; i++ ) /* for all the 4 bytes in l */ if( putc(*p++,sp)== FAILURE ) /* put dem */ return = l or FAILURE on error * l = an LONG value * stream-> a (FILE *) output stream * **********************************/************************************************************************** * * p u t l F u n c t i o n * -------------(FAILURE); /* */ return(lnum); /* it worked */ } /****************************/  /* getpid - return process ID */ /* returns phony number under CP/M */ #include "portab.h" #define PHONYPID 222 WORD getpi*******************************************/ #include "stdio.h" LONG putl(lnum,sp) /* CLEAR FUNCTION ***********/ LON------------ * Copyright 1982 by Digital Research Inc. All rights reserved. * * "putl" puts a LONG (4 byte) value into the oFAILURE); /* */ return(lnum); /* it worked */ } /****************************/ is */ while( (c=getc(stdin)) != FAILURE && /* while everything ok */ c != '\n' ) /* and not end of line */ sequence: * addr = gets(saddr) * Where: * saddr -> where the string is to go (no bounds check) * addr = saddr if all ok/************************************************************************** * * g e t w F u n c t i o n * -------------************/ FAILURE); /* */ return(lnum); /* it worked */ } /****************************/  *str++ = c; /* store it */ *str = NULL; /* clean up string */ if( c == FAILURE ) /* if not cool , NULLPTR o.w. * *****************************************************************************/ #include "stdio.h" BYTE ------------ * Copyright 1982 by Digital Research Inc. All rights reserved. * * "getw" gets an WORD (2 byte) value from the /*********************************************************************** * * g e t s F u n c t i o n * ---------------- */ return(NULLPTR); /* then tell them so */ return(sav); /* tell them is cool */ } /**************** gets(str) /* CLEAR FUNCTION ***********/ REG BYTE *str; /* string save area */ { /***************************input stream. * Note that what's written (binary) by a PDP 11 (UNIX: lo byte, hi byte) * system will NOT be compatible with wh--------- * Copyright 1982 by Digital Research Inc. All rights reserved. * * "gets" reads a string from the standard input, *************/ */ REG WORD c; /* char to test for eof */ BYTE *sav; /* sav pointer for return */ sav = str; /* remember that's written by a * 68K (NUXI: hi byte, lo byte) system. * * Calling sequence: * w = getw(stream) * Where: * w = a 1and returns * its argument (NULL on end of file). The newline at the * end of the string is replaced by a NULL. * * Calling************/ 6-bit word value * stream-> a (FILE *) input stream * **********************************************************************------------- * Copyright 1982 by Digital Research Inc. All rights reserved. * * "fgets" reads a string from a stream file ()) != FAILURE ) /* and read_char ok */ { /* */ *str++ = c; /* store it */ if( c == '\n'  /* twixt EOF & -1 */ return(w); /* there it is */ } /****************************/ */ #include "stdio.h" BYTE * fgets(str,maxc,sp) /* CLEAR FUNCTION ***********/ REG BYTE *str; /* string save area *******/ #include "stdio.h" WORD getw(sp) /* CLEAR FUNCTION ***********/ REG FILE *sp; /* the stream to get from up to n-1 chars), and * returns pointer s (NULLPTR on end of file). The newline at the * end of line is included, NOT replac) /* if end of line */ break; /* stop the presses */ } /* */ *str = NULL; /* clean up str /* twixt EOF & -1 */ return(w); /* there it is */ } /****************************/  */ REG WORD maxc; /* max size of string */ REG FILE *sp; /* where to get from */ { /*********************/ { /* */ WORD w; /* place to get to */ REG BYTE *p; /* make ptr to w */ /****************ed, and the string is terminated * by a NULL. * * Calling sequence: * addr = fgets(saddr,n,stream) * Where: * saddr -> wing */ if(c == FAILURE) /* if not cool */ return(NULLPTR); /* then tell them so */ return(sav); ********/ REG WORD c; /* char to test for eof */ REG BYTE *sav; /* sav pointer for return */ sav = str; /* ************/ p = (char *)&w; /* point to w */ *p++ = getc(sp); /* no way to distinguish */ *p++ = getc(sp); here the string is to go (no bounds check) * n = max # chars (inc. NULL) for saddr (assumed > 0) * stream-> where to get/*********************************************************************** * * f g e t s F u n c t i o n * --------------/* tell them is cool */ } /****************************/ remember this */ while( --maxc > 0 && /* while there's still room */ /* for getc and NULL */ (c=getc(sp /* twixt EOF & -1 */ return(w); /* there it is */ } /****************************/  from * addr = saddr if all ok, NULLPTR o.w. * ***************************************************************************** tell them is cool */ } /****************************/  /* */ /****************************/ { /****************************/ REG FD *fp; /* File pointof the file * * ret Is the resulting absolute file offset * -1 indicates failure * OF */ if( fp->offset < 0 ) /* bad seek call? */ fp->offset = -1; /* set to uniform value */ return(fp->offThe tell function returns the present position in a file. * * Calling sequence: * sent position */ fp->offset += offs; /* */ break; /* */ /****************************/ case 2:* tell them is cool */ } /****************************/ er */ EXTERN FD *_chkc(); /* fd to fp translation MGL */ EXTERN LONG _filesz(); /* computes CP/M file size */ ****************************************************************************/ #include "portab.h" #include "oset); /* Return resultant offset */ } /****************************/ /****************************/ LONG tell * ret = lseek(fd,offset,sense); * or ret = tell(fd); * * Where: * /* From end of file */ fp->hiwater = _filesz(fd); /* go find the end of file */ fp->offset = fp->hiwater + offs;//*************************************************************************** * * L s e e k F u n c t i /* */ if((fp = _chkc(fd)) == NULLFD) /* Convert to pointer */ RETERR(FAILURE,EBADF); /* Can't */ switsif.h" #include "osiferr.h" #include "errno.h" LONG lseek(fd,offs,sense) /* CLEAR FUNCTION ***********/ /* *(fd) /* CLEAR FUNCTION ***********/ WORD fd; /* this file here */ { /* */ return(lseek(fd,0L,1)); /* * fd Is an open file descriptor * offset Is the (long) file offset * sense Is the meaning of offset* compute from end of file */ break; /* */ /****************************/ default: /* All others NFG o n * --------------------------- * Copyright 1982 by Digital Research Inc. All rights reserved. ch(sense) /****************************/ { /* */ case 0: /* From beginning of file */ fp->offset = offs/ WORD fd; /* Open file descriptor */ LONG offs; /* File offset */ WORD sense; /* Sense of offset */ is that all? */ } /****************************/  * 0 => From the beginning of the file * 1 => From the present file position * 2 => From the end */ RETERR(FAILURE,EINVAL); /* */ } /****************************/ fp->flags &= ~ATEOF; /* any seek clears E * * The lseek function changes the present position of reading * to or writing from a file. * ; /* Just set to offset */ break; /* Then quit */ /****************************/ case 1: /* From preis that all? */ } /****************************/ .h" WORD _ttyout(buf) /***************************/ /* */ REG BYTE *buf; /* -> 1st char output */ { o n * ------------------------------- * * Function "_ttyout" is called to perform "write" ope */ /* */ return(count); /* return original count */ } /***************************/  Print the string */ __OSIF(CONOUT,'$'); /* And output the '$' */ cp = &buf[ii+1]; /* Reset start of string */ is that all? */ } /****************************/  /***************************/ REG WORD ii; /* counter for '$' check */ WORD count; /* = # bytes to xfer */ Brations to the * console device. * * Calling Sequence: * ret = _ttyout(buffer); } /******** */ if( cp != &buf[ii] ) /* Assuming we haven't yet */ __OSIF(C_WRITESTR,cp); /* Output the restYTE *cp; /* ptr for '$' check */ /* */ count = *buf++; /* Get num bytes to output */ buf[count] = '$'; * * Where: * buffer -> the output buffer (byte 0 is count) * ret = count on ret/************************************************************************** * * u n g e t c F u n c t i o n * --------- */ /* */ return(count); /* return original count */ } /***************************/  /* Terminate string */ for(ii=0, cp=buf; ii_flag & _IOREAD /* if file is read able */ && sp->_base != NULL /* free(mptr) * BYTE *mptr * Frees the region pointed to by 'mptr'. Returns 0 (SUCCESS) if ok, * FAILURE (-1) if corrupted frread. * * Calling sequence: * ret = ungetc(c,stream) * Where: * ret = c if it worked, FAILURE o.w. * c = char to push/******************************************************************** * malloc, free - memory allocator mechanism * * 9/83: f/ ************************/ #define FB_HDR struct hdr /* free block header type */ #define NULLFBH ((FB_HDR *)0) /* Null o and something's read */ && sp->_ptr > sp->_base ) /* and buffer not empty */ { /* then... */ *--speelist (or if mptr was not previously * allocated by malloc). * * * BYTE *realloc(mptr,numbytes) * BYTE *mptr * WORD num back * stream -> (FILE *) place to push back to * *************************************************************************ixed free bug, added check word whf * 10/83: added debugging features: DEBUGMEM and MALLOCND hooks whf * * BYTE *malloc(n/ f above struct */ /* */ FB_HDR { /* mem_block header */ struct hdr *ptr; /* ptr next blk (when fre->_ptr = ch; /* back up buffer & store */ sp->_cnt++; /* there's one more byte */ return(ch); /* it worked! bytes * Returns a pointer to a (probably different) region of memory * (numbytes long) containing the same data as the old reg****/ #include "stdio.h" WORD ungetc(ch,sp) /* CLEAR FUNCTION ***********/ REG WORD ch; /* char to unget */ REumbytes) * WORD numbytes * Returns a pointer to an area of memory at least 'numbytes' * in length. Returns NULLPTR if out ed)*/ UWORD size; /* block size (always) */ UWORD chksize; /* 1's complement of size */ }; /************** */ } /****************************/ return(FAILURE); /* it didn't work... */ } /***************************ion * pointed to by mptr. Returns NULLPTR if not enough memory, or * if freelist was corrupted. * *************************G FILE *sp; /* stream to unget to */ { /****************************/ if( ch == EOF ) /* no allowed if EOF of memory or corrupted freelist. * Warning: the size of the area is right below the region: * do not overwrite! * * * WORD**************/ /* */ FB_HDR _afreebase = {&_afreebase,0,~0 }; /* initial (empty) block */ FB_HDR *_aflistptr / FB_HDR *findblock(); /* find free block */ BYTE *cutup(); /* cut free block to fit */ /* */ nmu(s.size), * a check word (1's complement of size), and the space itself. * Alignment is handled by assuming that sizeof(FB_HDRhere */ cp = pp->ptr; /* init current ptr */ while(1) /* do forever */ { /* */ if(~(cp-()' */ /* */ /*** end of "malloc.h" ******/ /**********************************************************order to fix the pointer of the this freeblock. */ /************************************************* */ MLOCAL= &_afreebase; /* ptr into ring of freeblks*/ /* */ #define AOFFS 1L /* alignment offset: 0=byte, lts = (nbytes+sizeof(FB_HDR)-1)/sizeof(FB_HDR)+1; /* */ if( (pp=findblock(nmults)) == NULLFBH ) /* find ptr to ptr to blo) is an aligned * quantity, and allocating in multiples of that size. ************************************************** >size^cp->chksize)) /* does cp pt to valid blk? */ { /* no... */ _errmalloc(ERR_FINDBLOCK); /* handle this******************/ /* malloc - general purpose memory allocator * This function allocates the requested number of bytes (nbyt FB_HDR * /* */ findblock(units) /* find a free block */ UWORD units; /* at least this big */ { 1=word, 3=quad */ #define AMASK(c) ((char *)((long)(c) & ~AOFFS)) /* mask alignment bits */ #define AFUDGE 4 /* leewack */ return NULLPTR; /* no luck... */ return cutup(pp,nmults); /* cut block to fit & return*/ } /************ */ BYTE * malloc(nbytes) /* CLEAR FUNCTION ***********/ UWORD nbytes; /* number bytes requested */ { /***** error */ return NULLFBH; /* */ } /* */ if( cp->size >= units ) /* is this block big enouges) and returns * a pointer to this space to the calling function. * The memory is requested from the O.S. in larger chunks, a /****************************/ REG FB_HDR *cp; /* ptr to current block */ REG FB_HDR *pp; /* ptr to previy for passing block as is */ #define ACHUNKS 64 /* chunks to alloc from O.S.*/ /* */ #define ERR_FINDBLOCK 1****************/ /****************************************************************************/ /* findblock - local subr t***********************/ REG UWORD nmults; /* multiples of FB_HDR size */ REG FB_HDR *pp; /* temporary ptr *h?*/ return pp; /* yes! NOTE: return prevptr*/ if( cp == _aflistptr ) /* end of list? */ if( (cp=getmemory(und * free space is managed as a ring of free blocks. Each block * contains a pointer to the next block (s.ptr), a block size ous block */ FB_HDR *getmemory(); /* get from OS, add to list */ /* */ pp = _aflistptr; /* start search /* error in 'findblock()' */ #define ERR_GETMEM 2 /* error in 'getmemory()' */ #define ERR_FREE 3 /* error in 'freeo find a free block that's big enough. */ /* It returns a pointer to the freeblock BEFORE the desired freeblock, */ /* in nits)) == NULLFBH ) /* is there more? */ { /* */ _errmalloc(ERR_GETMEM); /* */ return NULLFBHcp+1; /* point to after header */ } /****************************/ /*******************************************w. cut block up */ np = cp + units; /* where it starts */ np->size = cp->size - units; /* how big it is fbp->size = utg; fbp->chksize = ~fbp->size; free( (BYTE *)(fbp+1) ); /* add to free list */ ret/* */ cutup(pp,units) /* cut the block to fit */ FB_HDR *pp; /* ptr to ptr to block */ UWORD unrk(); /* obtain memory from O.S. */ REG BYTE *mmp; /* more memory pointer */ REG FB_HDR *fbp; /* free; /* no more memory... */ } /* */ pp = cp; /* */ cp = cp->ptr; /* move on down the list *********************************/ /* getmemory - gets memory from O.S. */ /* This function requests memory from the */ np->chksize = ~np->size; /* it's a valid blk */ np->ptr = cp->ptr; /* it's linked into freelist*/ urn(_aflistptr); /* set in 'free' */ } /***************************************************************************its; /* num units to cut to */ { /****************************/ REG FB_HDR *cp; /* cur ptr */ REG block pointer */ REG WORD utg; /* units to get */ utg = ((numu+(ACHUNKS-1)) / ACHUNKS) * ACHUNKS; mmp = sbrk */ } /* */ } /****************************/ /************************************************************O.S. in multiples (ACHUNKS) */ /* of the requested number of units (numu), in order to minimize */ /* the number of capp->ptr = np; /* from both sides */ cp->size = units; /* new size for cur block */ cp->chksize = ~cp->size*/ /* free - adds memory back to free block list. * This function assumes freed memory pointer (fmp) points to free space * p FB_HDR *np; /* new ptr (if needed) */ /* */ cp = pp->ptr; /* get ptr to big block */ if( cp->siz(utg * sizeof(FB_HDR)); /* sbrk wants number of bytes */ if( mmp == (char *)-1 ) /* sbrk = -1 means no memory ava****************/ /* cutup - a local fn to cut up the free block (if its much bigger than the */ /* number of units requested)lls to the O.S. */ /* Function cleans up pointer alignment and adds to free list. */ /****************************; /* and make valid */ } /****************************/ _aflistptr = pp; /* search from here next tim*/ return receeded by a FB_HDR structure. * Note that free block is inserted in memory address order, * to facilitate compaction. * Faie <= units+AFUDGE ) /* is size close enough? */ pp->ptr = cp->ptr; /* yes: cut cp from list */ else { /* o.ilable */ return( NULLFBH ); mmp = AMASK(mmp + AOFFS); /* alignment handling: nop if good sbrk */ fbp = (FB_HDR *)mmp;, and to convert blk ptr to byte ptr. */ /************************************************* */ MLOCAL BYTE * ********************* */ MLOCAL FB_HDR * getmemory(numu) UWORD numu; /* number of units */ { BYTE *sbls (-1 return) if you link in a random ptr. ************************************************* */ WORD free(fmp) /* CL = pp->ptr->ptr; /* */ } else /***** */ cp->ptr = pp->ptr; /* else just point to nxt */ /*******ext */ return SUCCESS; /* and do no more */ } /****************************/ /******************************* FB_HDR *pp, *findblock(); /* find free block */ BYTE *cutup(); /* cut free block to fit */ /* */ _aflistptr; ; pp=pp->ptr ) /* start through the list */ { /* */ if( cp >= pp && cp < pp->ptr ) /* are we a***************************************************/ /* realloc - free memory, allocate again (with changed size maybe), */EAR FUNCTION ***********/ BYTE *fmp; /* freed memory ptr */ { /****************************/ REG FB_HDR *cp, *********************/ if( pp+pp->size == cp ) /* end prev plk==start cur? */ { /* then merge with prev*/ pp->size ****************** */ /* Insert freed block back into list. Try to coalesce (merge) adjacent */ /* regions. free(ptr); /* stuff back into free list: any coalesce will not */ /* affect original data region */ nmults = (siz+st correct place? */ break; /* yes... */ if( pp >= pp->ptr && /* at end of list? and */ (cp <= pp->pt /* preserve contents. */ /************************************************* */ BYTE * realloc(ptr,siz) /* C /* current freeblk ptr */ *pp; /* previous freeblk ptr */ /****************************/ cp = (FB_HDR+= cp->size; /* */ pp->chksize = ~pp->size; /* */ pp->ptr = cp->ptr; /* */ } else /***** * */ /************************************************* */ if( cp+cp->size == pp->ptr ) /* end freed blk==start nxt?*izeof(FB_HDR)-1)/sizeof(FB_HDR)+1; /* */ if( (pp=findblock(nmults)) == NULLFBH ) /* find ptr to ptr to block */ returnr || cp >= pp) ) /* blk is off either end? */ break; /* yes... */ } /****************************/ if( cLEAR FUNCTION ***********/ REG BYTE *ptr; /* ptr to (prev malloc'd)mem*/ UWORD siz; /* size of mem */ { /*** *)fmp - 1; /* ptr to (hdr of) freed blk*/ if(~(cp->size^cp->chksize)) /* is blk valid? */ { /* */ _e/ pp->ptr = cp; /* else point prev to cur */ /****************************/ _aflistptr = pp; /* search from he/ { /* then merge with nxt */ cp->size += pp->ptr->size; /* */ cp->chksize = ~cp->size; /* */ cp->ptr NULLPTR; /* no luck... */ np = (pp->ptr)+1; /* convert to BYTE ptr */ if( ptr != np ) { /* if ptr changed p>=pp && cp+cp->size <= pp+pp->size )/* block already freed? */ { /* */ _aflistptr = pp; /* search from here n*************************/ REG BYTE *np; /* ptr to new allocation */ REG UWORD nmults; /* multiples if FB_HDR size */rrmalloc(ERR_FREE); /* */ return FAILURE; /* no: fail... */ } /****************************/ for( pp=re next time*/ return SUCCESS; /* say its ok */ } /****************************/ /************************* */ if( np < ptr ) /* if new ptr in lower mem */ for( ; siz; siz-- ) /* copy up */ *np++ = *ptr++; /* buffer address * bytes Is the number of bytes to read * ************************************ny arbitrary offset in * the file. * The terminal handler for read has been set up to simulate some of * return(_ttyin(fp,buff,bytes)); /* Yes, read 1 line */ /****************************/ if(fp->flags & ISASCII) /************************/ c(); /* Read ascii rtn */ UWORD _rdbin(); /* Read binary rtn */ /****************************/ if((fp=_ch */ else /* if new ptr in higher mem */ for( np+=siz, ptr+=siz; siz; siz-- ) /* copy down */ *--np = *--****************************************/ #include "portab.h" #include "osif.h" #include "osiferr.h" #include "errno.h" the functions provided by "ioctl". * * Edits: * 11-Dec-83 whf Divide into separate file* ASCII?? */ return(_rdasc(fp,buff,(LONG)bytes)); /* Yes, read ascii */ else return(_rdbin(fp,buff,(LONG)bytes)); /*************************************************************************** * * R e a d F u n c t i o kc(fd)) == NULLFD) /* File open & OK?? */ return(FAILURE); /* No: EBADF */ if((fp->flags & ATEOF) != 0) /* End optr; /* */ } /****************************/ return cutup(pp,nmults); /* cut block to fit & return*/ } /*** UWORD read(fd,buff,bytes) /* CLEAR FUNCTION ***********/ WORD fd; /* File descriptor */ BYTE *buff; /* -> buffes, do PC-DOS I/O * * Calling Sequence: * ret = read(fd,buffer,bytes); * Where: /* No, read binary */ /****************************/ } n * ------------------------- * Copyright 1982 by Digital Research Inc. All rights reserved. * f file already? */ return(0); /* Yes, quit now */ if((fp->flags & ISLPT) != 0) /* A wise guy?? */ RETERR*************************/ r start */ UWORD bytes; /* = byte count to read */ { /****************************/ REG FD *fp; /* -> ccb * ret Is the number of bytes which were actually read * fd Is an open file descriptor * buffer Is the* No, read binary */ /****************************/ }  * The read function simulates the UNIX read system call. Any * arbitrary number of bytes may be read at a(FAILURE,EBADF); /* A wise guy!! */ /****************************/ if((fp->flags & ISTTY) != 0) /* TTY? */************************/  to read from */ FD *_chkc(); /* Converts fd to fp */ UWORD _ttyin(); /* Read from tty rtn */ UWORD _rdas* No, read binary */ /****************************/ }  * Modified 11-Aug-83 (whf) for DRC * Modified 26-Jun-83 (sw) for wild cards and user # support * * filnam Is a null-terminated CP/M filename * bdosfunc Is the desired BDOS function to perform * ret Is SUb */ RETERR(FAILURE,EINVAL); /* Quit if name not ok */ #if CPM /* Handling user numbers? */ if(fcbp->fuser)n * ----------------------------- * Copyright 1982 by Digital Research Inc. All rights reserved. * rea in ccb */ REG BYTE *p; /* Temp character pointer */ REG WORD rv; /* Return value */ REG WORD xuser; / ****************************************************************************/ #include "portab.h" #include "osif.h" #inCCESS if everything ok, FAILURE o.w. unless: * bdosfunc=SEARCHF/N, ret = dcnt (0-3) * * This rou /* User # specified? */ fp->user = fcbp->fuser; /* put it where we use it */ #endif /*********************** * Function "__open" is used to parse the CP/M fcb and open or create * the requested file. Created files are * User number */ BYTE *_parsefn(); /* Parse filename function */ /****************************/ /* clude "osiferr.h" #include "errno.h" #define HIBIT 0x80 WORD __open(ch,filnam,bdosfunc) /****************************/ tine may also be used to delete files as well. * * Modified 4-Nov-83 (whf) open files read-only if appro*****/ if( bdosfunc == CREATE && /* Creating file? */ index(fcbp->fname,'?')) /* Wild cards @!@#$!!! */ deleted first, to avoid * directory problems. * * Calling Sequence: * */ fp = _getccb(ch); /* Fetch ccb pointer */ fcbp = &(fp ->fcb); /* Fetch fcb pointer */ rv = SUCCESS; /* /* */ WORD ch; /* Channel number */ REG BYTE *filnam; /* -> filename */ WORD bdosfunc; /* BDOS Fupriate * Modified 8-Oct-83 (whf) handle user #s differently * Modified 5-Oct-83 (whf) added '_parsefn()' RETERR(FAILURE,EINVAL); /* Just quit */ /* */ xuser = _chkuser(fp->user); /* Change user # if needed */ * ret = __open(ch,filnam,bdosfunc); * * Where: * ch Is a vacant channel number Default to success */ /****************************/ if( _parsefn(filnam,fcbp) != NULLPTR ) /* Parse filnam into fc/*************************************************************************** * * _ _ o p e n F u n c t i o nction */ { /****************************/ FD *fp; /* -> ccb area */ REG struct fcbtab *fcbp; /* -> FCB a /* */ if(bdosfunc == CREATE) /* Creating file? */ __OSIF(DELETE,fcbp); /* delete it first */ y to ascii). * * Calling Sequence: * fid = open(fname,mode) * fid = opena(fname,mode) * fid = openb(fname,mode) * fid MFILE */ /* */ __chinit(ich); /* Clear out channel's ccb */ ch = _getccb(ich); /* Get address of ccb ded */ /* */ if(bdosfunc == SEARCHF || bdosfunc == SEARCHN) /* */ return(rv); /* return directory co> Terminal name */ EXTERN BYTE __lname[]; /* -> List device name */ WORD _open (fname,mode,xtype) /************** /* */ #if CPM /* running some brand of CPM*/ if(bdosfunc == OPEN) /* Opening a file? */ { /* Yes... = _open(fname,mode,type); * * Where: * fname is the address of a null terminated file name. * mode is the open mode: * /**************************************************************************** * * C F I L E O P E N R O U T I N E * */ /* */ if(mode == READ) /* If read only, */ ch -> flags |= ISREAD; /* set READONLY bit*/ unt */ return((rv<=3) ? SUCCESS : FAILURE); /* Binary return code */ } /****************************/ **************/ BYTE *fname; /* -> File name */ WORD mode; /* Open mode */ WORD xtype; /* File type */ if( fp->flags & ISREAD ) /* Open file Read-Only? */ (fcbp->fname)[5] |= HIBIT; /* Turn on F6' attribute bit 0 => READ access only * 1 => WRITE access only * 2 => Both READ and WRITE * type is 0 for ASCII files, 1 for BINARY ------------------------------------- * Copyright 1982 by Digital Research Inc. All rights reserved. * * The "open" rouif(xtype == 0) /* Is ASCII file? */ ch -> flags |= ISASCII; /* Yes, mark it */ /* */ if(_strcmp(fnnt */ return((rv<=3) ? SUCCESS : FAILURE); /* Binary return code */ } /****************************/  */ { /****************************/ REG WORD ich; /* Channel number for open */ REG FD *ch; /* -> CCB for ch*/ } /* */ #endif /* */ /****************************/ rv = __OSIF(bdosfunc,fcbp); /* Do reque* * *****************************************************************************/ #include "portab.h" /* */ #inclutine opens a "C" file and returns a file id. * Comes in 3 flavors, one for ascii, one for binary, and the default * (currentlame,__tname) == 0) /* if a terminal */ { /* */ ch->flags |= ISTTY|OPENED; /* mark as tty */ retunt */ return((rv<=3) ? SUCCESS : FAILURE); /* Binary return code */ } /****************************/ annel */ /* */ if((ich = _allocc()) == FAILURE) /* Allocate a channel */ return(FAILURE); /* Can't: Ested operation */ /****************************/ /* */ _uchkuser(fp->user,xuser); /* Change back if neede "osif.h" /* */ #include "osiferr.h" /* */ #include "errno.h" /* */ EXTERN BYTE __tname[]; /* -rn(ich); /* Return file descriptor */ } /****************************/ else if(_strcmp(fname,__lname) == 0) /* Listode) /* CLEAR FUNCTION ***********/ BYTE *fname; WORD mode; { return(_open(fname,mode,1)); } /* open binary file */ lseek(ch->chan, 0L, 2); /* Kludge to set */ lseek(ch->chan, 0L, 0); /* hi water mark */ return(i strcpy(buf,"C RTL - program not linked for "); strcat(buf,msg); strcat(buf,"\r\nProgram terminating\r\n$"); __OSIF(C_WR device? */ { /* */ ch->flags |= ISLPT|OPENED; /* Mark as printer */ return(ich); /* Return filde) /* CLEAR FUNCTION ***********/ BYTE *fname; WORD mode; { return(_open(fname,mode,1)); } /* open binary file */ ch); /* Return Channel # */ } /****************************/ WORD open(fname,mode) /* CLEAR FUNCTION **********ITESTR,buf); _exit(FAILURE); } e descriptor */ } /* */ /****************************/ if(__open(ich,fname,OPEN) != 0) /* Use POS SVC inde) /* CLEAR FUNCTION ***********/ BYTE *fname; WORD mode; { return(_open(fname,mode,1)); } /* open binary file */ /*********************************************************************** * * g e t p a s s F u n c t i o n * ----------*/ BYTE *fname; WORD mode; { return(_open(fname,mode,0)); } /* default to ascii */ WORD opena(fname,mode) /* CLEAR FTESTR,buf); _exit(FAILURE); } terface */ { /* */ _freec(ich); /* deallocate channel */ RETERR(FAILURE,ENOENT); /* If return <> 0/* OPTOFF.C: prints a message in case someone tries to use a part of the */ /* RTL which was OPTIONally linked out. *--------------------- * Copyright 1982 by Digital Research Inc. All rights reserved. * * "getpass" writes a prompt to the coUNCTION ***********/ BYTE *fname; WORD mode; { return(_open(fname,mode,0)); } /* open ascii file */ WORD openb(fname,mTESTR,buf); _exit(FAILURE); } , NFG. */ } /****************************/ /* Else: */ ch -> flags |= OPENED; /* Set OPEN bit */ / #include "portab.h" #include "osif.h" _optoff(msg) BYTE *msg; { BYTE buf[200]; /* ought to be big enough */ nsole (NOT stdout) and accepts * a string of 1-8 chars from the console (NOT stdin) without * echoing the input to the terminc; /* OS function to use */ { /***************************/ WORD xcount; /* save area for count */ /* CTRLX: bf -= cur; cur = 0; break; case '\r': case '\n': *bf = NULL; return; case CTRLC: exit(1/*************************************************************************** * Function: ttyinraw() * * Usage: ret = ttyinr/* CLEAR FUNCTION ***********/ BYTE *prompt; { MLOCAL BYTE ibuf[9]; _conout(prompt,strlen(prompt),CONOUT); /* same fn wal. Only limited CP/M line edit * commands are available (CTL H, DEL, CTL X) on input. * * Calling sequence: * pret = getp */ while(count-- > 0) /* Until all written */ __OSIF(os_func,*buffer++); /* Output next character */ } /*); default: *bf++ = ch; cur++; if( cur+1 >= ln ) { *bf = NULL; return; } } } } /********aw(chktype) * * Where: WORD ret Value determined by chktype parameter. * WORD chktype What type of activity to check for, rite uses */ _noecho(ibuf,9); return(ibuf); } #define CMASK 0x7F #define DEL 0x7F #define CTRLX 0x18 #define CTRLC 0xass(prompt) * Where: * pret -> ptr to 1-8 chars of null terminated password * prompt -> null teminated console out msg. * **************************/ ********************************************************************/ MLOCAL _conout(buffer,count,os_func) /**************as in: * 0 - ret==input_char (do NOT echo), wait for a key to be * pressed. Appropriate for Raw I/O. * 1 - ret==pre03 MLOCAL _noecho(bf,ln) REG BYTE *bf; WORD ln; { REG WORD cur; WORD ch; WORD ttyinraw(); cur = 0; FOREVER { * Modified: * Feb 84 whf - _ttyinraw() => ttyinraw() * Oct 83 whf - handle OS Independent Raw Input * ********************************************/ *************/ REG BYTE *buffer; /* -> 1st char output */ REG WORD count; /* = # bytes to xfer */ REG WORD os_funssed_key (do NOT echo) if any key pressed, * ret==0 if no key has been pressed. * This would be appropriate for ediswitch( ch = CMASK & ttyinraw(0)) { case '\b': case DEL: if( cur>0 ) { cur--; bf--; } break; case*******************************************************/ #include "portab.h" #include "osif.h" BYTE * getpass(prompt) *************************/ tors and other * interactive programs. * 2 - ret==input_char (NO echo) if user tries to interrupt, * ret==0 oth************/ REG WORD ic; /* Input Char */ /* */ while((ic=__OSIF(CONIO,CharInReq))==0) /* Wait in loo * 26-Jan-84 whf simplify for 68k compiler. * 8-Dec-83 whf handle PC-DOS like CPM-86 ********************************** ch; /* character input */ switch(chktype) { case 2: /* Check for interrupt? */ if( os_interrupts )o_wait; Wait for input if non-zero. * WORD retchar; Character input from keyboard (no echo). * Notes: * Handles single chor MPM */ CharInReq = 0xFD; /* Change Char Input Parm */ #endif /*================================================erwise. Always 0 for any O.S. * with live CTRL C or equivalent. * this allows compute bound programs to check kb * pp if needed */ { /* */ if( !DoWait ) /* Don't wait for keypress? */ break; /* no, don't wait. ******************************************/ #include "portab.h" #include "osif.h" #include "osiferr.h" #include "osattr.h" /* O.S. looks for CTRL C? */ return 0; /* yes, no interrupt check*/ /* no, drop thru... */ case 0: aracter input independent of (CP/M) OS. * Problem is that different OSs handle Raw Input in different ways. * CPM-86 and================*/ } /* */ return ic; /* */ } /****************************/ /**************eriodically to see if user wants to interrupt, * and live keyboard type-ahead if appropriate for O.S.) * 3 - ret==1 if a */ #if CPM /*================================================================*/ /* This goes inside the loop; for Concu /****************************/ MLOCAL WORD CharInReq = 0xFF; /* Default CONIO Char In Rqs*/ /***************** /* Return character or 0 */ return _ttyinraw(0); /* 0 means don't wait */ case 3: /* Return console stat CPM68K use only 0xFF, but CPM68K waits for a character. * Hard loops in multi-tasking, however, waste CPU cycles, so MPM and************************************************************* *****************************************************************ny key pressed, * ret==0 otherwise. Appropriate for checking console * status only, since the character is NOT inprrent, it will be called */ /* only once, while for other O.S.'s, it doesn't matter what we */ /* do while we're wai***********/ WORD _ttyinraw(DoWait) /* */ WORD DoWait; /* Wait for key press? */ { /****************us */ return __OSIF(C_STAT,0); /* 1 if key pressed */ default: case 1: /* Return char with wait */ * Concurrent use 0xFD. * **************************** * * Edits: * 28-Feb-84 whf Add ttyinraw(). ***********/ WORD ttyinraw(chktype) /* CLEAR FUNCTION ***********/ WORD chktype; /* type of input */ { WORDut. * ***************************** * * Function: _ttyinraw() * * Usage: retchar = _ttyinraw(do_wait) * * Where: WORD dting for a char. */ __OSIF(S_BDOSVER,0); /* Puts AX in __cpmrv */ if( __cpmrv & 0x0500 ) /* Concurrent return _ttyinraw(1); /* 1 means wait */ } }  *p++ = k; } *p = 0; return (p); } ***/ #include "stdio.h" WORD puts(str) /* CLEAR FUNCTION ***********/ REG BYTE *str; /* null term string */ { /************************************************************************** * * p u t s F u n c t i o n * ------------- return _ttyinraw(1); /* 1 means wait */ } }  *p++ = k; } *p = 0; return (p); }  #include "portab.h" BYTE *__prtint(pobj, buf, base, signed, f) WORD *pobj; BYTE *buf; WORD base; WORD signed; BYTE *(* /****************************/ while(*str) /* for all chars in s */ if(putc(*str++,stdout) == FAILURE) /* ------------ * Copyright 1982 by Digital Research Inc. All rights reserved. * * "puts" copies a null terminated string to th return _ttyinraw(1); /* 1 means wait */ } }  *p++ = k; } *p = 0; return (p); } f)(); { BYTE digs[15]; REG BYTE *dp; REG WORD k; REG BYTE *p; dp = (*f)(pobj, &buf, base, signed, digs); if ( if putc fouls up */ return(FAILURE); /* give up */ return( putc('\n',stdout) ); /* append newline & return e standard output. * It copies a newline char after the end of the string. * * Calling sequence: * ret = puts(s) * Where: dp == digs) *dp++ = 0; p = buf; while (dp != digs) { k = *--dp + '0'; /* HY */ if (k > '9') k += 'A'-10-'0'; */ } /****************************/  * s = string to put * ret = last char output * ***************************************************************************/ } /****************************/ ************************************************/ #include "stdio.h" WORD putw(wrd,sp) /* CLEAR FUNCTION ***********/ ------------ * Copyright 1982 by Digital Research Inc. All rights reserved. * * "putw" puts a word (2 byte) value into the oFAILURE); /* */ return(wrd); /* it worked */ } /****************************/ */ } /****************************/  int wrd; /* the word to be put */ FILE *sp; /* the stream to put to */ { /* */ REG WORD i; /* utput stream. * Note that what's written (binary) by a UNIX (lo byte, hi byte) * system (PDP 11) will NOT be compatible with wFAILURE); /* */ return(wrd); /* it worked */ } /****************************/ index */ REG BYTE *p; /* make ptr to w */ /****************************/ p = (char *)&wrd; /* point to what's written by a * NUXI (hi byte, lo byte) system (68K). * * Calling sequence: * ret = putw(w, stream) * Where: * ret /************************************************************************** * * q s o r t F u n c t i o n * ----------- */ for( i=0; i<2; i++ ) /* for all the 2 bytes in w */ if( putc(*p++,sp)==FAILURE ) /* put dem */ return = w or FAILURE on error * w = an int word value * stream-> a (FILE *) output stream * ******************************---------------- * Copyright 1982 by Digital Research Inc. All rights reserved. * * "qsort" sorts the "number" of items, eac/************************************************************************** * * p u t w F u n c t i o n * -------------(FAILURE); /* */ return(wrd); /* it worked */ } /****************************/ h of length "size", starting * at "base", using function "compare" to compare 2 items in the vector. * * Calling sequence: * REG BYTE tmp; if( a != b ) for( ; wid-- > 0; a++, b++ ) { tmp = *a; *a = *b; *b = tmp; } } i && (*cmp)(LINEPOS(j),pivline) >= 0 ) j--; if( i start of items vector * number = number of eleREG BYTE tmp; if( a != b ) for( ; wid-- > 0; a++, b++ ) { tmp = *a; *a = *b; *b = tmp; } } )); }while( i comparator function, taking ptrs to items, * retuREG BYTE tmp; if( a != b ) for( ; wid-- > 0; a++, b++ ) { tmp = *a; *a = *b; *b = tmp; } }  i, siz, cmp); qsort( LINEPOS(i+1), num-1-i, siz, cmp); } else { qsort( LINEPOS(i+1), num-1-i, siz, cmp); qsorAR FUNCTION ***********/ { REG UWORD tot, ii; for( tot=0, ii=0; ii 1 ) { i = 0; j = num-1; pivline = LINrning WORD: * compar(a,b) < 0 if *a < *b * compar(a,b) == 0 if *a == *b * compar(a,b) > 0 if *a > *b * * "qsot( bas, i, siz, cmp); } } return(0); } MLOCAL VOID _swap(a,b,wid) REG BYTE *a; REG BYTE *b; REG WORD wid; { */ if( ++_seedptr >= NSEEDS ) _seedptr = 0; _seeds[_seedptr] = tot; return( tot >> 1 ); /* ignore lo bit because of adEPOS(j); /* choose last line for pvt */ do{ while( irt" uses the quicksort algorithm by C.A.R. Hoare. * Ref: "Software Tools in Pascal" by Kernighan & Plauger. ******************dition */ } WORD srand(seed1) /* CLEAR FUNCTION ***********/ int seed1; { REG WORD ncs; _seeds[0] = seed1; for(==================================================*/ REG BYTE *p1; /* Temp byte pointer */ BYTE c; /* Temp char * * Edits: * 20-jan-84 whf Handle PCDOS ^Z bug ****************************************************************************/flag */ return(xbytes-bytes); /* Do partial read */ } fp->sector = xsector; /* Mark buffer correctly * * --------------------------- * * The "_rdasc" function performs a read operation for ascii f!= 0) /* Buffer dirty?? */ { /* Yes, must write it */ if(_blkio(fp,fp->sector,fp->buffer, /* Try to writ ncs = seed1&077; ncs; ncs-- ) rand(); return(rand()); }  */ LONG xsector; /* Temp sector number */ LONG xbytes; /* byte count temp */ /************************ #include "portab.h" #include "osif.h" #include "osiferr.h" #include "errno.h" UWORD _rdasc(fp,buff,bytes) /*********/ } /****************************/ p1 = &(fp->buffer[(int)fp->offset&(SECSIZ-1)]); /* Load byte pointer*/ /* iles. * All Return chars (0x13) are eliminated (and not counted) from input. * * Calling Sequence: e buffer */ 1L,B_WRITE) != 1) /* */ RETERR(FAILURE,EIO); /* Unable to write, quit */ fp->flagncs = seed1&077; ncs; ncs-- ) rand(); return(rand()); } ****/ xbytes = bytes; /* Remember org. request */ while(bytes > 0) /* Until read is satisfied */ { *******************/ /* */ REG FD *fp; /* -> ccb for the file */ REG BYTE *buff; /* -> buffer to receiv */ while(p1 < &(fp->buffer[SECSIZ]) && /* Ie, more data in buffer */ bytes > 0) /* And request not satisfied*/ * ret = _rdasc(fp,buffer,bytes); * * Where: * fp -> to the open CCB * buffer ->s &= ~DIRTY; /* Wipe dirty bit */ } /****************************/ if(_blkio(fp,xsector,fp->buffer,1L, /* Read ncs = seed1&077; ncs; ncs-- ) rand(); return(rand()); }  /****************************/ xsector = fp->offset >> 7; /* Calc starting sector */ if(xsector != fp->sector) /* Mate data*/ REG LONG bytes; /* = # bytes to xfer */ { /****************************/ #if CPM /*============= { /* */ c = *p1; /* Pick up next character */ if(c==EOFCHAR) /* ^Z?? */ { /* Yes, the user's buffer * bytes = the number of bytes to be read * ret = the number of bytes actually read proper sector */ B_READ) != 1) /* */ { /* Assume no sparse ascii fs*/ fp->flags |= ATEOF; /* Set EOF /*************************************************************************** * * R d a s c F u n c t i o n ch sector in buffer?? */ { /* No, must read first */ /****************************/ if((fp->flags & DIRTY) */ fp->flags |= ATEOF; /* Set EOF flag */ if(fp->offset > fp->hiwater) /* set hiwater mark */ fp->hiwatflags |= ATEOF; /* Yes, mark file */ } /**** */ jj = _cr_collapse(buff,ii); /* Stomp out Returns (0x13) */ ***************************/ xbytes = bytes; /* Remember org. request */ while(bytes > 0 && (fp->flags&ATEOF)=e for return val calc */ endbuf = buf + cnt; /* after last char in buf */ for( chk = buf; chk < endbuf; chk++ ) /* Chec p1++; /* increment counter */ fp->offset++; /* Increment file offset */ } /**********************************/ #if PCDOS /*===============================================================*/ /******************er = fp->offset; /* if necessary */ return(xbytes-bytes); /* Return number read */ } /*************** fp->offset += ii; /* Calculate new offset */ buff += jj; /* advance the buffer ptr */ bytes -= jj; /* discoun=0 ) /* Until read is satisfied */ { /****************************/ ii = _pc_readblk(&(fp->fcb),fp->offset,buff,(WOk out entire buffer */ if( *chk != '\r' ) /* if NOT a Return: */ *buf++ = *chk; /* move it down */ re******/ } /* */ } /* While bytes > 0 */ #endif /*================================================**********/ UWORD _cr_collapse(buf,cnt) /* Stomp out Returns (0x13) */ REG BYTE *buf; /* Where to stomp */ UWOR*************/ else if (c == '\r') /* Carriage return? */ { /* */ p1++; /* Yes, just ignore that t by bytes in buff*/ } /* While bytes > 0 */ xbytes -= bytes; /* Number really read */ #endif /*=RD)bytes,1); /* */ for( jj=0; jjoffset++; /* Increment file offset */ } /* */ else /****************************/ { ==============================================================*/ if(fp->offset > fp->hiwater) /* Fix up hiwater mark */ if( ii==0 || buff[jj] == EOFCHAR ) { /* No chars or Last char EOF?*/ ii = jj; /* Num valid chars */ fp->======================================*/ unt save */ UWORD ii, jj; /* More byte count temps */ UWORD _cr_collapse(); /* Zaps CRs in buff */ /*TE *savbuf; /* Save pointer */ BYTE *endbuf; /* Move to pointer */ /* */ savbuf = buf; /* sav /* Regular character */ *buff++ = c; /* Load buffer with byte */ bytes--; /* Decrement count */ */ fp->hiwater = fp->offset; /* */ return(xbytes); /* Read fully satisfied */ } /****************=====================================*/ ************************************************************/ #include "portab.h" #include "osif.h" #include "osiferr.h" #n * ----------------------------- * Copyright 1983 by Digital Research Inc. All rights reserved. * ser!=fcbp->fuser) /* Differing User #s? */ RETERR(FAILURE,EINVAL); /* that's a no-no */ nuser = fcbp->fuser; / */ RETERR(FAILURE,EINVAL); /* Bad filename */ #if CPM /*--------------------------*/ nuser = fcbp->fuser; =====================================*/ include "errno.h" WORD rename(from,to) /* CLEAR FUNCTION ***********/ BYTE *from; /* Existing file name */ BYT * 'rename()' changes a file's name. * * Calling sequence: * ret = rename(fro* Use this user # */ } /**** */ xuser = _chkuser(nuser); /* Change user # if needed */ #endif /*------ /* Save specified User # */ #endif /*--------------------------*/ fcbp = &(fcbbuf[16]); /* F_RENAME needs it E *to; /* New file name */ { BYTE fcbbuf[32+16]; /* Extra large fcb */ REG struct fcbtab *fcbp; /* FCB poim,to) * * Where: * from -> a NULL terminated (existing) file name * to -> the --------------------*/ /****************************/ rv = __OSIF(F_RENAME,fcbbuf); /* Use special fcb */ /*/ if( FAILURE == _parsefn(to,fcbp)) /* Parse 'to' to fcb[16] */ RETERR(FAILURE,EINVAL); /* Bad filename */ #ifnter */ REG WORD nuser; /* new user # */ REG WORD xuser; /* system user # */ WORD rv; /* Return vNULL terminated new file name * ret = SUCCESS if everything ok, FAILURE o.w. * ********************************************/ #if CPM /*--------------------------*/ _uchkuser(nuser,xuser); /* Change back if needed /*************************************************************************** * * r e n a m e F u n c t i o CPM /*--------------------------*/ if( fcbp->fuser ) /* user # specified? */ { /* */ if(nuser && nualue */ fcbp = fcbbuf; /* Point fcb to start */ if( FAILURE == _parsefn(from,fcbp)) /* Parse 'from' into fcb */ #endif /*--------------------------*/ if( rv != 0 ) /* Did it work? */ RETERR(FAILURE,ERENAME); /* noBUF; return(SUCCESS); } m; /* point to pseudo stream */ sp->_cnt = 32767; /* assume 'infinite' buf */ sp->_ptr = sp->_base = str; /* streg how arg1-n are to be printed. * s = number chars put to string * * 10/83 - return num chars printed (like printf & fprintf... */ return SUCCESS; /* It worked! */ } /****************************/ /************************************************************************ * * s p r i n t f F u n c t i o n * ---------UF; return(SUCCESS); } am buf -> string */ sp->_flag = _IOWRT | _IOSTRI; /* writeable string */ sp->_fd = -1; /* insure no real i/o /* setbuf - assign a buffer to a stream, after open but before any i/o. Returns SUCCESS if ok, FAILURE o.w. */ #includ) whf * **************************************************************************/ #include "stdio.h" WORD sprintf(st.. */ return SUCCESS; /* It worked! */ } /****************************/ ---------------------- * Copyright 1982 by Digital Research Inc. All rights reserved. * * "sprintf" prints args specified inUF; return(SUCCESS); }  */ rv = _doprt(sp,fmt,&args); /* do the print */ putc(NULL,sp); /* NULL terminate string */ return(rv); /*e "stdio.h" WORD setbuf(sp,buf) /* CLEAR FUNCTION ***********/ REG FILE *sp; REG BYTE *buf; { if( sp->_base != NULLPTr,fmt,args) /* CLEAR FUNCTION ***********/ BYTE *str, *fmt, *args; { FILE stream; /* pseudo stream tab .. */ return SUCCESS; /* It worked! */ } /****************************/  format string to a string * pointed to by str. No checks for str overflow are possible. * sprintf returns str. * * Calling tell user what happened */ } R ) return(FAILURE); sp->_base = sp->_ptr = buf; if( buf == NULLPTR ) sp->_flag |= _IONBUF; else sp->_flag &= ~_ION */ REG FILE *sp; /* ptr thereto */ REG WORD rv; /* return val from _doprt */ /* */ sp = &strea sequence: * s = sprintf(string,fmt,arg1,arg2,...argn); * Where: * string = place to put info * fmt -> a string specifyintell user what happened */ } LL*/ strcpy(locbuf,str); /* copy to safe place */ sp->_base = sp->_ptr = locbuf; return(_doscan(sp,fmt,&ptrs)); } > where matched items get stored * *****************************************************************************/ #include * * Function "_ttyin" is used to read a line from the terminal. * It looks for the ISSPTTY flag set in -------------------- * Copyright 1982 by Digital Research Inc. All rights reserved. * * "sscanf" scans the given string for tell user what happened */ } L*/ strcpy(locbuf,str); /* copy to safe place */ sp->_base = sp->_ptr = locbuf; return(_doscan(sp,fmt,&ptrs)); } "stdio.h" WORD sscanf(str,fmt,ptrs) /* CLEAR FUNCTION ***********/ BYTE *str; BYTE *fmt; BYTE *ptrs; { REG FILE *spthe ccb: if set, it assumes * the fcb really contains sgttyb information (see ), and * behaves accordinglyitems specified, and assigns * them to user supplied variables (via pointers to these vars). * * Calling sequence: * ret = L*/ strcpy(locbuf,str); /* copy to safe place */ sp->_base = sp->_ptr = locbuf; return(_doscan(sp,fmt,&ptrs)); } ; FILE spbuf; BYTE locbuf[BUFSIZ]; /* set up a local buffer */ sp = &spbuf; /* set up a pseudo stream */ sp-. * Otherwise, it grabs up to a line at a time from the BDOS. * * Calling Sequence: sscanf(str,fmt,p1,p2,...) * Where: * ret = the number of items successfully matched & assigned * EOF returned if encounte/*************************************************************************** * * _ t t y i n F u n c t i >_fd = -1; sp->_flag = _IOREAD | _IOSTRI; /* readable string */ sp->_cnt = strlen(str) + 1; /* allow doscan to read NU * ret = _ttyin(fp,buffer,bytes); * Where: * fp -> ccb pointer & channel info * buffer -> tred on input * str -> a (null terminated) string to scan * fmt -> a string specifying how to parse the input * p1,p2,... -o n * ----------------------------- * Copyright 1982 by Digital Research Inc. All rights reserved. /************************************************************************** * * s s c a n f F u n c t i o n * ---------he user's input buffer * bytes = the (maximum) number of bytes to read * ret = the number of bytes actually char */ if( *p == tyb->sg_kill ) /* kill char typed? */ exit(1); /* yes: DIE, PROGRAM! */ if(t***************************************************************************/ #ifdef RAWIO tyb = &(fp->fcb); /* assume info == 1) /* then use conin not rdln */ { ttybuf[2] = __OSIF(CONIN,0); ttybuf[1] = 1; if (ttybuf[2] == '\es */ REG BYTE *buff; /* -> user's buffer */ UWORD bytes; /* = requested byte count */ { /************ */ return(1); /* return number read */ } /* ************************/ /**************************** read * * Modified: * 2/28/84 whf: _ttyinraw() => ttyinraw() * 2/22/84 whf: handle ^Z correctly *yb->sg_flags & LCASE) /* they want lower case? */ *p = (*p>='A'&& *p<='Z' /* */ ? *p+('a'-'A') : *p); /* givstored here */ if(tyb->sg_flags & RAW) /* are we in raw mode? */ { /* */ *buff = ttyinraw(0); /* grar') ttybuf[1] = 0; } else __OSIF(CONBUF,ttybuf); /* Read line from BDOS */ /**************************************/ REG BYTE *p; /* Temp pointer */ BYTE ttybuf[Bytesized+2]; /* Biggest line from tty */ UWORD x************************************************/ #else _optoff("Raw I/O"); #endif /********************************** 2/84 whf: conditionally compile RAWIO code * 10/83 whf: eliminate static data (ttybuf), use _ttyinraw() * e them lower case */ if((tyb->sg_flags & CRMOD) /* xlate returns? */ && *p == '\r' ) /* */ b a char */ return(1); /* return number bytes read */ } /* ************************/ if(tyb->sg_flags &******/ xbytes = ttybuf[1] & 0xff; /* # characters read */ if( xbytessg_flags & ECHO)/* */ __OSIF(CONIO,*p); /* out before xlate */ *p = '\n'; /* CBREAK) /* are we half baked? */ { /* */ p = buff; /* use ptr */ *p = ttyinraw(0); /* getCONOUT,'\n'); /* CR/LF line terminated */ p = &ttybuf[2]; /* p -> First character */ while( bytes > 0 && xbytes >>fcb)*/ /* */ if(fp->flags & ISSPTTY) /* is this a special tty? */ { /****************************/ /* bytes < Bytesized ? bytes : Bytesized;/* don't read more than */ ttybuf[0] = nbs; /* asked for/we have room fr*/ if (nbs nclude "sgtty.h" #define Bytesized 0xFF WORD _ttyin(fp,buff,bytes) /****************************/ FD *fp; /* -> filed yes, do xlation */ } /* */ if(tyb->sg_flags & ECHO) /* echo chars? */ __OSIF(CONIO,*p); /* 0) /* */ { /* Copy 1 byte / time */ if(*p == EOFCHAR) /* ^Z typed? */ { /* Yes, */ f***********************************************************/ #include "portab.h" #include "osif.h" WORD unlink(filename) n * ----------------------------- * Copyright 1982 by Digital Research Inc. All rights reserved. * /* Return # bytes moved */ } /****************************/ urn(ret); /* Return result of DELETE */ } /****************************/ p->flags |= ATEOF; /* Mark with EOF */ return (WORD)(p-&ttybuf[2]); /* Return # bytes moved*/ } /****** */ /* CLEAR FUNCTION ***********/ BYTE *filename; /* -> filename */ { /****************************/ REG WORD ch * The unlink function is used to delete a CP/M file by name. * * Calling Sequence:  /* Return # bytes moved */ } /****************************/ rn(ret); /* Return result of DELETE */ } /****************************/  *buff++ = *p++; /* */ bytes--; /* Decrement request */ xbytes--; /* Decrement bytes in buff */ } ; /* Channel number */ REG WORD ret; /* Temp return value */ /****************************/ if((ch=_allo * * ret = unlink(filename); * * Where: * filename Is the null-termin/*************************************************************************** * * W r t c h r F u n c t i o /* Return # bytes moved */ } /****************************/ rn(ret); /* Return result of DELETE */ } /****************************/ /****************************/ if(bytes > 0) /* Terminate on count? */ { /* */ *buff++ = '\n'; /* No, cc()) < 0) /* Allocate a channel */ return(FAILURE); /* Can't */ /* */ __chinit(ch); /* Init fcated name of the file * * ret Is 0 for success, -1 for failure * ***************** n * ------------------------------ * * Function "wrtchr" is called from "write" to handle ch/*************************************************************************** * * U n l i n k F u n c t i o plug in newline */ p++; /* Bump pointer */ } /****************************/ return((WORD)(p-&ttybuf[2]));b and ccb */ ret = __open(ch,filename,DELETE); /* Delete the file */ _freec(ch); /* Free the channel */ retaracter * oriented devices: TTY, LPT, and QUE. * * Calling sequence: * ret = _wrtcange DoAscii here*/ } #endif if( fp->flags & ISSPTTY ) /* Special Output handling? */ { /* yes... */ tyb =late newlines? */ int DoXTabs; /* Flag: xpand tabs? */ struct sgttyb *tyb; /* Special TTY ptr */ /* * Buf too full, next time*/ col += nsp; /* */ while( nsp-- ) /* for all the spaces */ { /* */ FD *fp; /* -> CCB */ BYTE *buf; /* -> User's buffer */ UWORD bytes; /* # bytes to write */ { set to zero when incr'd */ if( DoAscii ) /* Newline needs xlation? */ { /* yes... */ if( ii+1 >hr(fp,buffer,bytes); * * Where: * fp Points to the affected ccb. * buffer Is t &(fp->fcb); /* assume info stored here */ DoXTabs = (tyb->sg_flags) & XTABS; } /* */ /***************** */ DoAscii = TRUE; /* Default: xlate newlines */ DoXTabs = FALSE; /* Default: no expand tabs */ if( fp->flags & */ cp[ii] = ' '; ++ii; /* put them in buf */ } /* */ ++buf; /* Skip over tab */ /****************************/ UWORD nbs; /* num bytes remaining */ WORD ii; /* local counter */ BYTE c= SECSIZ ) break; /* Buf too full, next time */ cp[ii] = '\r'; /* Preceed with Return char */ ++ii; /* Incr nuhe buffer address * bytes Is the number of bytes to write * * ret Is the number of bytes act***********/ col = 0; /* Assume we're at start of */ /* line: not really kosher*/ for( nbs=bytes; nbs != 0; ) / ISTTY ) /* If TTY Output */ fnout = _ttyout; /* use that function */ else if( fp->flags & ISLPT ) /* If LST continue; /* */ } /***** */ cp[ii] = *buf++; /* Xfer char to buffer */ ++ii; --nbs; ++col; /*p[SECSIZ]; /* ptr to local buffer */ WORD col; /* column counter */ WORD nsp; /* temp counter */ int m in buffer */ } /* */ } else /***** */ if( *buf == '\t' && DoXTabs ) /* Expand this tab charually written * ****************************************************************************/ #include* For all the bytes */ { /****************************/ for( ii=1; iiflags & ISQUE ) { /* Maybe ch Handle counters */ } /****** */ cp[0] = ii-1; /* Num chars output */ (*fnout)(cp); /* g(*fnout)(); /* func placeholder */ int _ttyout(), _lstout(); /* device specific output fn*/ int DoAscii; /* Flag: x? */ { /* yes... */ nsp = 8-(col&7); /* calc number spaces */ if( ii+nsp >= SECSIZ ) break; / "portab.h" #include "osif.h" #include "sgtty.h" UWORD _wrtchr(fp,buf,bytes) /****************************/ /* hars left*/ { /* */ if( *buf == '\n' ) /* Newline char? */ { /* yes... */ col = -1; /*o do the output */ } /****************************/ return bytes; /* return what they gave us */ } /******* n * --------------------------- * Copyright 1982 by Digital Research Inc. All rights reserved. *&& *str <= '9' ) val = 10 * val + ( *str++ - '0' ); if( isneg ) val = -val; return( val ); } * */ WORD fd; /* File descriptor */ BYTE *buff; /* Buffer address */ UWORD bytes; /* Number of byte /* CLEAR FUNCTION ***********/ REG BYTE *str; { REG LONG val; REG WORD isneg; val = 0L; isneg = FALSE; while( ises actually written * * Modifications: * 11-Dec-83 whf PC-DOS mods, divide out _wrtasc & _w*********************/  * Function "write" simulates the UNIX write system call. Any * arbitrary number of bytes are written tos to xfer */ /* */ { /****************************/ REG FD *fp; /* File (ccb) pointer */ EXTERN FDspace(*str) ) str++; if( *str == '+' ) str++; else if( *str == '-' ) { str++; isneg++; } while( *str >= '0' rtbin. * 30-Nov-83 whf Fix _wrtbin() boundary condition bug * 19-Oct-83 whf Separate out _wrtchr(), _ttyout(), _lst********************/  the file specified by file * descriptor. No special alignment of file or buffer is required. * * Calli *_chkc(); /* fd -> fp Convertor MGL */ UWORD _wrtchr(); /* Device write routine */ UWORD _wrtasc(); /* Ascii wri && *str <= '9' ) val = 10 * val + ( *str++ - '0' ); if( isneg ) val = -val; return( val ); } out() * ****************************************************************************/ #include "portab.h" #in********************/ ng Sequence: * ret = write(fd,buffer,bytes); * Where: * fd is an open file descriptor /*************************************************************************** * * W r i t e F u n c t i ote routine */ UWORD _wrtbin(); /* Binary write routine */ /****************************/ if((fp=_chkc(fd))&& *str <= '9' ) val = 10 * val + ( *str++ - '0' ); if( isneg ) val = -val; return( val ); } clude "osif.h" #include "osiferr.h" #include "errno.h" UWORD write(fd,buff,bytes) /* CLEAR FUNCTION ***********/ / /* atol - convert decimal number in ascii to long integer */ #include "portab.h" #include "ctype.h" LONG atol(str) * buffer is the buffer address * bytes is the number of bytes to be written * ret is the number of byt == NULLFD) /* Get CCB address MGL */ return(FAILURE); /* Can't: EBADF */ /* note: bytes is unsigned * * nchrs = _doprt(stream,fmt,args) * Where: * nchrs = number of chars output by _doprt * stream -> destination buffer ******************/ REG BYTE c; /* format char */ BYTE **ppi; /* pointer to ptr */ WORD *pw; /* pointer tbytes)); /* do ascii style */ else return(_wrtbin(fp,buff,bytes)); /* do binary style */ } /********************oat/double arg increment */ #else #define FARG(ptr) ((ptr)+=sizeof(double)) /* float/double arg increment */ #endif #def */ if(bytes == 0) /* Trying to write 0 */ return(0); /* Yes, a wise guy! */ /* */ if((fp->fla(FILE *) * fmt -> a string specifying how "args" are to be output. * args -> a list of arguments * ******************/************************************************************************* * * _ d o p r t F u n c t i o n * ---------o word */ BYTE padchar, /* for padding */ *s, /* string ptr for output */ buf[BUFSIZ]; /* s usually p********/ ine CHOOSELS(isl) ((isl) ? __prtld : __prtshort ) /* prt long or short */ #define XPUTC(a1,a2) {putc(a1,a2);nchrs++;} /* countgs & ISREAD) != 0) /* Check for readonly file */ RETERR(FAILURE,EBADF); /* Barf if so */ /*******************************************************************************/ #include "stdio.h" #include "osif.h" #define ARGWIDTH (sizeof(-------------------- * Copyright 1982 by Digital Reseacrh Inc. All rights reserved. * * "_doprt" handles the printing for fuoints here */ WORD width; /* for format spec */ REG WORD prec, /* precision */ len; /* total length o*******/  chars output */ /****************************/ _doprt(sp,fmt,pb) /* print subroutine */ FILE *sp; /* st********/ if( fp->flags & (ISTTY+ISLPT+ISQUE)) /* TTY, LST or QUE File? */ return(_wrtchr(fp,buff,bytes)); /* Yes, handlint)) /* width of arg to function */ #define NXTARG(ptr,isl) ((ptr)+=((isl) ? MAX(ARGWIDTH,sizeof(LONG)):ARGWIDTH)) #definenctions "printf", "fprintf", * and "sprintf". Each of these sets up the parameters and calls _doprt. * * Calling sequence: f field */ WORD n, /* counter */ nchrs; /* number chars output */ BOOLEAN left, /* pad on left? *******/ ream buffer ptr */ BYTE *fmt; /* format string */ REG BYTE *pb; /* pointer to args */ { /**********e it */ /****************************/ if(fp->flags & ISASCII) /* If ascii file */ return(_wrtasc(fp,buff, IARG(ptr) ((ptr)+=ARGWIDTH) /* int arg increment */ #if CPM68K #define FARG(ptr) ((ptr)+=sizeof(float)) /* fl */ longf; /* a long arg? */ MLOCAL BYTE (*fn)(); /* function holder */ GLOBAL BYTE *__prtshort(), /* for/ if (width < 0) /* */ width = 0; /* */ width = width * 10 + (c - '0'); /* */ c = *fmt++; g */ if (c == '0') /* zero fill specified */ { /* */ padchar = c; /* */ c = *fmt++; /* /* */ /****************************/ case 'D': /* decimal signed */ longf++; /* capital letter m* put them out */ fmt = s; /* update this pointer */ nchrs += len; /* update the counter */ } /* */ prec = prec * 10 + (c - '0'); /* */ c = *fmt++; /* */ } /* */ longf = 0; /* assume 16 bit integers */ *__prtld(); /* for 32 bit integers */ double *dblptr; /* in case we need one */ /* */ } /* */ prec = -1; /* assume no precision */ if (c == '.') /* get precision */ { */ } /* */ width = -1; /* assume no field spc width*/ if( c== '*' ) /* get width from args */ eans long*/ case 'd': /* */ fn = CHOOSELS(longf); /* */ __prtint(pb, buf, 10, TRUE, fn); /* */ */ if( *fmt++ != '%' ) /* Did we stop for '%'? */ break; /* no, EOS: we're finished*/ /************** short int */ if (c == 'l' || c == 'L') /* long int specified */ { /* */ longf++; /* */ /****************************/ nchrs = 0; /* init # chars output */ if (fmt) /* make sure it's not NULL */ whil /* */ prec = 0; /* */ c = *fmt++; /* */ } /* */ if( c== '*' ) /* get prec from { /* */ pw = pb; /* use word ptr for access */ width = *pw; /* */ IARG(pb); /* */ c NXTARG(pb,longf); /* point to next arg */ break; /* finis switch */ /****************************/ **************/ left = 0; /* assume no left pad */ if ((c = *fmt++) == '-') /* left pad specified */ { /c = *fmt++; /* */ } /****************************/ /* we now have all prelims */ /* out of the way; e (TRUE) /* examine the format string*/ { /* */ for( len=0, s=fmt; *s && *s != '%'; ++s, ++len ) ; /* gr args */ { /* */ pw = pb; /* get word pointer */ prec = *pw; /* */ IARG(pb); /* = *fmt++; /* */ } /* */ else while (c >= '0' && c <= '9') /* get width from fmt */ { /* * case 'U': /* decimal unsigned */ longf++; /* */ case 'u': /* */ fn = CHOOSELS(longf); /* * */ c = *fmt++; /* */ left++; /* */ } /* */ padchar = ' '; /* assume blank paddinlet's see*/ /* what we want to print */ s = buf; /* assume we'll be using buf*/ switch (c) /* */ { ab up to EOS or '%' */ if( len > 0 ) /* did we grab anything? */ { /* yes... */ fputn(fmt,len,sp); /*/ c = *fmt++; /* */ } /* */ else while (c >= '0' && c <= '9') /* get prec from fmt */ { /* */ __prtint(pb, buf, 10, FALSE, fn); /* */ NXTARG(pb,longf); /* */ break; /* */ /****** case 'F': /* F format floating */ case 'f': /* */ _pftoa(pb, buf, prec, c);/* do the conversion */ bility */ buf[0] = (*pw & 0377); /* assume chars passed as */ buf[1] = NULL; /* ints */ IARG(pb); /* */ } /* */ while (n-- > 0) /* now pad on left */ XPUTC(padchar,sp); /* */ } /* ); /* */ break; /* */ /****************************/ case 's': /* string */ case 'S': */ XPUTC(c,sp); /* */ continue; /* */ } /****************************/ len = strlen(s); /* how **********************/ case 'O': /* octal signed */ longf++; /* */ case 'o': /* */ fn = FARG(pb); /* Bump to next arg */ prec = -1; /* Avoid truncation */ break; /* */ /*********/ break; /* */ /****************************/ /****************************/ case 'E': /* E fo */ fputn(s,len,sp); /* put buffered n chars */ nchrs += len; /* assume they got there */ while (n-- > 0) / /* */ ppi = pb; /* need to deal with ptr */ s = *ppi; /* cast to pointer */ NXTARG(pb,(sizeof(charlong is the output? */ if (prec < len && prec >= 0) /* cut off if user says so */ len = prec; /* */ n = width CHOOSELS(longf); /* */ __prtint(pb, buf, 8, FALSE, fn); /* */ NXTARG(pb,longf); /* */ break; /* ********************/ case 'G': /* G format floating */ case 'g': /* */ _pgtoa(pb, buf, prec, c);/* rmat */ case 'e': /* */ _petoa(pb, buf, prec, c);/* Do the conversion */ FARG(pb); /* Bump to ne* anything remain, then pad*/ XPUTC(padchar,sp); /* */ } /* */ return(nchrs); /* report on # chars ou *)==sizeof(long))); /* TRUE if pointers are long*/ /* FALSE if not */ break; /* */ /***** - len; /* how much extra room? */ if (!left) /* if left not specified */ { /* */ if (padchar == '0 */ /****************************/ case 'X': /* hexadecimal unsigned */ longf++; /* */ cado the conversion */ FARG(pb); /* Bump to next arg */ prec = -1; /* Avoid truncation */ break; /* xt arg */ prec = -1; /* Avoid truncation */ break; /* Next */ /****************************/ tput */ } /****************************/ ***********************/ case 'c': /* character */ case 'C': /* */ pw = pb; /* word ptr for porta' && *s == '-') /* check for neg */ { /* */ len--; /* output minus if leading 0*/ XPUTC(*s++,sp); /* se 'x': /* */ fn = CHOOSELS(longf); /* */ __prtint(pb, buf, 16, FALSE, fn); /* */ NXTARG(pb,longf */ /****************************/ /****************************/ default: /* just print the characterput */ } /****************************/ -F ERA $1MALLOCDB.I $2C168 $1MALLOCDB.1 $1MALLOCDB.2 MALLOCDB.S ERA $1MALLOCDB.1 ERA $1MALLOCDB.2 $2AS68 -S 0$1 -F $1 -L -U1CHANNELS.2 $1CHANNELS.3 -F ERA $1CHANNELS.I $2C168 $1CHANNELS.1 $1CHANNELS.2 CHANNEL5.S ERA $1CHANNELS.1 ERA $1CHANNELS.2 -I 0$1 NOFLOAT.C $1NOFLOAT.I $2C068 $1NOFLOAT.I $1NOFLOAT.1 $1NOFLOAT.2 $1NOFLOAT.3 -F ERA $1NOFLOAT.I $2C168 $1NOFLOAT.1 $1N-F $1 -L -U ALMUL.S $2AS68 -S 0$1 -F $1 -L -U ALREM.S $2AS68 -S 0$1 -F $1 -L -U BLIVOT.S $2AS68 -S 0$1 -F $1 -L -U LDIV.S ERA NOBINARY.S $2CP68 -I 0$1 NODISK.C $1NODISK.I $2C068 $1NODISK.I $1NODISK.1 $1NODISK.2 $1NODISK.3 -F ERA $1NODISK.I $2Cput */ } /****************************/  MALLOCDB.S ERA MALLOCDB.S $2CP68 -I 0$1 NOASCII.C $1NOASCII.I $2C068 $1NOASCII.I $1NOASCII.1 $1NOASCII.2 $1NOASCII.3 -F E$2AS68 -S 0$1 -F $1 -L -U CHANNEL5.S ERA CHANNEL5.S $2CP68 -I 0$1 -DNOWILD XMAIN.C $1XMAIN.I $2C068 $1XMAIN.I $1XMAIN.1 $1XOFLOAT.2 NOFLOAT.S ERA $1NOFLOAT.1 ERA $1NOFLOAT.2 $2AS68 -S 0$1 -F $1 -L -U NOFLOAT.S ERA NOFLOAT.S $2CP68 -I 0$1 NOLONG $2AS68 -S 0$1 -F $1 -L -U LMUL.S $2AS68 -S 0$1 -F $1 -L -U LREM.S $2AS68 -S 0$1 -F $1 -L -U S.S $2AS68 -S 0$1 -F $1 -L -168 $1NODISK.1 $1NODISK.2 NODISK.S ERA $1NODISK.1 ERA $1NODISK.2 $2AS68 -S 0$1 -F $1 -L -U NODISK.S ERA NODISK.S $2CP68 -RA $1NOASCII.I $2C168 $1NOASCII.1 $1NOASCII.2 NOASCII.S ERA $1NOASCII.1 ERA $1NOASCII.2 $2AS68 -S 0$1 -F $1 -L -U NOASCII.S MAIN.2 $1XMAIN.3 -F ERA $1XMAIN.I $2C168 $1XMAIN.1 $1XMAIN.2 XMAINnw.S ERA $1XMAIN.1 ERA $1XMAIN.2 $2AS68 -S 0$1 -F $1 -L -.C $1NOLONG.I $2C068 $1NOLONG.I $1NOLONG.1 $1NOLONG.2 $1NOLONG.3 -F ERA $1NOLONG.I $2C168 $1NOLONG.1 $1NOLONG.2 NOLONG.S ERAU SALLOC.S $2AS68 -S 0$1 -F $1 -L -U SETJMP.S $2AS68 -S 0$1 -F $1 -L -U ULDIV.S $2AS68 -S 0$1 -F $1 -L -U XSIGNAL.S ;;;;I 0$1 NOFILESZ.C $1NOFILESZ.I $2C068 $1NOFILESZ.I $1NOFILESZ.1 $1NOFILESZ.2 $1NOFILESZ.3 -F ERA $1NOFILESZ.I $2C168 $1NOFILES ERA NOASCII.S $2CP68 -I 0$1 NOBINARY.C $1NOBINARY.I $2C068 $1NOBINARY.I $1NOBINARY.1 $1NOBINARY.2 $1NOBINARY.3 -F ERA $1NOU XMAINnw.S ERA XMAINnw.S $2CP68 -I 0$1 MALLOCDB.C $1MALLOCDB.I $2C068 $1MALLOCDB.I $1MALLOCDB.1 $1MALLOCDB.2 $1MALLOCDB.3 $1NOLONG.1 ERA $1NOLONG.2 $2AS68 -S 0$1 -F $1 -L -U NOLONG.S ERA NOLONG.S $2CP68 -I 0$1 NOSTART.C $1NOSTART.I $2C068 $1N;;; ;;;;;;; ;;;;;;; ; SUBMIT M1 ;;;;;;; $2CP68 -I 0$1 -DMAXF5 CHANNELS.C $1CHANNELS.I $2C068 $1CHANNELS.I $1CHANNELS.1 $Z.1 $1NOFILESZ.2 NOFILESZ.S ERA $1NOFILESZ.1 ERA $1NOFILESZ.2 $2AS68 -S 0$1 -F $1 -L -U NOFILESZ.S ERA NOFILESZ.S $2CP68 ;;;;;;; ; SUBMIT M3 ;;;;;;; ERA *.O $2AS68 -S 0$1 -F $1 -L -U ABORT.S $2AS68 -S 0$1 -F $1 -L -U ALDIV.S $2AS68 -S 0$1 BINARY.I $2C168 $1NOBINARY.1 $1NOBINARY.2 NOBINARY.S ERA $1NOBINARY.1 ERA $1NOBINARY.2 $2AS68 -S 0$1 -F $1 -L -U NOBINARY.S OSTART.I $1NOSTART.1 $1NOSTART.2 $1NOSTART.3 -F ERA $1NOSTART.I $2C168 $1NOSTART.1 $1NOSTART.2 NOSTART.S ERA $1NOSTART.1 ERAMOVE.3 -F ERA $1BLKMOVE.I $2C168 $1BLKMOVE.1 $1BLKMOVE.2 BLKMOVE.S ERA $1BLKMOVE.1 ERA $1BLKMOVE.2 $2AS68 -S 0$1 -F $1 -L -LL.I $2C068 $1BLKFILL.I $1BLKFILL.1 $1BLKFILL.2 $1BLKFILL.3 -F ERA $1BLKFILL.I $2C168 $1BLKFILL.1 $1BLKFILL.2 BLKFILL.S ERA $1CLOSE.I $2C068 $1CLOSE.I $1CLOSE.1 $1CLOSE.2 $1CLOSE.3 -F ERA $1CLOSE.I $2C168 $1CLOSE.1 $1CLOSE.2 CLOSE.S ERA $1CLOSE.1 1ACCESS.1 ERA $1ACCESS.2 $2AS68 -S 0$1 -F $1 -L -U ACCESS.S ERA ACCESS.S $2CP68 -I 0$1 ATOI.C $1ATOI.I $2C068 $1ATOI.I $1 $2CP68 -I 0$1 CHKUSER.C $1CHKUSER.I $2C068 $1CHKUSER.I $1CHKUSER.1 $1CHKUSER.2 $1CHKUSER.3 -F ERA $1CHKUSER.I $2C168 $1CH $1NOSTART.2 $2AS68 -S 0$1 -F $1 -L -U NOSTART.S ERA NOSTART.S $2CP68 -I 0$1 NOTTYIN.C $1NOTTYIN.I $2C068 $1NOTTYIN.I $1NOU BLKMOVE.S ERA BLKMOVE.S $2CP68 -I 0$1 CALLOC.C $1CALLOC.I $2C068 $1CALLOC.I $1CALLOC.1 $1CALLOC.2 $1CALLOC.3 -F ERA $1CA$1BLKFILL.1 ERA $1BLKFILL.2 $2AS68 -S 0$1 -F $1 -L -U BLKFILL.S ERA BLKFILL.S $2CP68 -I 0$1 BLKIO.C $1BLKIO.I $2C068 $1BLERA $1CLOSE.2 $2AS68 -S 0$1 -F $1 -L -U CLOSE.S ERA CLOSE.S $2CP68 -I 0$1 CREAT.C $1CREAT.I $2C068 $1CREAT.I $1CREAT.1 $1CATOI.1 $1ATOI.2 $1ATOI.3 -F ERA $1ATOI.I $2C168 $1ATOI.1 $1ATOI.2 ATOI.S ERA $1ATOI.1 ERA $1ATOI.2 $2AS68 -S 0$1 -F $1 -L -KUSER.1 $1CHKUSER.2 CHKUSER.S ERA $1CHKUSER.1 ERA $1CHKUSER.2 $2AS68 -S 0$1 -F $1 -L -U CHKUSER.S ERA CHKUSER.S $2CP68 -ITTYIN.1 $1NOTTYIN.2 $1NOTTYIN.3 -F ERA $1NOTTYIN.I $2C168 $1NOTTYIN.1 $1NOTTYIN.2 NOTTYIN.S ERA $1NOTTYIN.1 ERA $1NOTTYIN.2 LLOC.I $2C168 $1CALLOC.1 $1CALLOC.2 CALLOC.S ERA $1CALLOC.1 ERA $1CALLOC.2 $2AS68 -S 0$1 -F $1 -L -U CALLOC.S ERA CALLOC.S KIO.I $1BLKIO.1 $1BLKIO.2 $1BLKIO.3 -F ERA $1BLKIO.I $2C168 $1BLKIO.1 $1BLKIO.2 BLKIO.S ERA $1BLKIO.1 ERA $1BLKIO.2 $2AS68 REAT.2 $1CREAT.3 -F ERA $1CREAT.I $2C168 $1CREAT.1 $1CREAT.2 CREAT.S ERA $1CREAT.1 ERA $1CREAT.2 $2AS68 -S 0$1 -F $1 -L -U U ATOI.S ERA ATOI.S $2CP68 -I 0$1 ATOL.C $1ATOL.I $2C068 $1ATOL.I $1ATOL.1 $1ATOL.2 $1ATOL.3 -F ERA $1ATOL.I $2C168 $1ATO 0$1 CLEANUP.C $1CLEANUP.I $2C068 $1CLEANUP.I $1CLEANUP.1 $1CLEANUP.2 $1CLEANUP.3 -F ERA $1CLEANUP.I $2C168 $1CLEANUP.1 $1CLE $2AS68 -S 0$1 -F $1 -L -U NOTTYIN.S ERA NOTTYIN.S ;;;;;;; ;;;;;;; ;;;;;;; ; SUBMIT M2 ;;;;;;; $2CP68 -I 0$1 ACCESS.C $2CP68 -I 0$1 CHANNELS.C $1CHANNELS.I $2C068 $1CHANNELS.I $1CHANNELS.1 $1CHANNELS.2 $1CHANNELS.3 -F ERA $1CHANNELS.I $2C16-S 0$1 -F $1 -L -U BLKIO.S ERA BLKIO.S $2CP68 -I 0$1 BLKMOVE.C $1BLKMOVE.I $2C068 $1BLKMOVE.I $1BLKMOVE.1 $1BLKMOVE.2 $1BLKCREAT.S ERA CREAT.S $2CP68 -I 0$1 CTYPE.C $1CTYPE.I $2C068 $1CTYPE.I $1CTYPE.1 $1CTYPE.2 $1CTYPE.3 -F ERA $1CTYPE.I $2C16L.1 $1ATOL.2 ATOL.S ERA $1ATOL.1 ERA $1ATOL.2 $2AS68 -S 0$1 -F $1 -L -U ATOL.S ERA ATOL.S $2CP68 -I 0$1 BLKFILL.C $1BLKFIANUP.2 CLEANUP.S ERA $1CLEANUP.1 ERA $1CLEANUP.2 $2AS68 -S 0$1 -F $1 -L -U CLEANUP.S ERA CLEANUP.S $2CP68 -I 0$1 CLOSE.C $1ACCESS.I $2C068 $1ACCESS.I $1ACCESS.1 $1ACCESS.2 $1ACCESS.3 -F ERA $1ACCESS.I $2C168 $1ACCESS.1 $1ACCESS.2 ACCESS.S ERA $8 $1CHANNELS.1 $1CHANNELS.2 CHANNELS.S ERA $1CHANNELS.1 ERA $1CHANNELS.2 $2AS68 -S 0$1 -F $1 -L -U CHANNELS.S ERA CHANNELS.S8 $1CTYPE.1 $1CTYPE.2 CTYPE.S ERA $1CTYPE.1 ERA $1CTYPE.2 $2AS68 -S 0$1 -F $1 -L -U CTYPE.S ERA CTYPE.S $2CP68 -I 0$1 DOP.C $1FDECLS.I $2C068 $1FDECLS.I $1FDECLS.1 $1FDECLS.2 $1FDECLS.3 -F ERA $1FDECLS.I $2C168 $1FDECLS.1 $1FDECLS.2 FDECLS.S ERAERA $1EXEC.2 $2AS68 -S 0$1 -F $1 -L -U EXEC.S ERA EXEC.S $2CP68 -I 0$1 EXIT.C $1EXIT.I $2C068 $1EXIT.I $1EXIT.1 $1EXIT.2 $FILBUF.1 $1FILBUF.2 $1FILBUF.3 -F ERA $1FILBUF.I $2C168 $1FILBUF.1 $1FILBUF.2 FILBUF.S ERA $1FILBUF.1 ERA $1FILBUF.2 $2AS68N.2 $1DOSCAN.3 -F ERA $1DOSCAN.I $2C168 $1DOSCAN.1 $1DOSCAN.2 DOSCAN.S ERA $1DOSCAN.1 ERA $1DOSCAN.2 $2AS68 -S 0$1 -F $1 -L FFLUSH.S ERA FFLUSH.S $2CP68 -I 0$1 FGETC.C $1FGETC.I $2C068 $1FGETC.I $1FGETC.1 $1FGETC.2 $1FGETC.3 -F ERA $1FGETC.I $2RT.C $1DOPRT.I $2C068 $1DOPRT.I $1DOPRT.1 $1DOPRT.2 $1DOPRT.3 -F ERA $1DOPRT.I $2C168 $1DOPRT.1 $1DOPRT.2 DOPRT.S ERA $1DOPR $1FDECLS.1 ERA $1FDECLS.2 $2AS68 -S 0$1 -F $1 -L -U FDECLS.S ERA FDECLS.S $2CP68 -I 0$1 FDOPEN.C $1FDOPEN.I $2C068 $1FDO1EXIT.3 -F ERA $1EXIT.I $2C168 $1EXIT.1 $1EXIT.2 EXIT.S ERA $1EXIT.1 ERA $1EXIT.2 $2AS68 -S 0$1 -F $1 -L -U EXIT.S ERA EXI -S 0$1 -F $1 -L -U FILBUF.S ERA FILBUF.S $2CP68 -I 0$1 FILESZ.C $1FILESZ.I $2C068 $1FILESZ.I $1FILESZ.1 $1FILESZ.2 $1FILES -U DOSCAN.S ERA DOSCAN.S $2CP68 -I 0$1 ERRNO.C $1ERRNO.I $2C068 $1ERRNO.I $1ERRNO.1 $1ERRNO.2 $1ERRNO.3 -F ERA $1ERRNO.I C168 $1FGETC.1 $1FGETC.2 FGETC.S ERA $1FGETC.1 ERA $1FGETC.2 $2AS68 -S 0$1 -F $1 -L -U FGETC.S ERA FGETC.S $2CP68 -I 0$1 T.1 ERA $1DOPRT.2 $2AS68 -S 0$1 -F $1 -L -U DOPRT.S ERA DOPRT.S $2CP68 -I 0$1 DOPRTFP.C $1DOPRTFP.I $2C068 $1DOPRTFP.I $1PEN.I $1FDOPEN.1 $1FDOPEN.2 $1FDOPEN.3 -F ERA $1FDOPEN.I $2C168 $1FDOPEN.1 $1FDOPEN.2 FDOPEN.S ERA $1FDOPEN.1 ERA $1FDOPEN.2T.S $2CP68 -I 0$1 FCLOSE.C $1FCLOSE.I $2C068 $1FCLOSE.I $1FCLOSE.1 $1FCLOSE.2 $1FCLOSE.3 -F ERA $1FCLOSE.I $2C168 $1FCLOSEZ.3 -F ERA $1FILESZ.I $2C168 $1FILESZ.1 $1FILESZ.2 FILESZ.S ERA $1FILESZ.1 ERA $1FILESZ.2 $2AS68 -S 0$1 -F $1 -L -U FILESZ. $2C168 $1ERRNO.1 $1ERRNO.2 ERRNO.S ERA $1ERRNO.1 ERA $1ERRNO.2 $2AS68 -S 0$1 -F $1 -L -U ERRNO.S ERA ERRNO.S $2CP68 -I 0FGETS.C $1FGETS.I $2C068 $1FGETS.I $1FGETS.1 $1FGETS.2 $1FGETS.3 -F ERA $1FGETS.I $2C168 $1FGETS.1 $1FGETS.2 FGETS.S ERA $1FDOPRTFP.1 $1DOPRTFP.2 $1DOPRTFP.3 -F ERA $1DOPRTFP.I $2C168 $1DOPRTFP.1 $1DOPRTFP.2 DOPRTFP.S ERA $1DOPRTFP.1 ERA $1DOPRTFP. $2AS68 -S 0$1 -F $1 -L -U FDOPEN.S ERA FDOPEN.S $2CP68 -I 0$1 FFLUSH.C $1FFLUSH.I $2C068 $1FFLUSH.I $1FFLUSH.1 $1FFLUSH.2.1 $1FCLOSE.2 FCLOSE.S ERA $1FCLOSE.1 ERA $1FCLOSE.2 $2AS68 -S 0$1 -F $1 -L -U FCLOSE.S ERA FCLOSE.S $2CP68 -I 0$1 FDECLSS ERA FILESZ.S $2CP68 -I 0$1 FLSBUF.C $1FLSBUF.I $2C068 $1FLSBUF.I $1FLSBUF.1 $1FLSBUF.2 $1FLSBUF.3 -F ERA $1FLSBUF.I $2C$1 EXEC.C $1EXEC.I $2C068 $1EXEC.I $1EXEC.1 $1EXEC.2 $1EXEC.3 -F ERA $1EXEC.I $2C168 $1EXEC.1 $1EXEC.2 EXEC.S ERA $1EXEC.1 GETS.1 ERA $1FGETS.2 $2AS68 -S 0$1 -F $1 -L -U FGETS.S ERA FGETS.S $2CP68 -I 0$1 FILBUF.C $1FILBUF.I $2C068 $1FILBUF.I $12 $2AS68 -S 0$1 -F $1 -L -U DOPRTFP.S ERA DOPRTFP.S $2CP68 -I 0$1 DOSCAN.C $1DOSCAN.I $2C068 $1DOSCAN.I $1DOSCAN.1 $1DOSCA $1FFLUSH.3 -F ERA $1FFLUSH.I $2C168 $1FFLUSH.1 $1FFLUSH.2 FFLUSH.S ERA $1FFLUSH.1 ERA $1FFLUSH.2 $2AS68 -S 0$1 -F $1 -L -U168 $1FLSBUF.1 $1FLSBUF.2 FLSBUF.S ERA $1FLSBUF.1 ERA $1FLSBUF.2 $2AS68 -S 0$1 -F $1 -L -U FLSBUF.S ERA FLSBUF.S $2CP68 -$1 FTELL.C $1FTELL.I $2C068 $1FTELL.I $1FTELL.1 $1FTELL.2 $1FTELL.3 -F ERA $1FTELL.I $2C168 $1FTELL.1 $1FTELL.2 FTELL.S ERA -S 0$1 -F $1 -L -U FREAD.S ERA FREAD.S $2CP68 -I 0$1 FREOPEN.C $1FREOPEN.I $2C068 $1FREOPEN.I $1FREOPEN.1 $1FREOPEN.2 $1FRE $1GETS.1 $1GETS.2 $1GETS.3 -F ERA $1GETS.I $2C168 $1GETS.1 $1GETS.2 GETS.S ERA $1GETS.1 ERA $1GETS.2 $2AS68 -S 0$1 -F $1 -FPUTN.I $2C168 $1FPUTN.1 $1FPUTN.2 FPUTN.S ERA $1FPUTN.1 ERA $1FPUTN.2 $2AS68 -S 0$1 -F $1 -L -U FPUTN.S ERA FPUTN.S $2C -I 0$1 GETPASS.C $1GETPASS.I $2C068 $1GETPASS.I $1GETPASS.1 $1GETPASS.2 $1GETPASS.3 -F ERA $1GETPASS.I $2C168 $1GETPASS.1 $1I 0$1 FOPEN.C $1FOPEN.I $2C068 $1FOPEN.I $1FOPEN.1 $1FOPEN.2 $1FOPEN.3 -F ERA $1FOPEN.I $2C168 $1FOPEN.1 $1FOPEN.2 FOPEN.S E$1FTELL.1 ERA $1FTELL.2 $2AS68 -S 0$1 -F $1 -L -U FTELL.S ERA FTELL.S $2CP68 -I 0$1 FWRITE.C $1FWRITE.I $2C068 $1FWRITE.IOPEN.3 -F ERA $1FREOPEN.I $2C168 $1FREOPEN.1 $1FREOPEN.2 FREOPEN.S ERA $1FREOPEN.1 ERA $1FREOPEN.2 $2AS68 -S 0$1 -F $1 -L -L -U GETS.S ERA GETS.S $2CP68 -I 0$1 GETW.C $1GETW.I $2C068 $1GETW.I $1GETW.1 $1GETW.2 $1GETW.3 -F ERA $1GETW.I $2C168 $1P68 -I 0$1 FPUTS.C $1FPUTS.I $2C068 $1FPUTS.I $1FPUTS.1 $1FPUTS.2 $1FPUTS.3 -F ERA $1FPUTS.I $2C168 $1FPUTS.1 $1FPUTS.2 FPUTSGETPASS.2 GETPASS.S ERA $1GETPASS.1 ERA $1GETPASS.2 $2AS68 -S 0$1 -F $1 -L -U GETPASS.S ERA GETPASS.S $2CP68 -I 0$1 GETPIRA $1FOPEN.1 ERA $1FOPEN.2 $2AS68 -S 0$1 -F $1 -L -U FOPEN.S ERA FOPEN.S $2CP68 -I 0$1 FPUTC.C $1FPUTC.I $2C068 $1FPUTC.I $1FWRITE.1 $1FWRITE.2 $1FWRITE.3 -F ERA $1FWRITE.I $2C168 $1FWRITE.1 $1FWRITE.2 FWRITE.S ERA $1FWRITE.1 ERA $1FWRITE.2 $2AU FREOPEN.S ERA FREOPEN.S $2CP68 -I 0$1 FSEEK.C $1FSEEK.I $2C068 $1FSEEK.I $1FSEEK.1 $1FSEEK.2 $1FSEEK.3 -F ERA $1FSEEK.I GETW.1 $1GETW.2 GETW.S ERA $1GETW.1 ERA $1GETW.2 $2AS68 -S 0$1 -F $1 -L -U GETW.S ERA GETW.S $2CP68 -I 0$1 INDEX.C $1INDE.S ERA $1FPUTS.1 ERA $1FPUTS.2 $2AS68 -S 0$1 -F $1 -L -U FPUTS.S ERA FPUTS.S $2CP68 -I 0$1 FREAD.C $1FREAD.I $2C068 $1FRD.C $1GETPID.I $2C068 $1GETPID.I $1GETPID.1 $1GETPID.2 $1GETPID.3 -F ERA $1GETPID.I $2C168 $1GETPID.1 $1GETPID.2 GETPID.S ER $1FPUTC.1 $1FPUTC.2 $1FPUTC.3 -F ERA $1FPUTC.I $2C168 $1FPUTC.1 $1FPUTC.2 FPUTC.S ERA $1FPUTC.1 ERA $1FPUTC.2 $2AS68 -S 0$S68 -S 0$1 -F $1 -L -U FWRITE.S ERA FWRITE.S $2CP68 -I 0$1 GETL.C $1GETL.I $2C068 $1GETL.I $1GETL.1 $1GETL.2 $1GETL.3 -F E $2C168 $1FSEEK.1 $1FSEEK.2 FSEEK.S ERA $1FSEEK.1 ERA $1FSEEK.2 $2AS68 -S 0$1 -F $1 -L -U FSEEK.S ERA FSEEK.S $2CP68 -I 0X.I $2C068 $1INDEX.I $1INDEX.1 $1INDEX.2 $1INDEX.3 -F ERA $1INDEX.I $2C168 $1INDEX.1 $1INDEX.2 INDEX.S ERA $1INDEX.1 ERA $1EAD.I $1FREAD.1 $1FREAD.2 $1FREAD.3 -F ERA $1FREAD.I $2C168 $1FREAD.1 $1FREAD.2 FREAD.S ERA $1FREAD.1 ERA $1FREAD.2 $2AS68 A $1GETPID.1 ERA $1GETPID.2 $2AS68 -S 0$1 -F $1 -L -U GETPID.S ERA GETPID.S $2CP68 -I 0$1 GETS.C $1GETS.I $2C068 $1GETS.I1 -F $1 -L -U FPUTC.S ERA FPUTC.S $2CP68 -I 0$1 FPUTN.C $1FPUTN.I $2C068 $1FPUTN.I $1FPUTN.1 $1FPUTN.2 $1FPUTN.3 -F ERA $1RA $1GETL.I $2C168 $1GETL.1 $1GETL.2 GETL.S ERA $1GETL.1 ERA $1GETL.2 $2AS68 -S 0$1 -F $1 -L -U GETL.S ERA GETL.S $2CP68INDEX.2 $2AS68 -S 0$1 -F $1 -L -U INDEX.S ERA INDEX.S $2CP68 -I 0$1 ISATTY.C $1ISATTY.I $2C068 $1ISATTY.I $1ISATTY.1 $1ISAEN.C $1OPEN.I $2C068 $1OPEN.I $1OPEN.1 $1OPEN.2 $1OPEN.3 -F ERA $1OPEN.I $2C168 $1OPEN.1 $1OPEN.2 OPEN.S ERA $1OPEN.1 ERA $LLOC.S $2CP68 -I 0$1 MALLOCND.C $1MALLOCND.I $2C068 $1MALLOCND.I $1MALLOCND.1 $1MALLOCND.2 $1MALLOCND.3 -F ERA $1MALLOCND.IC068 $1PRINTF.I $1PRINTF.1 $1PRINTF.2 $1PRINTF.3 -F ERA $1PRINTF.I $2C168 $1PRINTF.1 $1PRINTF.2 PRINTF.S ERA $1PRINTF.1 ERA TOUT.S ERA $1LSTOUT.1 ERA $1LSTOUT.2 $2AS68 -S 0$1 -F $1 -L -U LSTOUT.S ERA LSTOUT.S $2CP68 -I 0$1 MAIN.C $1MAIN.I $2C06 $2CP68 -I 0$1 PARSEFN.C $1PARSEFN.I $2C068 $1PARSEFN.I $1PARSEFN.1 $1PARSEFN.2 $1PARSEFN.3 -F ERA $1PARSEFN.I $2C168 $1PARTTY.2 $1ISATTY.3 -F ERA $1ISATTY.I $2C168 $1ISATTY.1 $1ISATTY.2 ISATTY.S ERA $1ISATTY.1 ERA $1ISATTY.2 $2AS68 -S 0$1 -F $1 1OPEN.2 $2AS68 -S 0$1 -F $1 -L -U OPEN.S ERA OPEN.S $2CP68 -I 0$1 OPTOFF.C $1OPTOFF.I $2C068 $1OPTOFF.I $1OPTOFF.1 $1OPTOF $2C168 $1MALLOCND.1 $1MALLOCND.2 MALLOCND.S ERA $1MALLOCND.1 ERA $1MALLOCND.2 $2AS68 -S 0$1 -F $1 -L -U MALLOCND.S ERA MAL$1PRINTF.2 $2AS68 -S 0$1 -F $1 -L -U PRINTF.S ERA PRINTF.S $2CP68 -I 0$1 PRTINT.C $1PRTINT.I $2C068 $1PRTINT.I $1PRTINT.1 8 $1MAIN.I $1MAIN.1 $1MAIN.2 $1MAIN.3 -F ERA $1MAIN.I $2C168 $1MAIN.1 $1MAIN.2 MAIN.S ERA $1MAIN.1 ERA $1MAIN.2 $2AS68 -S 0SEFN.1 $1PARSEFN.2 PARSEFN.S ERA $1PARSEFN.1 ERA $1PARSEFN.2 $2AS68 -S 0$1 -F $1 -L -U PARSEFN.S ERA PARSEFN.S $2CP68 -I -L -U ISATTY.S ERA ISATTY.S $2CP68 -I 0$1 LSEEK.C $1LSEEK.I $2C068 $1LSEEK.I $1LSEEK.1 $1LSEEK.2 $1LSEEK.3 -F ERA $1LSEEK.F.2 $1OPTOFF.3 -F ERA $1OPTOFF.I $2C168 $1OPTOFF.1 $1OPTOFF.2 OPTOFF.S ERA $1OPTOFF.1 ERA $1OPTOFF.2 $2AS68 -S 0$1 -F $1 -LLOCND.S $2CP68 -I 0$1 MKTEMP.C $1MKTEMP.I $2C068 $1MKTEMP.I $1MKTEMP.1 $1MKTEMP.2 $1MKTEMP.3 -F ERA $1MKTEMP.I $2C168 $1MK$1PRTINT.2 $1PRTINT.3 -F ERA $1PRTINT.I $2C168 $1PRTINT.1 $1PRTINT.2 PRTINT.S ERA $1PRTINT.1 ERA $1PRTINT.2 $2AS68 -S 0$1 -$1 -F $1 -L -U MAIN.S ERA MAIN.S $2CP68 -I 0$1 MALLOC.C $1MALLOC.I $2C068 $1MALLOC.I $1MALLOC.1 $1MALLOC.2 $1MALLOC.3 -F E0$1 PERROR.C $1PERROR.I $2C068 $1PERROR.I $1PERROR.1 $1PERROR.2 $1PERROR.3 -F ERA $1PERROR.I $2C168 $1PERROR.1 $1PERROR.2 PERI $2C168 $1LSEEK.1 $1LSEEK.2 LSEEK.S ERA $1LSEEK.1 ERA $1LSEEK.2 $2AS68 -S 0$1 -F $1 -L -U LSEEK.S ERA LSEEK.S $2CP68 -I -U OPTOFF.S ERA OPTOFF.S $2CP68 -I 0$1 OSATTR.C $1OSATTR.I $2C068 $1OSATTR.I $1OSATTR.1 $1OSATTR.2 $1OSATTR.3 -F ERA $1OSTEMP.1 $1MKTEMP.2 MKTEMP.S ERA $1MKTEMP.1 ERA $1MKTEMP.2 $2AS68 -S 0$1 -F $1 -L -U MKTEMP.S ERA MKTEMP.S $2CP68 -I 0$1 OPF $1 -L -U PRTINT.S ERA PRTINT.S $2CP68 -I 0$1 PRTLD.C $1PRTLD.I $2C068 $1PRTLD.I $1PRTLD.1 $1PRTLD.2 $1PRTLD.3 -F ERA $1PRA $1MALLOC.I $2C168 $1MALLOC.1 $1MALLOC.2 MALLOC.S ERA $1MALLOC.1 ERA $1MALLOC.2 $2AS68 -S 0$1 -F $1 -L -U MALLOC.S ERA MAROR.S ERA $1PERROR.1 ERA $1PERROR.2 $2AS68 -S 0$1 -F $1 -L -U PERROR.S ERA PERROR.S $2CP68 -I 0$1 PRINTF.C $1PRINTF.I $2 0$1 LSTOUT.C $1LSTOUT.I $2C068 $1LSTOUT.I $1LSTOUT.1 $1LSTOUT.2 $1LSTOUT.3 -F ERA $1LSTOUT.I $2C168 $1LSTOUT.1 $1LSTOUT.2 LSATTR.I $2C168 $1OSATTR.1 $1OSATTR.2 OSATTR.S ERA $1OSATTR.1 ERA $1OSATTR.2 $2AS68 -S 0$1 -F $1 -L -U OSATTR.S ERA OSATTR.S RTLD.I $2C168 $1PRTLD.1 $1PRTLD.2 PRTLD.S ERA $1PRTLD.1 ERA $1PRTLD.2 $2AS68 -S 0$1 -F $1 -L -U PRTLD.S ERA PRTLD.S $2CPSC.1 $1READASC.2 $1READASC.3 -F ERA $1READASC.I $2C168 $1READASC.1 $1READASC.2 READASC.S ERA $1READASC.1 ERA $1READASC.2 $2S68 -S 0$1 -F $1 -L -U QSORT.S ERA QSORT.S $2CP68 -I 0$1 RAND.C $1RAND.I $2C068 $1RAND.I $1RAND.1 $1RAND.2 $1RAND.3 -F ERA$1SBRK.2 $1SBRK.3 -F ERA $1SBRK.I $2C168 $1SBRK.1 $1SBRK.2 SBRK.S ERA $1SBRK.1 ERA $1SBRK.2 $2AS68 -S 0$1 -F $1 -L -U SBRK.PUTS.2 $1PUTS.3 -F ERA $1PUTS.I $2C168 $1PUTS.1 $1PUTS.2 PUTS.S ERA $1PUTS.1 ERA $1PUTS.2 $2AS68 -S 0$1 -F $1 -L -U PUTS.S CP68 -I 0$1 RENAME.C $1RENAME.I $2C068 $1RENAME.I $1RENAME.1 $1RENAME.2 $1RENAME.3 -F ERA $1RENAME.I $2C168 $1RENAME.1 $1RENA68 -I 0$1 PRTSHORT.C $1PRTSHORT.I $2C068 $1PRTSHORT.I $1PRTSHORT.1 $1PRTSHORT.2 $1PRTSHORT.3 -F ERA $1PRTSHORT.I $2C168 $1PRTAS68 -S 0$1 -F $1 -L -U READASC.S ERA READASC.S $2CP68 -I 0$1 READBIN.C $1READBIN.I $2C068 $1READBIN.I $1READBIN.1 $1READBI $1RAND.I $2C168 $1RAND.1 $1RAND.2 RAND.S ERA $1RAND.1 ERA $1RAND.2 $2AS68 -S 0$1 -F $1 -L -U RAND.S ERA RAND.S $2CP68 -S ERA SBRK.S $2CP68 -I 0$1 SCANF.C $1SCANF.I $2C068 $1SCANF.I $1SCANF.1 $1SCANF.2 $1SCANF.3 -F ERA $1SCANF.I $2C168 $1SCA ERA PUTS.S $2CP68 -I 0$1 PUTW.C $1PUTW.I $2C068 $1PUTW.I $1PUTW.1 $1PUTW.2 $1PUTW.3 -F ERA $1PUTW.I $2C168 $1PUTW.1 $1PUTME.2 RENAME.S ERA $1RENAME.1 ERA $1RENAME.2 $2AS68 -S 0$1 -F $1 -L -U RENAME.S ERA RENAME.S $2CP68 -I 0$1 RINDEX.C $1RINDSHORT.1 $1PRTSHORT.2 PRTSHORT.S ERA $1PRTSHORT.1 ERA $1PRTSHORT.2 $2AS68 -S 0$1 -F $1 -L -U PRTSHORT.S ERA PRTSHORT.S $2CN.2 $1READBIN.3 -F ERA $1READBIN.I $2C168 $1READBIN.1 $1READBIN.2 READBIN.S ERA $1READBIN.1 ERA $1READBIN.2 $2AS68 -S 0$1 -I 0$1 READ.C $1READ.I $2C068 $1READ.I $1READ.1 $1READ.2 $1READ.3 -F ERA $1READ.I $2C168 $1READ.1 $1READ.2 READ.S ERA $1READ.NF.1 $1SCANF.2 SCANF.S ERA $1SCANF.1 ERA $1SCANF.2 $2AS68 -S 0$1 -F $1 -L -U SCANF.S ERA SCANF.S $2CP68 -I 0$1 SETBUF.C $W.2 PUTW.S ERA $1PUTW.1 ERA $1PUTW.2 $2AS68 -S 0$1 -F $1 -L -U PUTW.S ERA PUTW.S $2CP68 -I 0$1 QSORT.C $1QSORT.I $2C068 EX.I $2C068 $1RINDEX.I $1RINDEX.1 $1RINDEX.2 $1RINDEX.3 -F ERA $1RINDEX.I $2C168 $1RINDEX.1 $1RINDEX.2 RINDEX.S ERA $1RINDEXP68 -I 0$1 PUTL.C $1PUTL.I $2C068 $1PUTL.I $1PUTL.1 $1PUTL.2 $1PUTL.3 -F ERA $1PUTL.I $2C168 $1PUTL.1 $1PUTL.2 PUTL.S ERA $1F $1 -L -U READBIN.S ERA READBIN.S $2CP68 -I 0$1 READL.C $1READL.I $2C068 $1READL.I $1READL.1 $1READL.2 $1READL.3 -F ERA $1 ERA $1READ.2 $2AS68 -S 0$1 -F $1 -L -U READ.S ERA READ.S $2CP68 -I 0$1 READASC.C $1READASC.I $2C068 $1READASC.I $1READA1SETBUF.I $2C068 $1SETBUF.I $1SETBUF.1 $1SETBUF.2 $1SETBUF.3 -F ERA $1SETBUF.I $2C168 $1SETBUF.1 $1SETBUF.2 SETBUF.S ERA $1S$1QSORT.I $1QSORT.1 $1QSORT.2 $1QSORT.3 -F ERA $1QSORT.I $2C168 $1QSORT.1 $1QSORT.2 QSORT.S ERA $1QSORT.1 ERA $1QSORT.2 $2A.1 ERA $1RINDEX.2 $2AS68 -S 0$1 -F $1 -L -U RINDEX.S ERA RINDEX.S $2CP68 -I 0$1 SBRK.C $1SBRK.I $2C068 $1SBRK.I $1SBRK.1 PUTL.1 ERA $1PUTL.2 $2AS68 -S 0$1 -F $1 -L -U PUTL.S ERA PUTL.S $2CP68 -I 0$1 PUTS.C $1PUTS.I $2C068 $1PUTS.I $1PUTS.1 $11READL.I $2C168 $1READL.1 $1READL.2 READL.S ERA $1READL.1 ERA $1READL.2 $2AS68 -S 0$1 -F $1 -L -U READL.S ERA READL.S $2ETBUF.1 ERA $1SETBUF.2 $2AS68 -S 0$1 -F $1 -L -U SETBUF.S ERA SETBUF.S $2CP68 -I 0$1 SGTTY.C $1SGTTY.I $2C068 $1SGTTY.I $ERA STRCPY.S $2CP68 -I 0$1 STRLEN.C $1STRLEN.I $2C068 $1STRLEN.I $1STRLEN.1 $1STRLEN.2 $1STRLEN.3 -F ERA $1STRLEN.I $2C168 ERA $1STRCHR.2 $2AS68 -S 0$1 -F $1 -L -U STRCHR.S ERA STRCHR.S $2CP68 -I 0$1 STRCMP.C $1STRCMP.I $2C068 $1STRCMP.I $1STRSTRRCHR.2 $2AS68 -S 0$1 -F $1 -L -U STRRCHR.S ERA STRRCHR.S $2CP68 -I 0$1 SWAB.C $1SWAB.I $2C068 $1SWAB.I $1SWAB.1 $1SWAB. $2C168 $1SSCANF.1 $1SSCANF.2 SSCANF.S ERA $1SSCANF.1 ERA $1SSCANF.2 $2AS68 -S 0$1 -F $1 -L -U SSCANF.S ERA SSCANF.S $2CPS ERA $1STRNCMP.1 ERA $1STRNCMP.2 $2AS68 -S 0$1 -F $1 -L -U STRNCMP.S ERA STRNCMP.S $2CP68 -I 0$1 STRNCPY.C $1STRNCPY.I 1SGTTY.1 $1SGTTY.2 $1SGTTY.3 -F ERA $1SGTTY.I $2C168 $1SGTTY.1 $1SGTTY.2 SGTTY.S ERA $1SGTTY.1 ERA $1SGTTY.2 $2AS68 -S 0$1 $1STRLEN.1 $1STRLEN.2 STRLEN.S ERA $1STRLEN.1 ERA $1STRLEN.2 $2AS68 -S 0$1 -F $1 -L -U STRLEN.S ERA STRLEN.S $2CP68 -I 0CMP.1 $1STRCMP.2 $1STRCMP.3 -F ERA $1STRCMP.I $2C168 $1STRCMP.1 $1STRCMP.2 STRCMP.S ERA $1STRCMP.1 ERA $1STRCMP.2 $2AS68 -S2 $1SWAB.3 -F ERA $1SWAB.I $2C168 $1SWAB.1 $1SWAB.2 SWAB.S ERA $1SWAB.1 ERA $1SWAB.2 $2AS68 -S 0$1 -F $1 -L -U SWAB.S ERA 68 -I 0$1 STRCAT.C $1STRCAT.I $2C068 $1STRCAT.I $1STRCAT.1 $1STRCAT.2 $1STRCAT.3 -F ERA $1STRCAT.I $2C168 $1STRCAT.1 $1STRCAT$2C068 $1STRNCPY.I $1STRNCPY.1 $1STRNCPY.2 $1STRNCPY.3 -F ERA $1STRNCPY.I $2C168 $1STRNCPY.1 $1STRNCPY.2 STRNCPY.S ERA $1STRN-F $1 -L -U SGTTY.S ERA SGTTY.S $2CP68 -I 0$1 SPRINTF.C $1SPRINTF.I $2C068 $1SPRINTF.I $1SPRINTF.1 $1SPRINTF.2 $1SPRINTF.3 $1 STRNCAT.C $1STRNCAT.I $2C068 $1STRNCAT.I $1STRNCAT.1 $1STRNCAT.2 $1STRNCAT.3 -F ERA $1STRNCAT.I $2C168 $1STRNCAT.1 $1STRNC 0$1 -F $1 -L -U STRCMP.S ERA STRCMP.S $2CP68 -I 0$1 STRCPY.C $1STRCPY.I $2C068 $1STRCPY.I $1STRCPY.1 $1STRCPY.2 $1STRCPY.3SWAB.S $2CP68 -I 0$1 TTYIN.C $1TTYIN.I $2C068 $1TTYIN.I $1TTYIN.1 $1TTYIN.2 $1TTYIN.3 -F ERA $1TTYIN.I $2C168 $1TTYIN.1 $1.2 STRCAT.S ERA $1STRCAT.1 ERA $1STRCAT.2 $2AS68 -S 0$1 -F $1 -L -U STRCAT.S ERA STRCAT.S $2CP68 -I 0$1 STRCHR.C $1STRCHRCPY.1 ERA $1STRNCPY.2 $2AS68 -S 0$1 -F $1 -L -U STRNCPY.S ERA STRNCPY.S $2CP68 -I 0$1 STRRCHR.C $1STRRCHR.I $2C068 $1STRR-F ERA $1SPRINTF.I $2C168 $1SPRINTF.1 $1SPRINTF.2 SPRINTF.S ERA $1SPRINTF.1 ERA $1SPRINTF.2 $2AS68 -S 0$1 -F $1 -L -U SPRINAT.2 STRNCAT.S ERA $1STRNCAT.1 ERA $1STRNCAT.2 $2AS68 -S 0$1 -F $1 -L -U STRNCAT.S ERA STRNCAT.S $2CP68 -I 0$1 STRNCMP.C -F ERA $1STRCPY.I $2C168 $1STRCPY.1 $1STRCPY.2 STRCPY.S ERA $1STRCPY.1 ERA $1STRCPY.2 $2AS68 -S 0$1 -F $1 -L -U STRCPY.S TTYIN.2 TTYIN.S ERA $1TTYIN.1 ERA $1TTYIN.2 $2AS68 -S 0$1 -F $1 -L -U TTYIN.S ERA TTYIN.S $2CP68 -I 0$1 TTYINRAW.C $1TTYI.I $2C068 $1STRCHR.I $1STRCHR.1 $1STRCHR.2 $1STRCHR.3 -F ERA $1STRCHR.I $2C168 $1STRCHR.1 $1STRCHR.2 STRCHR.S ERA $1STRCHR.1CHR.I $1STRRCHR.1 $1STRRCHR.2 $1STRRCHR.3 -F ERA $1STRRCHR.I $2C168 $1STRRCHR.1 $1STRRCHR.2 STRRCHR.S ERA $1STRRCHR.1 ERA $1TF.S ERA SPRINTF.S $2CP68 -I 0$1 SSCANF.C $1SSCANF.I $2C068 $1SSCANF.I $1SSCANF.1 $1SSCANF.2 $1SSCANF.3 -F ERA $1SSCANF.I $1STRNCMP.I $2C068 $1STRNCMP.I $1STRNCMP.1 $1STRNCMP.2 $1STRNCMP.3 -F ERA $1STRNCMP.I $2C168 $1STRNCMP.1 $1STRNCMP.2 STRNCMP.NRAW.I $2C068 $1TTYINRAW.I $1TTYINRAW.1 $1TTYINRAW.2 $1TTYINRAW.3 -F ERA $1TTYINRAW.I $2C168 $1TTYINRAW.1 $1TTYINRAW.2 TTYINR $1WRITEL.I $2C068 $1WRITEL.I $1WRITEL.1 $1WRITEL.2 $1WRITEL.3 -F ERA $1WRITEL.I $2C168 $1WRITEL.1 $1WRITEL.2 WRITEL.S ERA $ $1WRITEASC.I $2C068 $1WRITEASC.I $1WRITEASC.1 $1WRITEASC.2 $1WRITEASC.3 -F ERA $1WRITEASC.I $2C168 $1WRITEASC.1 $1WRITEASC.2STRCMP.2 $1XSTRCMP.3 -F ERA $1XSTRCMP.I $2C168 $1XSTRCMP.1 $1XSTRCMP.2 XSTRCMP.S ERA $1XSTRCMP.1 ERA $1XSTRCMP.2 $2AS68 -S S 0$1 -F $1 -L -U UNGETC.S ERA UNGETC.S $2CP68 -I 0$1 UNLINK.C $1UNLINK.I $2C068 $1UNLINK.I $1UNLINK.1 $1UNLINK.2 $1UNLINK.XATOF.S $2CP68 -I 0$1 XMAIN.C $1XMAIN.I $2C068 $1XMAIN.I $1XMAIN.1 $1XMAIN.2 $1XMAIN.3 -F ERA $1XMAIN.I $2C168 $1XMAIN.1 $AW.S ERA $1TTYINRAW.1 ERA $1TTYINRAW.2 $2AS68 -S 0$1 -F $1 -L -U TTYINRAW.S ERA TTYINRAW.S $2CP68 -I 0$1 TTYOUT.C $1TTYOU1WRITEL.1 ERA $1WRITEL.2 $2AS68 -S 0$1 -F $1 -L -U WRITEL.S ERA WRITEL.S $2CP68 -I 0$1 WRTCHR.C $1WRTCHR.I $2C068 $1WRTCH WRITEASC.S ERA $1WRITEASC.1 ERA $1WRITEASC.2 $2AS68 -S 0$1 -F $1 -L -U WRITEASC.S ERA WRITEASC.S $2CP68 -I 0$1 WRITEBIN.0$1 -F $1 -L -U XSTRCMP.S ERA XSTRCMP.S $2CP68 -I 0$1 YESFLOAT.C $1YESFLOAT.I $2C068 $1YESFLOAT.I $1YESFLOAT.1 $1YESFLOAT.23 -F ERA $1UNLINK.I $2C168 $1UNLINK.1 $1UNLINK.2 UNLINK.S ERA $1UNLINK.1 ERA $1UNLINK.2 $2AS68 -S 0$1 -F $1 -L -U UNLINK.S 1XMAIN.2 XMAIN.S ERA $1XMAIN.1 ERA $1XMAIN.2 $2AS68 -S 0$1 -F $1 -L -U XMAIN.S ERA XMAIN.S $2CP68 -I 0$1 XOPEN.C $1XOPEN.T.I $2C068 $1TTYOUT.I $1TTYOUT.1 $1TTYOUT.2 $1TTYOUT.3 -F ERA $1TTYOUT.I $2C168 $1TTYOUT.1 $1TTYOUT.2 TTYOUT.S ERA $1TTYOUT.R.I $1WRTCHR.1 $1WRTCHR.2 $1WRTCHR.3 -F ERA $1WRTCHR.I $2C168 $1WRTCHR.1 $1WRTCHR.2 WRTCHR.S ERA $1WRTCHR.1 ERA $1WRTCHR.2 C $1WRITEBIN.I $2C068 $1WRITEBIN.I $1WRITEBIN.1 $1WRITEBIN.2 $1WRITEBIN.3 -F ERA $1WRITEBIN.I $2C168 $1WRITEBIN.1 $1WRITEBIN. $1YESFLOAT.3 -F ERA $1YESFLOAT.I $2C168 $1YESFLOAT.1 $1YESFLOAT.2 YESFLOAT.S ERA $1YESFLOAT.1 ERA $1YESFLOAT.2 $2AS68 -S 0 ERA UNLINK.S $2CP68 -I 0$1 WRITE.C $1WRITE.I $2C068 $1WRITE.I $1WRITE.1 $1WRITE.2 $1WRITE.3 -F ERA $1WRITE.I $2C168 $1WRII $2C068 $1XOPEN.I $1XOPEN.1 $1XOPEN.2 $1XOPEN.3 -F ERA $1XOPEN.I $2C168 $1XOPEN.1 $1XOPEN.2 XOPEN.S ERA $1XOPEN.1 ERA $1XO1 ERA $1TTYOUT.2 $2AS68 -S 0$1 -F $1 -L -U TTYOUT.S ERA TTYOUT.S $2CP68 -I 0$1 UNGETC.C $1UNGETC.I $2C068 $1UNGETC.I $1UN$2AS68 -S 0$1 -F $1 -L -U WRTCHR.S ERA WRTCHR.S $2CP68 -I 0$1 XATOF.C $1XATOF.I $2C068 $1XATOF.I $1XATOF.1 $1XATOF.2 $1XATO2 WRITEBIN.S ERA $1WRITEBIN.1 ERA $1WRITEBIN.2 $2AS68 -S 0$1 -F $1 -L -U WRITEBIN.S ERA WRITEBIN.S $2CP68 -I 0$1 WRITEL.C$1 -F $1 -L -U YESFLOAT.S ERA YESFLOAT.S $2CP68 -I 0$1 YESSTART.C $1YESSTART.I $2C068 $1YESSTART.I $1YESSTART.1 $1YESSTART.TE.1 $1WRITE.2 WRITE.S ERA $1WRITE.1 ERA $1WRITE.2 $2AS68 -S 0$1 -F $1 -L -U WRITE.S ERA WRITE.S $2CP68 -I 0$1 WRITEASC.CPEN.2 $2AS68 -S 0$1 -F $1 -L -U XOPEN.S ERA XOPEN.S $2CP68 -I 0$1 XSTRCMP.C $1XSTRCMP.I $2C068 $1XSTRCMP.I $1XSTRCMP.1 $1XGETC.1 $1UNGETC.2 $1UNGETC.3 -F ERA $1UNGETC.I $2C168 $1UNGETC.1 $1UNGETC.2 UNGETC.S ERA $1UNGETC.1 ERA $1UNGETC.2 $2AS68 -F.3 -F ERA $1XATOF.I $2C168 $1XATOF.1 $1XATOF.2 XATOF.S ERA $1XATOF.1 ERA $1XATOF.2 $2AS68 -S 0$1 -F $1 -L -U XATOF.S ERA 2 $1YESSTART.3 -F ERA $1YESSTART.I $2C168 $1YESSTART.1 $1YESSTART.2 YESSTART.S ERA $1YESSTART.1 ERA $1YESSTART.2 $2AS68 -S ------- * Copyright 1983 by Digital Reserach Inc. All rights reserved. * * "stty(fd,argp)" sets the bits for CON: file openeeturn 0; }  ERA SIGNAL.S ;;;;;;; ;;;;;;; REAR $1 $2  (fp=_chkc(fd)) == NULLFD || (fp->flags & ISTTY) == 0 ) return -1; blkmove(argp,&(fp->fcb),sizeof(*argp)); /* no ch0$1 -F $1 -L -U YESSTART.S ERA YESSTART.S $2CP68 -I 0$1 SIGNAL.C $1SIGNAL.I $2C068 $1SIGNAL.I $1SIGNAL.1 $1SIGNAL.2 $1SIGNAd on 'fd' * "gtty(fd,argp)" gets the bits for CON: file opened on 'fd' * * Where: * fd = file descriptor returned by 'openturn 0; } ecks: do whatever */ return 0; } VOID gtty(fd,argp) /* CLEAR FUNCTION ***********/ WORD fd; /* opened file dL.3 -F ERA $1SIGNAL.I $2C168 $1SIGNAL.1 $1SIGNAL.2 SIGNAL.S ERA $1SIGNAL.1 ERA $1SIGNAL.2 $2AS68 -S 0$1 -F $1 -L -U SIGNAL.' * argp pts to struct 'sgttyb' (see "sgtty.h") * **************************************************************************turn 0; } escriptor */ struct sgttyb *argp; /* ptr to control info */ { REG FD *fp; FD *_chkc(); if( (fp=_chkc(fd)) == NULLFS ERA SIGNAL.S ;;;;;;; ;;;;;;; REAR $1 $2 / #include "portab.h" #include "osif.h" #include "sgtty.h" VOID stty(fd,argp) /* CLEAR FUNCTION ***********/ WORD /************************************************************************* * * stty / gtty Functions * ----------------D || (fp->flags & ISTTY) == 0 ) return -1; blkmove(&(fp->fcb),argp,sizeof(*argp)); /* no checks: do whatever */ r ERA SIGNAL.S ;;;;;;; ;;;;;;; REAR $1 $2 fd; /* opened file descriptor */ struct sgttyb *argp; /* ptr to control info */ { REG FD *fp; FD *_chkc(); if(inter * fmt -> a string specifying how to parse the input * p1,p2,... -> where matched items get stored * ************************************************** * * f s c a n f F u n c t i o n * ----------------------------- * Copyright 1982 byse Guys ************ illegal = $4AFC .globl _abort .text _abort: move.w 4(sp),d0 a: .dc.w illegal bra.b a * For Wnf(fmt,p1,p2,...) * Where: * ret = the number of items successfully matched & assigned * EOF returned if encountered on in******************************************************************** * * CP/M abort function for C Run Time Library * * "abo*************************************************************/ WORD fscanf(sp,fmt,ptrs) /* CLEAR FUNCTION ***********/ FILE Digital Research Inc. All rights reserved. * * "fscanf" scans the given stream for items specified, and assigns * them to use Guys ************ illegal = $4AFC .globl _abort .text _abort: move.w 4(sp),d0 a: .dc.w illegal bra.b a * For Wput * fmt -> a string specifying how to parse the input * p1,p2,... -> where matched items get stored * ******************rt" generates an Illegal Instruction Trap to recall DDT * (if it is loaded). * **********************************************/************************************************************************** * * s c a n f F u n c t i o n * ----------- *sp; BYTE *fmt; BYTE *ptrs; { return(_doscan(sp,fmt,&ptrs)); } ser supplied variables (via pointers to these vars). * * Calling sequence: * ret = fscanf(sp,fmt,p1,p2,...) * Where: * re***********************************************************/ #include "stdio.h" WORD scanf(fmt,ptrs) /* CLEAR FUNCTION *********************** illegal = $4AFC .globl _abort .text _abort: move.w 4(sp),d0 a: .dc.w illegal bra.b a * For W---------------- * Copyright 1982 by Digital Research Inc. All rights reserved. * * "scanf" scans the standard input for ite*sp; BYTE *fmt; BYTE *ptrs; { return(_doscan(sp,fmt,&ptrs)); } t = the number of items successfully matched & assigned * EOF returned if encountered on input * sp -> (FILE *) stream po***********/ BYTE *fmt; BYTE *ptrs; { return(_doscan(stdin,fmt,&ptrs)); } /****************************************ise Guys ************ illegal = $4AFC .globl _abort .text _abort: move.w 4(sp),d0 a: .dc.w illegal bra.b a * For Wms specified, and assigns * them to user supplied variables (via pointers to these vars). * * Calling sequence: * ret = sca*sp; BYTE *fmt; BYTE *ptrs; { return(_doscan(sp,fmt,&ptrs)); }  /* YESFLOAT: provides 'stubroutines' to satisfy 'nofloat' ref, if the */ /* OPTION?.lib 'nofloat' was not linked in. parsed, * -1 if there was an error, or * a pointer to the next item to parse * fcbp Is the adi o n * --------------------------------- * Copyright 1983 by Digital Research Inc. All rights reserved. m*/ if( fcbp->fname[0] == ' ' ) /* PC-DOS convention for bad*/ return FAILPTR; /* ...filename */ while( isspace(*URE */ BYTE * /****************************/ _parsefn(filnam,fcbp) /* */ REG BYTE *filnam; /* - */ /* This routine belongs in the main RTL lib. */ nofloat() { ; } /* stubroutine 'tag' */ dress of a CP/M File Control Block (fcb). * Note: password will get stuffed into bytes 16-23 * user # (plus 1) i * * Function "_parsefn()" is used to parse a filename into the CP/M fcb. * NOTE: For PCDOS, an OS call is wrretp) ) /* skip trailing white stuff*/ ++retp; /* */ if( *retp == NULL ) /* parsed to EOS? */ return NU> filename */ struct fcbtab *fcbp; /* -> FCB address */ { /****************************/ #if PCDOS */ /* This routine belongs in the main RTL lib. */ nofloat() { ; } /* stubroutine 'tag' */ n byte 24, if supplied in filnam. * File Spec: * #d:filename.typ;passwd * * Modified: itten in assembler ("_pc_parse()"). * * Calling Sequence: * ret = _parsefn(filnam,fcbp); LLPTR; /* yes, say so */ else return retp; /* no, return ptr */ } #endif /*===========================/*================================================================*/ REG BYTE *retp; /* To convert to ret val */ BYTE */ /* This routine belongs in the main RTL lib. */ nofloat() { ; } /* stubroutine 'tag' */  * 1/84 whf handle 68K parsing error. * 3/84 sw Fix off by 1 user # ***************************************************** * * Where: * filnam Is a null-terminated CP/M filename * ret Is NULLPTR if entire string=======================================*/ #if CPM /*==================================================================*/ B/*************************************************************************** * * _ p a r s e f n F u n c t *_pc_parse(); /* Use PC-DOS parse call */ /* */ retp = _pc_parse(filnam,fcbp); /* return 1st char after fna***********************/ #include "portab.h" #include "osif.h" #include "ctype.h" #define FAILPTR ((BYTE *)(-1)) /* FAILYTE tokbuf[32]; /* Token temporary buffer */ BYTE *get_token(); /* Tokenize the file name */ /****************** */ switch(*filnam) /* Check for EOS */ { /* */ case NULL: /* Null terminated */ case '*') /* Is wildcarded ext? */ { /* */ blkfill(&(fcbp->fname[8]),'?',3); /* If yes, fill with ?'s * */ /* ret = get_token(src,dest,len); */ /* */ /* Where: */ /* src is the address of t /****************************/ /* */ if(*filnam == '*') /* Delimiter is a "*"?? */ { /* */ *d++ = toupper(*s); /* Copy a byte */ s++; /* Up source */ c--; /* Down count */ } /* ***********/ blkfill(fcbp,NULL,32); /* Init fcb area to NULLs */ blkfill(&(fcbp->fname[0]),' ',11); /* with name area to '\n': /* CCPM compatible */ case '\r': /* " " */ return NULLPTR; /* everything a-ok */ } / filnam++; /* Bump to next character */ } /* */ _strcpy(tokbuf,&(fcbp->fname[8]),3); /* Copy the she source string */ /* dest is the address of the destination area */ /* len is the number of bytes in "dest". blkfill(&(fcbp->fname[0]),'?',8); /* Yes, fill with ?'s 1st */ filnam++; /* Bump to next character */ } /** */ } /****************************/ /****************************************************************************/ / spaces */ /* */ filnam = get_token(filnam,tokbuf,32); /* Get the first token */ if(*filnam == ':') /* Is /**** */ return FAILPTR; /* Not legal file name */ } /****************************/ MLOCAL _strcpy(tring */ } /* */ if(*filnam == ';') /* If password specified */ { /* */ filnam=get_token( */ /* */ /* ret is the returned address of the delimiter */ /* */ /***************************************************/ _strcpy(tokbuf,fcbp->fname,8); /* Copy the file name in */ if(*filnam == '.') /* If extens* */ /* G e t _ t o k e n R o u t i n e */ /* --------------------------------- */ /* the delim a colon? */ { /* If yes, then a drive spec*/ if(stuff_drive(fcbp,tokbuf) == FAILURE) /* Check drive OK s,d,c) /* Special string copy func */ REG BYTE *s; /* Source string */ REG BYTE *d; /* Destination area */ R++filnam,tokbuf,32); /* get extension token */ _strcpy(tokbuf,&(fcbp->fpasswd[0]),8);/* Copy the string */ } /***************************************************/ MLOCAL BYTE *_delim="<>.,=:|[]*\n\r"; /* Delimiter set */ MLOCAL BYTion specified */ { /* */ filnam=get_token(++filnam,tokbuf,32); /* get extension token */ if(*filnam == */ /* Routine get_token takes the next token from the input string. */ /* */ /* Calling Sequence: */ return FAILPTR; /* Return error if bad */ filnam=get_token(++filnam,tokbuf,32); /* Get next token */ } EG WORD c; /* Count */ { /****************************/ while ((*s) && (c)) /* */ { /* */ E *get_token(src,dest,len) /* */ REG BYTE *src; /* -> source */ REG BYTE *dest; /* -> destination */ RErt to number */ fcbp->fuser = i+1; /* store user number */ } /****************************/ /* Is SUCCESS if ok, FAILURE o.w. */ /* */ /****************************************************************** /* */ /* S t u f f _ d r i v e F u n c t i o n */ /* --------------------------------------- =============================================*/ G WORD len; /* output area size */ { /****************************/ while(*src && (!strchr(_delim,*src)) && len)*/ if(*src) /* Drive code letter? */ { /* Here => yes */ fcbp->drive = toupper(*src)-'A'+1; /* get drive**********/ MLOCAL WORD stuff_drive(fcbp,src) /* */ struct fcbtab *fcbp; /* -> FCB area */ REG BYTE *src; / */ /* */ /* Routine "stuff_drive" loads the user and drive code fields from */ /* the filename string. ============================================*/ /* Until done */ { /* */ *dest++ = *src++; /* Move 1 byte */ len--; /* Down count */ } code byte */ src++; /* Increment source pointer */ } /* */ if(*src || /* Illegal stuff? */ * -> Source string */ { /****************************/ REG WORD i; /* Accumulator */ i = 0; /* Zap to z */ /* */ /* Calling sequence: */ /* ret = stuff_drive(fcbp,src); */ /* */ /* W============================================*/  /****************************/ *dest = '\0'; /* Drop in null terminator */ return(src); /* Return delimiter addr (fcbp->fuser > 16) || /*sw Bad user #? */ (fcbp->drive > 15) ) /* Bad drive? */ return(FAILURE); /* Yes, quiero */ while(isdigit(*src)) /* As long as source is dig.*/ { /* */ i = (i*10) + *src++ - '0'; /* Convehere: */ /* fcbp Is the FCB address within the ccb */ /* src Is the source filename string */ /* ret. */ } /****************************/ /****************************************************************************/t */ return(SUCCESS); /* OK to continue */ } /****************************/ #endif /*===================== index is jacket rtn for V7... */ } BYTE *str, ch; { REG BYTE *t; for( t=str; *t; t++ ) /* look for eos. */ ; for( ; ch != *t ; t-- ) /* look for c i**************************/ #include "portab.h" BYTE * strchr(str,ch) /* CLEAR FUNCTION ***********/ REG BYTE *str, ch/********************************************************************* * STRRCHAR - returns a pointer to last occurrence of index is jacket rtn for V7... */ } n s. */ if( t==str ) /* if we get to start of string,*/ return(NULL); /* too far. */ return(t); /* found c. not; { for( ; ch != *str ; str++ ) /* look for c in s. */ if( *str == NULL ) /* if we get to eos, we've gone */ return(0char in string. * * BYTE *strrchr(s,c) * BYTE *s, c; * * Like 'strchr', only returns pointer to last c in s (instead of fir/********************************************************************* * STRCHR - returns a pointer to first occurrence of cindex is jacket rtn for V7... */ } e that 'rindex' */ /* works (ie. returns eos) */ /* if c==NULL. */ } BYTE * rindex(str,ch) /* CLEAR FUNC); /* too far. */ return(str); /* found c. note that 'index' */ /* works to find NULL, (ie. */ /* eos), st), * or zero if c not in s. * * Edits: * 1/84 whf change from 'rindex()' to 'strchr()' ********************************har in string. * (formerly known as "index()") * * BYTE *strchr(s,c) * BYTE *s, c; * * Returns pointer to first c in s, orTION ***********/ REG BYTE *str, ch; { return strrchr(str,ch); /* 'jacket' rtn for V7 compatability*/ } if c==NULL. */ } BYTE * index(str,ch) /* CLEAR FUNCTION ***********/ REG BYTE *str, ch; { return strchr(str,ch); /***************************************/ #include "portab.h" BYTE * strrchr(str,ch) /* CLEAR FUNCTION ***********/ REG zero if c not in s. * * Edits: * 1/84 whf changed from 'index()' to 'strchr()' ********************************************ION ***********/ REG BYTE *str, ch; { return strrchr(str,ch); /* 'jacket' rtn for V7 compatability*/ } -83 whf * **************************************************************************/ #include "portab.h" #include "osif.h------------------- * Copyright 1982 by Digital Research Inc. All rights reserved. * * "access" returns 0 if access to a filEAR FUNCTION ***********/ BYTE *name; WORD owner; WORD group; { return(access(name,0)); } name; WORD mode; { return(access(name,mode)); } /**************************************************/ /* chown - chanION ***********/ REG BYTE *str, ch; { return strrchr(str,ch); /* 'jacket' rtn for V7 compatability*/ } " #include "osiferr.h" #include "errno.h" WORD access(fname,mode) /* CLEAR FUNCTION ***********/ BYTE *fname; WORD moe is allowed, -1 o.w. * Under CP/M, this just tests for existence. * * Calling sequence: * ret = access(fname,mode) * Wherge owner: like access() under CP/M */ /**************************************************/ WORD chown(name,owner,group) /* Cde; { REG WORD rval; if ((rval=open(fname,READ)) >= 0 ) /* File must be there ... */ { close(rval); /* Free up fd e: * ret = 0 if accessable, -1 o.w. * fname -> file's name, NULL terminated string * mode = test for read, write, exec, di/*************************************************************************** * * b l k m o v e F u n c t i o n * --------LEAR FUNCTION ***********/ BYTE *name; WORD owner; WORD group; { return(access(name,0)); }  */ return(SUCCESS); } RETERR(FAILURE,ENOENT); } /***************************************/ /* chmod - change modr path access * (ignored by CP/M) * * Made O/S independent 20-Aug-83 sw * Added chmod & chown to this source module 16-Sep----------------------- * Copyright 1983, by Digital Research Inc. * * "blkmove()" moves a block of bytes from one address to/************************************************************************* * * a c c e s s F u n c t i o n * ----------EAR FUNCTION ***********/ BYTE *name; WORD owner; WORD group; { return(access(name,0)); } e: NOP under CP/M */ /***************************************/ WORD chmod(name,mode) /* CLEAR FUNCTION ***********/ BYTE * another. * * Calling sequence: * blkmove(to,from,nn) * Where: * 'to' points to destination * 'from' points to source, ULL, (ie. */ /* eos), if c==NULL. */ } ***********/ REG BYTE *str, ch; { for( ; ch != *str ; str++ ) /* look for c in s. */ if( *str == NULL ) /* if we get to  if c==NULL. */ } from ) while(nn--) *to++ = *from++; else for( to += nn, from += nn; nn--; ) *--to = *--from; } k for eos. */ ; for( ; ch != *t ; t-- ) /* look for c in s. */ if( t==str ) /* if we get to start of string,*/ rand * 'nn' is the number of chars to move * ***************************************************************************/ #i/********************************************************************* * RINDEX - returns a pointer to last occurrence of ceos, we've gone */ return(0); /* too far. */ return(str); /* found c. note that 'index' */ /* works to find /********************************************************************* * INDEX - returns a pointer to first occurrence of ceturn(NULL); /* too far. */ return(t); /* found c. note that 'rindex' */ /* works (ie. returns eos) */ /* nclude VOID blkmove(to,from,nn) /* CLEAR FUNCTION ***********/ BYTE *to, *from; WORD nn; { if( to ULL, (ie. */ /* eos), if c==NULL. */ } **********************************************************/ #include BYTE * index(str,ch) /* CLEAR FUNCTION  if c==NULL. */ } from ) while(nn--) *to++ = *from++; else for( to += nn, from += nn; nn--; ) *--to = *--from; }  BYTE * rindex(str,ch) /* CLEAR FUNCTION ***********/ REG BYTE *str, ch; { REG BYTE *t; for( t=str; *t; t++ ) /* loo1,s2) * BYTE *s1, *s2; * * 'strcmp' compares null terminated strings s1 and s2. * Returns: * strcmp < 0 if s1 Btrcat(s1,s2) copies s2 to end of s1 * BYTE *s1, *s2; * * Assumes null terminated strings. No check is made for string area * { a = (*s1++); b = (*s2++); if (a > b) return (1); if (a < b) return (-1); } return(*s1 - *s2); } cmp = 0 if s1=s2 * strcmp > 0 if s1>s2 *********************************************************************/ #includefor return. */ ; while( (*cp++ = *s2++) ) /* copy until eos(s2). */ ; return(s1); } YTE * strcpy(s1,s2) /* CLEAR FUNCTION ***********/ BYTE *s1; REG BYTE *s2; { REG BYTE *cp; cp = s1; /* save for ret overflow. ****************************************************************************/ #include BYTE * strc WORD strcmp(s1,s2) /* CLEAR FUNCTION ***********/ REG BYTE *s1, *s2; { REG BYTE a,b; while (*s1 && *s2)urn. */ while( *cp++ = *s2++ ) /* isn't C fun? */ ; return(s1); } at(s1,s2) /* CLEAR FUNCTION ***********/ BYTE *s1; REG BYTE *s2; { REG BYTE *cp; for( cp=s1; *cp; cp++ ) /* save s1/********************************************************************** * STRCPY - copies from one string to another * * { a = (*s1++); b = (*s2++); if (a > b) return (1); if (a < b) return (-1); } return(*s1 - *s2); } /********************************************************************* * STRCMP - compares strings * * * WORD strcmp(srn. */ while( *cp++ = *s2++ ) /* isn't C fun? */ ; return(s1); }  for return. */ ; while( (*cp++ = *s2++) ) /* copy until eos(s2). */ ; return(s1); } BYTE *strcpy(s1,s2) * BYTE *s1, *s2; * * Copies bytes from s2 to s1, stopping after null has been moved. * Returns s1. * No/**************************************************************************** * STRCAT - concatenate strings * * BYTE *s { a = (*s1++); b = (*s2++); if (a > b) return (1); if (a < b) return (-1); } return(*s1 - *s2); } rn. */ while( *cp++ = *s2++ ) /* isn't C fun? */ ; return(s1); } *************************/ #include BYTE * strncat(s1,s2,num) /* CLEAR FUNCTION ***********/ BYTE *s1; REG*********************/ malloc_debug() {} /* stubroutine tag */ _errmalloc() {} copy if n==0. */ *cp = NULL; /* make sure string gets eos. */ return(s1); }  BYTE *s2; /* 'n' unsigned: if n<0, we'll */ WORD num; /* still decrement to 0. */ { REG BYTE *cp; for( cp=s1; *cp/**************************************************************************** * STRNCAT - concatenate strings (limited) * *********************/ malloc_debug() {} /* stubroutine tag */ _errmalloc() {}  /**************************************************************************** * _errmalloc / MALLOCND.C : stubroutine for mall; cp++) /* save s1 for return. */ ; while( *s2 && num-- > 0 ) /* copy until eos(s2) or n==0: */ *cp++ = *s2++; /* no * BYTE *strncat(s1,s2,n) * BYTE *s1, *s2; WORD n; * * 'strncat' copies at most n bytes of s2 onto the end of s1. * * Assuoc() error handler * Let the user program handle it. * * 10/83 whf ******************************************************* copy if n==0. */ *cp = NULL; /* make sure string gets eos. */ return(s1); } mes null terminated strings. No check is made for string area * overflow. *************************************************************************/ malloc_debug() {} /* stubroutine tag */ _errmalloc() {} copy if n==0. */ *cp = NULL; /* make sure string gets eos. */ return(s1); } /********************************************************************* * STRNCMP - compares strings up to n chars * * WO/* null pad. */ return(s1); } ***/ REG BYTE *s1, *s2; REG WORD num; { for( ; --num > 0 && (*s1 == *s2); s1++, s2++ ) if( *s1 == NULL ) return(0null * has been moved. * Truncates or null-pads s2, depending on n. * Returns s1. * No check for overflow of s1. *******RD strncmp(s1,s2,n) * BYTE *s1, *s2; * UWORD n; * * 'strncmp' compares null terminated strings s1 and s2, and examines * * null pad. */ return(s1); } ); return(*s1 - *s2); } ****************************************************************/ #include BYTE * strncpy(s1,s2,num) /* CLEARat most n chars. * Always compares at least 1 char. * n < 0 compares many, many characters. * Returns: * strncmp < 0 if s* null pad. */ return(s1); } ; return(*s1 - *s2); }  FUNCTION ***********/ BYTE *s1; REG BYTE *s2; WORD num; { REG BYTE *cp; for( cp=s1; num-- > 0 && (*cp = *s2); cp++,s21 0 if s1>s2 " " " *********************/********************************************************************** * STRNCPY - copies at most n chars from one string ; return(*s1 - *s2); } ++ ) /* isn't C fun? */ ; num++; /* bump n back up. */ while( num-- ) /* while #chars != 0 */ *cp++ = NULL; ************************************************/ #include WORD strncmp(s1,s2,num) /* CLEAR FUNCTION ********to another * * BYTE *strcpy(s1,s2,n) * BYTE *s1, *s2; * UWORD n; * * Copies at most n bytes from s2 to s1, stopping after ; num>0; num -= 2, fr += 2, to += 2) { t = fr[0]; to[0] = fr[1]; to[1] = t; } return(0); } ' - 'a'; return(c); } *s1, *s2; { REG BYTE a,b; while (*s1 || *s2) { a = _toupper(*s1++); b = _toupper(*s2++); if (a > b) return /********************************************************************* * STRCMP - compares strings * * Special version ; num>0; num -= 2, fr += 2, to += 2) { t = fr[0]; to[0] = fr[1]; to[1] = t; } return(0); } /* swab - swap (hi/lo) bytes in an area of memory */ /* constructed to allow in-place swabs (fr==to) */ #include (1); if (a < b) return (-1); } return(0); } MLOCAL _toupper(c) REG WORD c; { if(c >= 'a' && c <= 'z') c += 'which is case - insensitive. * * WORD strcmp(s1,s2) * BYTE *s1, *s2; * * 'strcmp' compares null terminated strings s1 and s WORD swab(fr,to,num) /* CLEAR FUNCTION ***********/ REG BYTE *fr; REG BYTE *to; REG WORD num; { REG BYTE t; for(A' - 'a'; return(c); } 2. * Returns: * strcmp < 0 if s1 0 if s1>s2 ********************************** ; num>0; num -= 2, fr += 2, to += 2) { t = fr[0]; to[0] = fr[1]; to[1] = t; } return(0); } ' - 'a'; return(c); } ***********************************/ #include WORD _strcmp(s1,s2) /* CLEAR FUNCTION ***********/ REG BYTE */ # define MAXCCBS 16 /* Maximum Num CCBs */ #endif /*--------------------------*/ #endif /*-------------de std definitions */ #include "osif.h" /* Also CP/M ones */ #include "osiferr.h" /* To set error vars */ #incltemporaries */ REG LONG j; /* */ /* */ j = 1; /* Start with channel 0 */ for(i=0;i offset = 0; /* Clear file offset word */ ch -> hiwater = 0; /* Init hiwater m************************** * The __chinit routine initializes only 1 channel. ************************************************/* */ xcb = _getccb(ch); /* xcb -> ccb for channel */ if((xcb->flags & OPENED) == 0) /* Is channel OPEN? */ led from other low-level routines * for single channel initialization. * Calling sequence: * __chinit(fd) * where: fd = filpen. * * Calling Sequence: * * Where: * ch Is the channel number * ccbptr Is the returned ccb address, NULLFD if error free */ { /* */ _chvec &= ~(1 << ch); /* Clear appropriate bit */ return(SUCCESS); /* Return OK */ark */ blkfill(&ch->fcb.drive,NULL,32); /* Init FCB to 0's */ blkfill(&ch->fcb.fname[0],' ',11); /* Init file name f*****************************/ __chinit(i) { /****************************/ REG FD *ch; /* -> CCB */ REG B RETERR(NULLFD,EBADF); /* Noooooooo!! */ return(xcb); /* Else, return pointer */ } /**********************e descriptor # *****************************************************************************/ _chinit() /********************************************************************************************/ FD *_chkc(ch) /*************************** } /****************************/ /***************************************************************************** * ields */ } /****************************/ /***********************************************************************YTE *p; /* Byte pointer temporary */ ch = _getccb(i); /* convert fd to CCB */ ch -> chan = i; /* Load chann******/ *************/ { /* */ REG WORD i; /* Index */ for(i=0;i CCB */ /************ C C B I N I T I A L I Z A T I O N * ----------------------------------- * Routine "_chinit" is called from the run-****** * C H A N N E L N U M B E R V A L I D A T I O N * ------------------------------------------------- * el byte */ ch -> flags = 0; /* clear flag word */ ch -> user = 0; /* assume user 0 */ ch -> sector = -1*****/ init(i); /* Init fds(i); */ } /****************************/ /*******************************************************************/ if(ch >= MAXCCBS) /* Is channel in range? */ RETERR(NULLFD,EBADF); /* No, quit now. */ time initialization to clear * out all the CCB storage. * Calling sequence: * _chinit(); * * Routine "__chinit(fd)" is calThis routine is used to validate a channel number and return the * pointer to the ccb area. The channel must be in range and o*****/ itten * ****************************************************************************/ #include "portab n * ------------------------------ * * Function "_wrtasc" is called from "write" to handle wILURE,EIO); /* Tell them so */ jj = kk; /* advance this ptr */ } else { /* It was a newline */ , jj, kk; /* Byte counters */ UWORD _pc_writeblk(); /* OS function Write Rnd Blk*/ /* */ for( jj.h" #include "osif.h" #include "osiferr.h" #include "errno.h" #define OFFSECT (fp->offset & ~(SECSIZ-1)) #define HIWrites to a * file opend in ascii mode. * * Calling sequence: * ret = _wrtasc(fp,bu kk++; /* write it out next time */ ii = _pc_writeblk(&(fp->fcb),fp->offset,"\r",1,1); /* */ fp->offset += =kk=0; jjhiwater-1 & ~(SECSIZ-1)) UWORD _wrtasc(fp,buff,bytes) /****************************/ /* */ REGffer,bytes); * * Where: * fp Points to the affected ccb. * buffer Is the buffeii; /* Incr pos in file */ } /****************************/ } /* end FOR loop */ if( fp->offset r newline chars */ if( kk-jj > 0 ) { /* something to write? */ ii = _pc_writeblk(&(fp->fcb),fp->offset,buff+jj FD *fp; /* -> CCB */ REG BYTE *buff; /* -> User's buffer */ REG UWORD bytes; /* # bytes to write */ { r address * bytes Is the number of bytes to write * * ret Is the number of bytes actually wr> fp->hiwater ) /* Need to advance? */ fp->hiwater = fp->offset; /* then do so */ return jj; /* Number w/*************************************************************************** * * W r t a s c F u n c t i o,kk-jj,1); /* */ fp->offset += ii; /* Incr pos in file */ if( ii==0 ) /* Problems? */ RETERR(FA /****************************/ #if PCDOS /*=============================================================*/ UWORD iiritten */ } /****************************/ #endif /*===========================================================t)fp->offset&(SECSIZ-1)]); /* 1st char to write*/ /* */ xbytes = bytes; /* Save byte count remaining*/ whileY; /* Nice clean buffer now */ } /****************************/ /* */ if( OFFSECT <= HIWSECT) /* aiwater) /* */ fp->hiwater = fp->offset; /* Fix hiwater if necessary */ return(written); /* return *// /* */ while(bytes >0) /* While more bytes to write*/ { /* */ xsector = fp->offset >> 7; /* Coet */ } /****************************/ if(p1 >= &(fp->buffer[SECSIZ])) /* Need to write buffer */ { /* ==*/ #if CPM /*=============================================================*/ REG BYTE *p1; /* Temp buffer pointer (p1 < &(fp->buffer[SECSIZ]) /* Until buffer is full */ && (bytes > 0)) /* or until request done */ { /***nd below hiwater mark */ { /* */ if(_blkio(fp,xsector,fp->buffer, /* */ 1L,B_READ) != 1) /* } /* */ } /****************************/ } MLOCAL _wrtclear(ptr,bytes) REG BYTE *ptr; REG WORD bytes; mpute beginning sector */ /* */ if(xsector != fp -> sector) /* Have to read it first */ { /* */ */ if(_blkio(fp,xsector,fp->buffer, /* */ 1L,B_WRITE) !=1) /* Try the write */ return(written-xbytes) */ REG BYTE cc; /* character temp */ LOCAL LONG xsector; /* Sector temp */ LOCAL LONG nsector; /* Multi-s*************************/ if(*buff == '\n' && cc != '\r') /* need to insert C/R */ cc = '\r'; /* */ Now read the correct sec */ RETERR(FAILURE,EIO); /* Couldn't */ } /****************************/ fp->sect{ while (bytes-- > 0) *ptr++ = 0; } #endif /*=============================================================*/  if((fp->flags & DIRTY) != 0) /* Buffer has data? */ { /* Yes */ if(_blkio(fp,fp->sector, /* *; /* return # actually written*/ } /****************************/ else /* */ fp -> flags |= DIRTY; /* Bector count */ LOCAL LONG written; /* # bytes to write */ LOCAL LONG xbytes; /* Save byte count remaining*/ else /* Don't need to */ { /* */ cc = *buff++; /* */ bytes--; /* */ } or = xsector; /* Mark buffer correctly */ } /****************************/ /* */ p1 = &(fp->buffer[(in while (bytes-- > 0) *ptr++ = 0; } #endif /*=============================================================*/ / fp->buffer,1L,B_WRITE) != 1) /* Try to write */ RETERR(FAILURE,EIO); /* Couldn't */ fp->flags &= ~DIRTuffer dirty again */ if(bytes == 0) /* If done, */ { /* Check offset here */ if(fp->offset > fp->h /****************************/ written = bytes; /* Remember original request*/ cc = 0; /* Init to garbage value * /****************************/ *p1++ = cc; /* Put char in buffer */ fp->offset++; /* Increment file offs while (bytes-- > 0) *ptr++ = 0; } #endif /*=============================================================*/  move.l 8(R14),R8 move.l (R8),-(sp) jsr _ldiv cmpm.l (sp)+,(sp)+ move.l 8(R14),R9 move.l R0,(R9) L1: unlk R14 rts sp) es the meat of the work * almul: move.l A5,-(sp) move.l 8(sp),A5 move.l 12(sp),-(sp) move.l (A5),-(sp) jsr lmul ade "osif.h" WORD errno = 0; /* set by low level i/o, unset by user (if at all) */ WORD _errcpm = 0; /* assign BDOS return vmove.l 8(R14),R8 move.l (R8),-(sp) jsr _ldiv cmpm.l (sp)+,(sp)+ move.l 8(R14),R9 move.l R0,(R9) L1: unlk R14 rts sp) dd #8,sp move.l R0,(A5) move.l (sp)+,A5 rts  move.l 8(sp),A5 move.l 12(sp),-(sp) move.l (A5),-(sp) jsr lmul aal when assigning errno */ move.l 8(R14),R8 move.l (R8),-(sp) jsr _ldiv cmpm.l (sp)+,(sp)+ move.l 8(R14),R9 move.l R0,(R9) L1: unlk R14 rts sp) d #8,sp move.l R0,(A5) move.l (sp)+,A5 rts  move.l 8(sp),A5 move.l 12(sp),-(sp) move.l (A5),-(sp) jsr lmul al when assigning errno */ .text .globl almul .globl lmul * * / this routine multiplies together two 32 bit signed long integers. * / the first arg is.globl _ldiv .globl _aldiv .globl aldiv .text _aldiv: aldiv: ~~aldiv: ~l2=12 ~al1=8 link R14,#-2 move.l 12(R14),-(sp) d #8,sp move.l R0,(A5) move.l (sp)+,A5 rts  move.l 8(sp),A5 move.l 12(sp),-(sp) move.l (A5),-(sp) jsr lmul al when assigning errno */  a pointer to the long, which is multiplied by the * / second arg, with the result being stored at the firstarg. * / lmul.s do/* * errno.c : declares storage for errno, a variable containing the last * system error. */ #include "portab.h" #inclu