gisle@ifi.uio.no (Gisle Hannemyr) (12/30/89)
Posting-number: Volume 9, Issue 96 Submitted-by: gisle@ifi.uio.no (Gisle Hannemyr) Archive-name: pep/part05 # This is a shell archive [ part 5 of 5 ] # Remove everything above and including the cut line. # Then run the rest of the file through /bin/sh (not csh). #--cut here-----cut here-----cut here-----cut here-----cut here-----cut here--# #!/bin/sh # shar: Shell Archiver # Execute the following text with /bin/sh to create the file(s): # bdmg.c # plain.c # pep.h # bdmg.h # This archive created: Fri Dec 29 14:42:46 1989 # Wrapped by: Gisle Hannemyr (gisle@ifi.uio.no) echo shar: extracting bdmg.c sed 's/^XX//' << \SHAR_EOF > bdmg.c XX/* bdmg.c 1989 june 4 [gh] XX+----------------------------------------------------------------------------- XX| Abstract: XX| Functions that compensate some of the braindamage in various DUCOS. XX| XX| Authorship: XX| Copyright (c) 1988, 1989 Gisle Hannemyr. XX| Permission is granted to hack, make and distribute copies of this module XX| as long as this notice and the copyright notices are not removed. XX| If you intend to distribute changed versions of this module, please make XX| an entry in the "history" log (below) and mark the hacked lines with your XX| initials. I maintain the module, and shall appreiciate copies of bug XX| fixes and new versions. XX| Flames, bug reports, comments and improvements to: XX| snail: Gisle Hannemyr, Brageveien 3A, 0452 Oslo, Norway XX| email: X400: gisle@nr.uninett XX| RFC: gisle@ifi.uio.no XX| (and several BBS mailboxes in the Oslo area). XX| XX| Access programs: XX| int stricmp() -- case insenitive compare XX| int rename() -- rename file XX| struct DIRLIST *expwildcard() -- ersatz shell wildcard expansion XX| void dispwildcard() -- dispose list created by expwildcard XX| XX| History: XX| 11 dec 89 [gh] Latest update. XX| XX| See main module for more comments. XX+---------------------------------------------------------------------------*/ XX XX#include <stdio.h> XX#include "pep.h" XX#include "bdmg.h" XX#include <string.h> XX#if __CPM86__ || __MSDOS__ XX#include <dos.h> XX#endif XX XX/*---( types )--------------------------------------------------------------*/ XX XX#ifdef __CPM86__ XXstruct DTA { XX unsigned char f_driv; XX unsigned char f_name[8]; XX unsigned char f_type[3]; XX unsigned char f_dumm[20]; XX}; /* DTA */ XX#endif XX XX XX#ifdef __MSDOS__ XXstruct DTA { XX char bogus[21]; XX char attri; XX int ftime; XX int fdate; XX int fsize[2]; XX char fname[64]; XX}; /* DTA */ XX#endif XX XX XX/*---( braindamage compensation )-------------------------------------------*/ XX XX#ifdef STRICMP XXint stricmp(ss,tt) XXchar *ss,*tt; XX{ XX while (*ss && (tolower(*ss) == tolower(*tt))) { ss++; tt++; } XX return(tolower(*ss) - tolower(*tt)); XX} /* stricmp */ XX#endif XX XX XX#ifdef SYSV2 XXint rename(from,to) XXchar *from,*to; XX{ XX (void)unlink(to); XX if (link(from,to)) return(-1); XX return(unlink(from)); XX} /* rename */ XX#endif XX XX XX#ifdef VMSV1 XXint rename(from, to) XXchar *from, *to; XX{ XX struct dsc$descriptor_s From={strlen(from), XX DSC$K_DTYPE_T,DSC$K_CLASS_S,from}; XX struct dsc$descriptor_s To={strlen(to), XX DSC$K_DTYPE_T,DSC$K_CLASS_S,to}; XX XX if (LIB$RENAME_FILE(&From, &To) == SS$_NORMAL) return(0); XX return(-1); XX} /* rename */ XX#endif XX XX XX#if __CPM86__ || __MSDOS__ XX#ifdef __CPM86__ XX/* XX| Abs: Pack user number and fcb structure into string. XX| Ret: String with filename that was in fcb. XX| Imp: System dependent: CP/M-86, C-DOS 3.20 XX*/ XXstatic char *fcb2str(buf,lfcb,usr) XXchar *buf; XXstruct fcb *lfcb; XXint usr; XX{ XX char *cp; XX int i; XX XX cp=buf; XX if (usr!=255) { XX if (usr>9) *buf++=((usr/10)%10)+'0'; XX *buf++=(usr%10)+'0'; XX *buf++='/'; XX } XX if (lfcb->f_driv) { XX *buf++=lfcb->f_driv+'a'-1; XX *buf++=':'; XX } XX for (i=0; i<8 && lfcb->f_name[i]!=' '; ++i) XX *buf++=tolower(lfcb->f_name[i]&0x7f); *buf++='.'; XX for (i=0; i<3 && lfcb->f_type[i]!=' '; ++i) XX *buf++=tolower(lfcb->f_type[i]&0x7f); *buf=0; XX return(cp); XX} /* fcb2str */ XX XX XX/* XX| Abs: Return list of malloc'ed filenames matching ambigious input list. XX| Ret: Pointer to alloced list, or 0 if none found. XX| Imp: System dependent: CP/M-86, C-DOS 3.20 XX*/ XXstruct DIRLIST *expwildcard(ambig) XXchar **ambig; XX{ XX struct DIRLIST *first, *last, *prev; XX int pos; XX char *n; XX int user; XX struct DTA dma[4]; /* 4 CP/M directory entries */ XX struct DTA fcb; /* Working FCB */ XX XX setmem(&fcb,sizeof(struct DTA),0); /* Initialize FCB */ XX bdos(SETDTA,dma); XX XX first = NULL; XX while (*ambig) { XX if ((user=fcbinit(*ambig,&fcb)) == -1) continue; /* Bogus file name */ XX setusr(user); XX for (pos = bdos(FNDFRST,&fcb); pos != 0xff; pos = bdos(FNDNEXT,&fcb)) { XX if ((last = (struct DIRLIST *)malloc(sizeof(struct DIRLIST))) XX && (last->fnam=malloc(18))) { XX dma[pos].f_driv=fcb.f_driv; /* set drive */ XX if (!first) first = last; else prev->next = last; XX fcb2str(last->fnam,&dma[pos],user); XX last->next = NULL; XX prev = last; XX } else mess(5); /* No more room */ XX } /* for */ XX ambig++; XX } /* while */ XX rstusr(); XX return(first); XX} /* expwildcard */ XX#endif XX XX XX#ifdef __MSDOS__ XX/* XX| Abs: Return list of malloc'ed filenames matching ambigious input list. XX| Ret: Pointer to alloced list, or 0 if none found. XX| Imp: System dependent: MS-DOS 2.0, 3.2. XX*/ XXstruct DIRLIST *expwildcard(ambig) XXchar **ambig; XX{ XX union REGS ireg; XX union REGS oreg; XX struct SREGS sreg; XX struct DTA dta; XX XX char name[64]; XX char *endpath; XX int lenpath; XX struct DIRLIST *first, *last, *prev; XX XX if (!*ambig) return(NULL); /* Doing stdin */ XX XX ireg.h.ah = SETDTA; XX ireg.x.dx = (int)&dta; XX intdos(&ireg,&oreg); XX first = NULL; XX XX while (*ambig) { XX endpath = strrchr(*ambig,DIRCHAR); XX if (endpath) { XX endpath++; /* Behind "\" */ XX lenpath = (unsigned int)endpath - (unsigned int)*ambig; XX } else lenpath = 0; XX ireg.h.ah = GETFRST; XX ireg.x.cx = _A_NORMAL; /* Look up all normal files. */ XX ireg.x.dx = (int)*ambig; XX for (;;) { XX intdos(&ireg,&oreg); XX /* printf("AX = 0x%x CF = 0x%x\n",oreg.x.ax,oreg.x.cflag); */ XX if (oreg.x.cflag) break; XX if ((last = (struct DIRLIST *)malloc(sizeof(struct DIRLIST))) XX && (last->fnam = (char *)malloc(strlen(dta.fname)+lenpath+1))) { XX if (!first) first = last; else prev->next = last; XX strncpy(last->fnam,*ambig,lenpath); XX last->fnam[lenpath] = '\0'; XX strcat(last->fnam,dta.fname); XX last->next = NULL; XX prev = last; XX ireg.h.ah = GETNEXT; XX } else mess(5); /* No more room */ XX } /* for */ XX ambig++; XX } /* while */ XX return(first); XX} /* expwildcard */ XX#endif XX XX XX/* XX| Abs: Dispose list of malloc'ed filenames. XX*/ XXvoid dispwildcard(first) XXstruct DIRLIST *first; XX{ XX struct DIRLIST *last, *prev; XX XX last = first; XX while (last) XX { XX prev = last; XX free(last->fnam); XX last = last->next; XX free(prev); XX } XX} /* dispwildcard */ XX#endif XX XX/* EOF */ SHAR_EOF if test 6483 -ne "`wc -c bdmg.c`" then echo shar: error transmitting bdmg.c '(should have been 6483 characters)' fi echo shar: extracting plain.c sed 's/^XX//' << \SHAR_EOF > plain.c XX/* plain.c 1989 december 10 [gh] XX+----------------------------------------------------------------------------- XX| Abstract: XX| Plain filter module XX| XX| Authorship: XX| Copyright (c) 1988, 1989 Gisle Hannemyr. XX| Permission is granted to hack, make and distribute copies of this module XX| as long as this notice and the copyright notices are not removed. XX| If you intend to distribute changed versions of this module, please make XX| an entry in the "history" log (below) and mark the hacked lines with your XX| initials. I maintain the module, and shall appreiciate copies of bug XX| fixes and new versions. XX| Flames, bug reports, comments and improvements to: XX| snail: Gisle Hannemyr, Brageveien 3A, 0452 Oslo, Norway XX| email: X400: gisle@nr.uninett XX| RFC: gisle@ifi.uio.no XX| (and several BBS mailboxes in the Oslo area). XX| XX| Access programs: XX| void inittable() : Initialize default transformation table. XX| void readtable() : Initialize transformation table from file. XX| void doplain() : Interprete one file. XX| XX| History: XX| 11 dec 89 [gh] Latest update. XX| XX| See main module for more comments. XX+---------------------------------------------------------------------------*/ XX XX#include <stdio.h> XX#include "pep.h" XX#include <ctype.h> XX#include <string.h> XX XX/*---( defines )------------------------------------------------------------*/ XX XX#define WSHH 0x1e /* WordStar invisible soft hyphen. */ XX#define WSSH 0x1f /* WordStar visible soft hyphen. */ XX#define WSSC 0x8d /* WordStar soft carrige return. */ XX#define WSSS 0xa0 /* WordStar soft space. */ XX XX#ifndef BUFSIZE XX#define BUFSIZE 8192 XX#endif /* BUFSIZE */ XX XX XX/*---( types )--------------------------------------------------------------*/ XX XXtypedef int FOLDMATRIX[11][2]; XX XX XX/*---( constants )----------------------------------------------------------*/ XX XX/* Test for Swedish characters too, but after the Norwegian ones. */ XXstatic FOLDMATRIX decfold = { XX { 198, 91 }, /* AE [ (N) */ XX { 216, 92 }, /* OE \ (N) */ XX { 197, 93 }, /* AA ] (-) */ XX { 230, 123 }, /* ae { (N) */ XX { 248, 124 }, /* oe | (N) */ XX { 229, 125 }, /* aa } (-) */ XX { 196, 91 }, /* AE [ (S) */ XX { 214, 92 }, /* OE \ (S) */ XX { 228, 123 }, /* ae { (S) */ XX { 246, 124 }, /* oe | (S) */ XX { 0, 0 } XX}; XX XX XXstatic FOLDMATRIX ibmfold = { XX { 146, 91 }, /* AE [ (N) */ XX { 157, 92 }, /* OE \ (N) */ XX { 143, 93 }, /* AA ] (-) */ XX { 145, 123 }, /* ae { (N) */ XX { 155, 124 }, /* oe | (N) */ XX { 134, 125 }, /* aa } (-) */ XX { 142, 91 }, /* AE [ (S) */ XX { 153, 92 }, /* OE \ (S) */ XX { 132, 123 }, /* ae { (S) */ XX { 148, 124 }, /* oe | (S) */ XX { 0, 0 } XX}; XX XX XXstatic FOLDMATRIX macfold = { XX { 174, 91 }, /* AE [ (N) */ XX { 175, 92 }, /* OE \ (N) */ XX { 129, 93 }, /* AA ] (-) */ XX { 190, 123 }, /* ae { (N) */ XX { 191, 124 }, /* oe | (N) */ XX { 140, 125 }, /* aa } (-) */ XX { 128, 91 }, /* AE [ (S) */ XX { 133, 92 }, /* OE \ (S) */ XX { 138, 123 }, /* ae { (S) */ XX { 154, 124 }, /* oe | (S) */ XX { 0, 0 } XX}; XX XX XX/*---( variables )----------------------------------------------------------*/ XX XXstatic unsigned char Buffer[BUFSIZE]; /* Output buffer */ XXstatic unsigned char CTable[256]; /* General fold matrix */ XX XXstatic int BuffSs = 0; /* Bona-fide chars. in string. */ XXstatic int BuffXx = 0; /* Horisontal pos. in buffer. */ XXstatic int NSpace = 0; /* No. of spaces not flushed. */ XX XX XX/*---( forward )------------------------------------------------------------*/ XX XXchar *getenv(); XX XX XX/*---( housekeeping )-------------------------------------------------------*/ XX XX/* XX| Abs: Is it a control character? (According to pep's rather complicated XX| concept of such.) XX| Ret: TRUE if it is, else FALSE (pep hacks ctrl. chars, leave others alone). XX*/ XXstatic BOOL ctrlp(cc) XXint cc; XX{ XX if (isascii(cc)) { XX if (wflag1 && (cc == WSSH)) return(FALSE); XX if (iscntrl(cc)) return(TRUE); else return(FALSE); XX } else if (!bflagb) return(FALSE); XX /* Assert: if it was 7 bit ASCII, or if the upper 128 set shall be */ XX /* considered legal character, then we have returned by now. */ XX XX if (wflag1 && (cc == WSSC)) return(FALSE); XX /* Assert: if it was WordStar soft CR, then we have returned by now. */ XX XX if (iflagi && IFrst) { /* We are folding to IBM charset, */ XX int jj = 0; XX while (ibmfold[jj][0] && (ibmfold[jj][0] != cc)) jj++; XX return(!ibmfold[jj][0]); /* so those are not control chars. */ XX } XX return(TRUE); XX /* If all else fails, it must be a control character. */ XX} /* ctrlp */ XX XX XX/*---( transformation table )-----------------------------------------------*/ XX XX/* XX| Abs: Catenate tabledir and cname to create a full searchpath. XX| Ret: Pointer to the full, catenated path. XX*/ XXstatic char *findpath(tabledir,cname) XXchar *tabledir, *cname; XX{ XX char fullpath[1024], *ss; XX XX if (!tabledir) return(cname); /* Bail out under VMS, etc. */ XX ss = fullpath; XX while (*ss++ = *tabledir++) ; /* strcpy(fullpath,tabledir); */ XX ss--; /* ss points to terminator */ XX if (ss[-1] != DIRCHAR) { *ss = DIRCHAR; *++ss = '\0'; } XX while (*ss++ = *cname++) ; /* strcat(fullpath,cname); */ XX return(fullpath); XX} /* findpath */ XX XX/* XX| Abs: Initialize default transformation table. XX*/ XXvoid inittable() XX{ XX int cc; XX XX for (cc = 0; cc < 256; cc++) CTable[cc] = cc; XX} /* inittable */ XX XX XX/* XX| Abs: Initialize transformation table from file. XX| Par: tabledir = pointer to table to initialize XX| cname = file to read table from XX| echo = TRUE to echo comments to stderr, else quiet. XX*/ XXvoid readtable(tabledir,cname,echo) XXchar *tabledir, *cname; XXBOOL echo; XX{ XX FILE *fdt; XX char *ss; XX XX if ((fdt = fopen(cname,"r")) == NULL) { XX if (tabledir) { XX if (ss = strrchr(tabledir,DIRCHAR)) { XX *++ss = '\0'; XX fdt = fopen(findpath(tabledir,cname),"r"); XX } /* if tabledir made sense */ XX } /* if tabledir defined */ XX if (fdt == NULL) { XX#ifndef __CPM86__ XX if (tabledir = getenv("PEP")) XX fdt = fopen(findpath(tabledir,cname),"r"); XX#endif XX if (fdt == NULL) { XX fprintf(stderr,"can't open translation table \"%s\"\n", cname); XX exit(ERROR_EXIT); XX } /* if file not found in environment directory */ XX } /* if file not found in startup directory */ XX } /* if file not found in local directory */ XX XX while (fgets(Buffer,BUFSIZE-1,fdt)) { XX char *ss; XX int ii; XX if (ss = strchr(Buffer,'#')) { XX if (echo && (ss[1] != '#')) { XX fputs(" ",stderr); XX fputs(ss,stderr); XX } XX *ss = '\0'; XX } /* if comment */ XX for (ii = strlen(Buffer) - 1; isspace(Buffer[ii]) && (ii >= 0); ii--); XX Buffer[++ii] = 0; XX if (*Buffer) { XX int tt, ff; XX if (sscanf(Buffer,"%d %d",&ff,&tt) != 2) mess(6); XX if ((tt < 0) || (tt > 255) || (ff < 0) || (ff > 255)) mess(6); XX /* fprintf(stderr,"[%s] %d <== %d\n",Buffer,tt,ff); */ XX CTable[ff] = tt; XX } XX } /* while */ XX fclose(fdt); XX} /* readtable */ XX XX XX/*---( foldings )-----------------------------------------------------------*/ XX XX/* XX| Abs: XX*/ XXstatic unsigned char fold8(cc,fold) XXint cc; XXFOLDMATRIX fold; XX{ XX if (cc >= ILimit) { XX int jj = 0; XX while (fold[jj][IFrst] && (fold[jj][IFrst] != cc)) jj++; XX if (fold[jj][IFrst]) cc = fold[jj][ILast]; XX } XX return(cc); XX} /* fold8 */ XX XX XX/* XX| Abs: Flush accumulated whitespace, compressing spaces into tabs. XX*/ XXstatic void flushspace() XX{ XX int ii; XX XX if (cflagc && OTabSz) { XX while (NSpace > 1 && NSpace >= (ii = OTabSz - (LineXx % OTabSz))) { XX Buffer[BuffXx++] = '\t'; XX NSpace -= ii; XX LineXx += ii; XX } /* while */ XX } /* if compressing tabs */ XX LineXx += NSpace; XX while (NSpace--) Buffer[BuffXx++] = ' '; XX NSpace = 0; XX} /* flushspace */ XX XX XX/* XX| Abs: Flush line in buffer to the output file. XX| Des: Turbo-C return bogus values if isspace is called with arg > 128. XX| Sef: Zero NSpace, BuffXx and LineXx counts. XX*/ XXstatic void flushline() XX{ XX if (!sflags || (BuffSs >= StrSiz)) { XX while (!(Buffer[BuffXx-1] & 0x80) && isspace(Buffer[BuffXx-1]) && BuffXx) XX BuffXx--; XX Buffer[BuffXx] = '\0'; XX if (wflag1) { XX int xx; XX if (BuffXx && (Buffer[BuffXx-1] == '-')) Buffer[BuffXx-1] = WSSH; XX xx = 0; XX while (Buffer[xx]) { XX if (Buffer[xx] == ' ') Buffer[xx] = WSSS; XX xx++; XX } XX } XX fputs(Buffer,Fdo); XX XX if (vflagv) /* Paragraph only */ ; XX XX /* Terminate the line we have just flushed */ XX if (wflag1) { XX if (BuffXx) putc(WSSC,Fdo); else putc('\r',Fdo); XX putc('\n',Fdo); XX } else { XX if ((vflagv && BuffXx) || (EndOLn == -2)) putc(' ',Fdo); XX else { XX if (EndOLn == -1) { putc('\r',Fdo); putc('\n',Fdo); } XX else putc(EndOLn,Fdo); XX } /* if */ XX } /* if */ XX showprogress(); XX } /* if enough of a string to print it */ XX NSpace = BuffXx = LineXx = 0; XX} /* flushline */ XX XX XX/* XX| Abs: Put character into line buffer. XX| Des: First, make some simple character foldings. Then, put the character XX| into a line buffer. A control character may be converted to hex, XX| surrounded by angle brackets. XX*/ XXstatic void putline(cc) XXint cc; XX{ XX static BOOL wasbs = FALSE; XX static BOOL wascr = FALSE; XX static BOOL wasoe = FALSE; XX BOOL isaoe = FALSE; XX XX if (BuffXx >= (BUFSIZE-5)) flushline(); /* Panic! */ XX if (zflagz) cc = cc & 0x7f; /* Fold to 7 bit. */ XX if (mflagm && !IFrst && (cc == '\r')) cc = '\n'; /* Mac uses CR as terminator */ XX /* This is a hack to fool the stuff below who removes redundant CR's. */ XX /* When we are converting from Mac format, we want to keep them all. */ XX XX if (wasoe) { XX wasoe = FALSE; XX if (cc != 92) { XX Buffer[BuffXx] = '\\'; XX LineXx++; XX BuffXx++; XX } /* if */ XX } else if ((cc == 92) && kflagk && IFrst) { wasoe++; return; } XX XX if (dflagd) { if (!IFrst && (cc == 216)) isaoe++; cc = fold8(cc,decfold); } XX if (iflagi) { if (!IFrst && (cc == 157)) isaoe++; cc = fold8(cc,ibmfold); } XX if (mflagm) { if (!IFrst && (cc == 175)) isaoe++; cc = fold8(cc,macfold); } XX if (gflagg) cc = CTable[cc]; /* Fold from table. */ XX if (wflag0) { XX if (cc == WSHH) return; /* WS invisible soft hyphen. */ XX if (cc == WSSH) cc = '-'; /* WS visible soft hyphen. */ XX } XX XX if (wascr) { XX wascr = FALSE; XX if (BuffXx) { XX flushline(); XX if (cc == '\n') return; XX } /* if anything in buffer */ XX } /* if wascr */ XX XX if ((cc == '\b') && BuffXx) { BuffXx--; wasbs++; } XX else if (cc == '\f') { XX if (BuffXx) flushline(); XX if (wflag1) fputs(".PA\n",Fdo); XX else if (!(bflagb + sflags)) putc('\f',Fdo); XX wasbs = FALSE; XX } XX else if (cc == '\n') { flushline(); BuffSs++; } XX else if (cc == '\r') { wascr++; } XX else if (cc == '\t') { XX if (tflagt || cflagc) NSpace += ITabSz - ((LineXx + NSpace) % ITabSz); XX else { Buffer[BuffXx++] = cc; LineXx++; } XX BuffSs++; XX wasbs = FALSE; XX } XX else if (ctrlp(cc)) { XX if (xflagx) { /* Expanding control chars. */ XX char *ss; XX if (NSpace) flushspace(); XX ss = (char *)&Buffer[BuffXx]; XX sprintf(ss,"<%02xh>",cc); XX BuffXx += 5; XX LineXx += 5; XX } XX else if (BuffXx) flushline(); /* Removing control chars. */ XX BuffSs = 0; XX wasbs = FALSE; XX } XX else if (cflagc && cc == ' ') NSpace++; XX else { XX if (NSpace) flushspace(); XX if (!wasbs || (cc != '_')) Buffer[BuffXx] = cc; XX LineXx++; XX BuffXx++; XX if (kflagk && isaoe) { XX Buffer[BuffXx] = cc; XX LineXx++; XX BuffXx++; XX } XX BuffSs++; XX wasbs = FALSE; XX } XX} /* putline */ XX XX XX/*---( file loop )----------------------------------------------------------*/ XX XX/* XX| Abs: Read (and write) one complete plain file. XX*/ XXvoid doplain() XX{ XX int cc; XX XX while ((cc = getc(Fdi)) != EOF) putline(cc); XX if (BuffXx) flushline(); XX} /* doplain */ XX XX/* EOF */ SHAR_EOF if test 12521 -ne "`wc -c plain.c`" then echo shar: error transmitting plain.c '(should have been 12521 characters)' fi echo shar: extracting pep.h sed 's/^XX//' << \SHAR_EOF > pep.h XX/* pep.h 1989 june 27 [gh] XX+----------------------------------------------------------------------------- XX| Abstract: XX| Common types and definitions for pep. XX| XX| History: XX| 27 jun 89 [gh] Latest update. XX| XX| See main module for more comments. XX+---------------------------------------------------------------------------*/ XX XX/* These 4 symbols may be (un)set by you according preferences/environment */ XX XX/* STRICMP should be defined if "stricmp" reported missing by the linker */ XX/* SYSV2 should be defined if you are compiling this on SYS V.2 UNIX */ XX/* __TURBOC__ are already set to 1 by Borland, (may be undefined by you). */ XX/* VMSV1 should be defined if you are using VAX C ver. 1.x VMS */ XX XX XX/* Canonize macroes predefined by the compiler. */ XX XX#ifdef MSDOS XX#define __MSDOS__ 1 XX#endif XX XX#ifdef msdos XX#define __MSDOS__ 1 XX#endif XX XX#ifdef unix XX#define __UNIX__ 1 XX#endif XX XX#ifdef vms XX#define __VMS__ 1 XX#endif XX XX XX/*---( defines )------------------------------------------------------------*/ XX XX#ifdef __VMS__ XX#include <ssdef.h> XX#endif XX XX#define FALSE 0 /* Boolean FALSE */ XX#define TRUE !FALSE /* Boolean TRUE */ XX XX XX#ifdef __CPM86__ XX#define SETDTA 0x1A /* Set Disk Transfer Address */ XX#define FNDFRST 0x11 /* Find first FCB */ XX#define FNDNEXT 0x12 /* Find next FCB */ XX#define DIRCHAR 0xFF /* Bogus */ XX#endif XX XX#ifdef __MSDOS__ XX#define SETDTA 0x1A /* Set Disk Transfer Address */ XX#define GETFRST 0x4E /* Find first ASCIZ */ XX#define GETNEXT 0x4F /* Find next ASCIZ */ XX#define DIRCHAR '\\' /* Directory path separator */ XX#endif XX XX#ifdef __UNIX__ XX#define DIRCHAR '/' /* Directory path separator */ XX#endif XX XX#ifdef __VMS__ XX#define unlink(x) delete(x) XX#define DIRCHAR '>' /* Directory path separator */ XX#endif XX XX#ifdef __VMS__ XX#define NORML_EXIT SS$_NORMAL XX#define ERROR_EXIT SS$_ABORT XX#else XX#define NORML_EXIT 0 XX#define ERROR_EXIT 1 XX#endif XX XX XX/*---( types )--------------------------------------------------------------*/ XX XXtypedef unsigned char BOOL; XX XX XX/*---( variables )----------------------------------------------------------*/ XX XX#ifdef MAIN XX#define EXTERN XX#else XX#define EXTERN extern XX#endif XX XXEXTERN FILE *Fdi; XXEXTERN FILE *Fdo; XXEXTERN int IFrst, ILast, ILimit; /* Fold direction flags */ XX XX#ifndef MAIN XXextern long LCount; /* Global line count */ XXextern int LineXx; /* Horisontal position on line. */ XXextern int ITabSz; /* Input tabulator size. */ XXextern int OTabSz; /* Output tabulator size. */ XXextern int StrSiz; /* String size for strings. */ XXextern int EndOLn; /* -1 CRLF, -2 Paragraph only */ XX XXextern int bflagb; /* Binary wash. */ XXextern int cflagc; /* Compress */ XXextern int dflagd; /* DEC character set. */ XXextern int gflagg; /* General fold table */ XXextern int iflagi; /* IBM character set. */ XXextern int kflagk; /* Kman character set. */ XXextern int mflagm; /* MAC character set. */ XXextern int sflags; /* String extraction. */ XXextern int tflagt; /* Tab expansion */ XXextern int vflagv; /* Terminate only paragraphs. */ XXextern int wflag0; /* From WS doc. mode to 7-bit. */ XXextern int wflag1; /* From 7-bit to WS doc. mode. */ XXextern int xflagx; XXextern int zflagz; XX#endif XX XX/* EOH */ SHAR_EOF if test 3745 -ne "`wc -c pep.h`" then echo shar: error transmitting pep.h '(should have been 3745 characters)' fi echo shar: extracting bdmg.h sed 's/^XX//' << \SHAR_EOF > bdmg.h XX/* bdmg.h 1989 december 11 [gh] XX+----------------------------------------------------------------------------- XX| Abstract: XX| CP/M and DOS types and functions exported by bdmg.c XX| XX| History: XX| 11 dec 89 [gh] Latest update. XX| XX| See main module for more comments. XX+---------------------------------------------------------------------------*/ XX XX/*---( types )--------------------------------------------------------------*/ XX XXstruct DIRLIST { XX char *fnam; XX struct DIRLIST *next; XX}; /* DIRLIST */ XX XX XX/*---( prototypes )---------------------------------------------------------*/ XX XXstruct DIRLIST *expwildcard(); XXvoid dispwildcard(); XX XX XX/* EOH */ XX SHAR_EOF if test 659 -ne "`wc -c bdmg.h`" then echo shar: error transmitting bdmg.h '(should have been 659 characters)' fi # End of shell archive exit 0