[comp.sys.apple2] Hyper C pr/cat/more source

greyelf@wpi.WPI.EDU (Michael J Pender) (11/06/90)

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 <filename> 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 <std.h>

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 <filename> works just like pr <filename>.
 *
 * 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 <std.h>

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 <filename> works better than print more <filename>
 * 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 <std.h>
#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...  

gwyn@smoke.brl.mil (Doug Gwyn) (11/07/90)

In article <1990Nov6.042942.11314@wpi.WPI.EDU> greyelf@wpi.WPI.EDU (Michael J Pender) writes:
>The following is the source files to create the routines pr, more, and cat.

While this contribution was nice, it would be more useful if posted to
the comp.sources.apple2 USEnet newsgroup (or directly mailed to
jac@paul.rutgers.edu, who is the moderator of that newsgroup).  That
way the sources would be kept on-line at an archive site, rather than
perish when the current article expired.

greyelf@wpi.WPI.EDU (Michael J Pender) (11/08/90)

In article <14352@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes:
>While this contribution was nice, it would be more useful if posted to
>the comp.sources.apple2 USEnet newsgroup (or directly mailed to
>jac@paul.rutgers.edu, who is the moderator of that newsgroup).  That
>way the sources would be kept on-line at an archive site, rather than
>perish when the current article expired.

I tried, but out mailer decided it couldn't find comp.sources.apple2, 
nor comp.binaries.apple2.

Our mailer sucks.

---
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
-- 
---
Michael J Pender Jr  Box 1942 c/o W.P.I.   Part of this D- belongs to 
greyelf@wpi.bitnet   100 Institute Rd.     God...  

gwyn@smoke.brl.mil (Doug Gwyn) (11/09/90)

In article <1990Nov8.044251.8210@wpi.WPI.EDU> greyelf@wpi.WPI.EDU (Michael J Pender) writes:
>I tried, but out mailer decided it couldn't find comp.sources.apple2, 
>nor comp.binaries.apple2.

This has nothing to do with mailers; those are names of USEnet newsgroups.
I don't think anyone has set up an Internet mailing list for either of them,
although I do know that there is an archive server for the binaries.  (You
mail it your requests and it responds by sending you the files you asked for.)
I'll let somebody directly associated with them fill in the details.