Path: utzoo!attcan!uunet!samsung!crackers!m2c!wpi.WPI.EDU!greyelf From: greyelf@wpi.WPI.EDU (Michael J Pender) Newsgroups: comp.sys.apple2 Subject: Hyper C pr/cat/more source Message-ID: <1990Nov6.042942.11314@wpi.WPI.EDU> Date: 6 Nov 90 04:29:42 GMT Sender: greyelf@wpi.WPI.EDU (Michael J Pender) Organization: Worcester Polytechnic Institute Lines: 122 The following is the source files to create the routines pr, more, and cat. To make best use of them put them in the bin directory. --- Michael J Pender Jr Box 1942 c/o W.P.I. Part of this D- belongs to greyelf@wpi.bitnet 100 Institute Rd. God... greyelf@wpi.wpi.edu Worcester, Ma 01609 - B. Simpson /* * pr.c -- A simple little routine that writes the contents of * a file to the printer. Good for making copies of instructions * or program listings. * print cat would also work, but I learned about * the print command after the fact... * * A simple filter is used to print only normal characters, * newlines, and tabs. This prevents your printer from trying * to digest 8-bit binary data. * * Freeware - enjoy, but keep me up to date * on developments in Hyper C. * Mike Pender a.k.a. greyelf@wpi.wpi.edu * 1480 Mapleton Ave * Suffield, CT 06078 */ #include main(ac, av) int ac; TEXT **av; { char c; FILE *fp = open (av[1],"r"); _prtinit(1); _prtonly(); while ((c=getc(fp)) != -1) if (c >= ' ' && c < 0x7f || c == '\n' || c == '\t') putchr(c); _vidonly(); } /* -- end of pr.c -- */ /* * cat.c -- A little routine that writes the contents of * a file to the screen, nonstop. Good for viewing contents * of files or program listings. * print cat works just like pr . * * A simple filter is used to print only normal characters, * newlines and tabs. The screen doesn't like being fed 8-bit * characters. Some of the escape codes really mess things up. * * freeware - enjoy, but keep me up to date * on developments in Hyper C. * Mike Pender a.k.a. greyelf@wpi.wpi.edu * 1480 Mapleton Ave * Suffield, CT 06078 */ #include main(ac, av) int ac; TEXT **av; { char c; FILE *fp = open (av[1],"r"); while ((c=getc(fp)) != -1) if (c >= ' ' && c < 0x7f || c == '\n' || c == '\t') putchr(c); } /* -- end of cat.c -- */ /* * more.c -- A little routine that writes the contents of * a file to the screen, but pauses at the end of each page * Good for viewing contents of files or program listings. * print cat works better than print more * because the printer would pause after every page. * * A simple filter is used to print only normal characters, * newlines and tabs. The screen doesn't like being fed 8-bit * characters. Some of the escape codes really mess things up. * * freeware - enjoy, but keep me up to date * on developments in Hyper C. * Mike Pender a.k.a. greyelf@wpi.wpi.edu * 1480 Mapleton Ave * Suffield, CT 06078 */ #include #define height 24 main(ac, av) int ac; TEXT **av; { char c, p; char cnt = 0; FILE *fp = open (av[1],"r"); while ((c=getc(fp)) != -1) { if (c == '\n' && ++cnt == height) /* uses the partial evaluation */ { /* of if statement to increment */ p = getkey(); /* counter */ if (p == 'q' || p == 'Q') { putchr('\n'); return(1);} cnt = 0; } if (c >= ' ' && c < 0x7f || c == '\n' || c == '\t') putchr(c); } } /* -- end of more.c -- */ -- --- Michael J Pender Jr Box 1942 c/o W.P.I. Part of this D- belongs to greyelf@wpi.bitnet 100 Institute Rd. God...