💾 Archived View for mirrors.apple2.org.za › archive › ground.icaen.uiowa.edu › Srcs › strip8.c captured on 2024-06-16 at 14:28:02.

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

Received: by KSUVM (Mailer R2.07) id 9775; Mon, 08 Oct 90 23:10:34 CDT
Date:         Tue, 9 Oct 90 00:05:21 EDT
Reply-To:     Apple II List <APPLE2-L@BROWNVM.BITNET>
Sender:       Apple II List <APPLE2-L@BROWNVM.BITNET>
From:         cwilson@nisc.sri.com
Subject:      strip8.c, unix-type util for striping 8th bit
To:           "Steven E. Nelson" <CMDSENPG@UIAMVS.BITNET>
 
Due to the fact I haven't gotten around to creating comp.sources.apple2,
this appears on comp.binaries.apple2.  It's a quick little C hack
to strip the 8th bit off a file.  Should run on any unix box,
compile with 'cc -o strip8 strip8.c' type idea.
tested on sun systems..
 
oh, prints to stdout...
 
---------->snip<---------------------->snip<---------------------->snip<--------
 ----
#include <stdio.h>../* standard io */
 
main (argc,argv)
int argc;
char *argv[];
 
{
int.a;
char prog[10];
FILE.*fpointer;
 
if (argc>1)..../* check for filename arg */
  {
    strcpy(prog,argv[0]);
 
    if (!(fpointer=fopen(argv[1],"r")))./* check for existence */
.{
 .  perror(prog);
.  exit(1);
.}
    printf("%s:",argv[1]);
  }
else fpointer=stdin;.../* no filename, use stdin */
 
  do
    {
      if((a=fgetc(fpointer))==EOF) break;./* exit if eof */
      a &= 0x7f;
      if (a==13) printf("\n");
      else printf("%c",a);
 
    } while (!feof(fpointer));.../* do until all done */
printf("\n");
fclose(fpointer);
}
 
---------->snip<---------------------->snip<---------------------->snip<--------
 ----