jim@piggy.ucsb.edu (Oreo Cat) (09/08/90)
I recently had trouble printing out some postscript files which I had received over the net. I tracked it down the problem and discovered that the computer and printer where only talking to each other in 7-bits, but the files had some 8-bit codes. I had never noticed this problem before because most software will send these codes as octal escape sequences. So I wrote up the below attached filter to convert any stray 8-bit characters to their respective octal escape sequences. Nothing all that special, but it could save someone a lot of work someday. Also I strongly recommend anyone distributing postscript documents to use this filter to save headaches. (If anyone has a /etc/printcap that lets a Apple Laserwriter + and Sun Sparcstation 1 talk 8-bits, please let me know!!) Jim Lick Work: University of California | Home: 6657 El Colegio #24 Santa Barbara | Isla Vista, CA 93117-4280 Dept. of Mechanical Engr. | (805) 968-0189 voice 2311 Engr II Building | (805) 968-1239 data 1 (805) 893-4113 | (805) 968-2734 data 2 jim@ferkel.ucsb.edu | bahamut!jim@ivucsb.sba.ca.us --- CUT HERE --- /* ** Copyright (C) 1990 by Jim Lick ** jim@ferkel.ucsb.edu ** bahamut!jim@ivucsb.sba.ca.us ** ** ps8to7.c ** ** This program filters postscript code to convert any 8-bit characters ** to octal coding for printing or file transfer over 7-bit channels. */ #include <stdio.h> main() { unsigned char c; while(!feof(stdin)) { c=getchar(); if(c<128) putchar(c); else printf("\\%o",c); } }