Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!ucbvax!NISC.SRI.COM!cwilson From: cwilson@NISC.SRI.COM (Chan Wilson) Newsgroups: comp.binaries.apple2 Subject: strip8.c, unix-type util for striping 8th bit Message-ID: <20805@fs2.NISC.SRI.COM> Date: 7 Sep 90 08:25:38 GMT Reply-To: cwilson@NISC.SRI.COM (Chan Wilson) Organization: Network Info Systems Ctr., SRI Intl., Menlo Park, CA. Lines: 47 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 /* 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<------------