.bECHO H "PR H ePR SUB ePR-2 SUB)PR22 C PR22 COM(kREAD ME ROUT H 0READ ME o /* echo.h -- 03/11/85 -- defines & data structures for echo.c */ #define SELDISK 14 /* log disk drive */ #define FIRST 17 /* search for first entry */ #define NEXT 18 /* search for next entry */ #define CURDISK 25 /* get current disk drive */ #define SETDMA 26 /* set DMA address */ #define NAMELEN 14 /* maximum length of file name */ /* misc defines */ #ifndef MAXFILES #define MAXFILES 64 /* Max. files on OCC1 DD */ #endif #define DMADD 0x80 /* DMA address */ #define FCBLOC 0x5c /* default location of FCB */ #define FCBSIZ 32 /* size of FCB */ #define DMASIZ 128 /* size of DMA */ #define NOTFOUND 0xff /* bdos 17 returns this if the file isn't found */ /* function macros */ #define offset(x) (char *) dma_buf + FCBSIZ * x /* declaration of CP/M file control block */ struct fcb { char f_driv; char f_name[8]; char f_type[3]; char f_ext; char f_resv[2]; char f_rc; char f_sydx[16]; char f_cr; unsigned f_record; char f_overfl; }; #define MARGIN 2 #define OFFSET 3 #define RIGHT 73 #define PAGE 66 #define LINES 55 #define TABSP 8 #define TAB 9 #define TOF 12 #define NOPAGE 'T' #define FRFILE 'F' #define FNLEN 14 #ifdef AZTEC #define CPMEOF 26 #endif czii -m -DAZTEC -z3000 b:pr22.c m80 =b:pr22.asm czii -m -DAZTEC -z3000 b:echo.c m80 =b:echo.asm l80 b:pr22,b:pr22/n/y,b:echo/s,softlibz/s,softmatz/s/e b: era pr22.asm era echo.asm /* PR.C 06/08/85 VERSION 2.2 prints out a paginated listing of an ASCII file uses Aztec C's IO redirection, and uses a home-grown wildcard expander (cf. echo.c). Note: WordStar is a trademark of Micropro International, Aztec of Manx Software Systems. Copyright (c) 1985 William S. Edwards. May be freely redistributed, but not resold. */ #include "libc.h" #include "rout.h" #include "echo.h" #include "pr.h" BOOL no_page = FALSE; /* flag for page headers */ /* mainline--expand cmd. line args, and process each file */ main (argc, argv) int argc; char *argv[]; { register int h = 0, j; char **names, **echo(), *index(); if (argc > 1) { /* parse cmd. line arguments */ no_page = argv[1][0] == '-' && index (argv[1],'T'); /* print files */ for (h = (argv[1][0] == '-') ? 2 : 1; h < argc; h++) { names = echo (argv[h]); for (j = 0; j < MAXFILES && names[j]; j++) read_f (names[j]); } /* end for */ } /* end if */ else { fputs ("\nUsage: pr [-t] filenam1.ext filenam2.ext ...", stderr); fputs (" [ > lst:, filename.ext]\n", stderr); fputs ("-t suppresses pagination.\n", stderr); fputs ("\nWildcards may be used as arguments", stderr); } } /* read each file and print out a paginated listing */ read_f (file_n) char file_n[]; { register int in_ch = 0, pcount = 0; FILE *fopen (), *file_d; if (file_d = fopen (file_n, "r")) { int lcount = 1; if (!no_page) top_page ((pcount=1), file_n); space(OFFSET); while ((in_ch = getc (file_d)) != EOF && in_ch != CPMEOF) { frob_char (in_ch, &lcount); if (in_ch == NEWL) { if ((++lcount > LINES) && (!no_page)) { top_page (++pcount, file_n); lcount = 1; } /* end if */ space (OFFSET); } /* end if */ } /* end while */ aputc (NEWL, stdout); aputc (TOF, stdout); fclose (file_d); } /* end if */ else { fputs ("Error opening ",stderr); fputs (file_n, stderr); aputc (NEWL, stderr); } /* end else */ } /* end read_f */ /* generate page headings */ top_page (pcount, file_n) int pcount; char file_n []; { int c, loop; if (pcount > 1) aputc (TOF, stdout); putchar (NEWL); space (OFFSET); fputs (file_n, stdout); space (RIGHT - FNLEN - OFFSET); printf ("PAGE %d",pcount); for (loop = 1; loop <= MARGIN; loop++) putchar (NEWL); } /* read a character and process it. Fill out tabs with spaces, mask WordStar control chars, nad deal with newlines. */ frob_char (in_ch, loc_lines) int in_ch, *loc_lines; { static int pos = 0; if (in_ch == TAB) { do { aputc(SPACE, stdout); } while (++pos % TABSP); } else { aputc ((in_ch & MASK), stdout); pos += 1; } if (in_ch == NEWL) { pos = 0; } if (pos > (MAXLEN - OFFSET - 1)) { printf("\n"); pos = 0; *loc_lines += 1; space (OFFSET); } } /* print amount number of spaces */ space (amount) int amount; { int ind; for (ind = 1; ind < amount; ind++) putchar (SPACE); } '''z&?$D$I$N$S$X$]$b$g$l$###""""""""v2z2 !DM!9^#V!o I!9^#V##^#V^!-4 ʐ!T!9^#V##^#V+2–!Ù!":!9^#V##^#V^!-4 ʼ!ÿ!DM`i#DM+`i!9~#fon F`i)!9~#fo^#V!9s#r! #+@n C)!9~#fo~#C)!9~#fo^#V}!#!~!#!!#!!#! Usage: pr [-t] filenam1.ext filenam2.ext ... [ > lst:, filename.ext] -t suppresses pagination. Wildcards may be used as arguments !DM!!:!9^#Vh!9s#rz!!9s#r*:|Z!9^#V!K!͠!9^#VDMC `iC !9`i 4 !9~#fo#s#r!7o *:|!9^#V#K!!9s#r!͠b!! Q!! Q!9^#V9!#!<!#!9^#V!#! QrError opening !9^#V!o m!! Q!! Q!͠!!9^#V!8͠!9^#V!!!9s#r!9~#fo#s#r+!9^#V!T !! QúPAGE %d ! 9^#V! 4 *!! Q*@#"@͈ L!!9^#V! Q!*@"@! 9^#V! 4 b!"@*@Lo ʝ!!"@!!9^#V~#fos#r!͠ !!9s#r!9~#fo#s#r+!9^#V!9~#fon !! Qó0>&2?>1&0:?0>&;:2?*@~ 1=1O+1 0x+~10:@*@~<1=11O+11 #1x+~111<*F=U 0w1G~# \1 d10P1x0G0&06 "F= ʐ1 ʐ16 Ö10}1ͱ k1å1ͱ k10ß1 ;1ù1:0 ʞ: ù1 !!9s#r!!9s#r!!9s#r!y& !j!89^#Vy ! 9!jn!!5!!!/1! 9!5!9s#r!C  !9^#V)))))! 9^_ !9~#fo#s#r+)ys#r! 9!5!9s#r!C  !9^#V)))))! 9^_ !9~#fo#s#r+)ys#rþ!yͷ !y !!9s#rJ !9~#fo#s#r+!9^#V!@n x !!9^#V)!9~#fos#r9 !9^#V!9s#r!9^#V!9s#r!!!9^#V/1!9^#V~^ !9^#V^!*4 3 !9^#V! !9^#V4  !9^#V!!9^#V4  !?!9~#fo#s#r+s !9~#fo#s#r+[ !9~#fo#s#r+^!9~#fo#s#r+sð !!9s#r!!9s#r!!9s#r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2~w#5O2!2#!5y542!2#<5*>2~#O5*<2~#_5!2w#m5> 22!2~w#~5ҩ52!2#’5ҩ55!25x5*<2w#¸5,35!,35!<,355,3555,355,3555*<s#r#6#6*<s#r#z 66#6*<^#Vx6!@6#|+!9^#V*-6b6*/69}|b6*-6"-6|ɯ=go!9~#f/o|/g#"/6,355This .LBR file contains source and object for a paginated file lister written in Aztec C (PR22.*). It also contains source for auxiliary routines which expand ambiguous CP/M file specs, which file specs may be provided as command line arguments. The output for PR.COM may be redirected to a file, or to the LST: device for printing. The command line option '-t' will suppress headings. Please send any comments to harvard!edwards on Usenet, or edwards@harvard.ARPA on Arpanet. Bill Edwardss#define TRUE 1 #define FALSE 0 #define LESS -1 #define EQUAL 0 #define MORE 1 #define MASK 0x007f #define SING '.' #define PLUR '*' #define NEWL '\n' #define LF 10 #define ESC 92 #define SPACE 32 #define MAXLEN 80 #define conv(c) isupper(*c) ? tolower((int)*c) : (int) *c #define equal(a,b) ((a == b) && (b != LF)) #define isalpha(c) (isupper(c) || islower(c)) #define iscntrl(c) (c < SPACE || c == 127) #define isascii(c) (c >= 0 && c <= 127) typedef int BOOL; per(c) || islower(c)) #defiThis .LBR file contains source and object for a paginated file lister written in Aztec C for CP/M-80. (PR22.*). It also contains source for auxiliary routines which expand ambiguous CP/M file specs, which file specs may be provided as command line arguments to PR22. The output for PR.COM may be redirected to a file, or to the LST: device for printing. The command line option '-t' will suppress headings. Please send any comments to harvard!edwards on Usenet, or edwards@harvard.ARPA on Arpanet, or post them to this BBS. Bill Edwards any comments to harvard!edwards on Usenet, or edwards@harvard.ARPA on Arpanetcii -m -DAZTEC -z3000 b:pr22.c m80 =b:pr22.asm cii -m -DAZTEC -z3000 b:echo.c m80 =b:echo.asm l80 b:pr22,b:pr22/n/y,b:echo/s,softlibc/s/e b: era pr22.asm era echo.asm  cii -m -DAZTEC -z3000 b:echo.c m80 =b:echo.asm l80 b:pr22,b:pr22/n/y,b:echo/s