Return to BSD News archive
Newsgroups: comp.os.386bsd.apps Path: sserve!csadfa.cs.adfa.oz.au!wkt From: wkt@csadfa.cs.adfa.oz.au (Warren Toomey) Subject: Print PostScript on your dot-matrix (lpd filter) Message-ID: <1993Jul21.064015.18574@sserve.cc.adfa.oz.au> Sender: news@sserve.cc.adfa.oz.au Organization: Australian Defence Force Academy, Canberra, Australia Date: Wed, 21 Jul 1993 06:40:15 GMT Here's a small hack: a lpd filter that determines if the incoming job is a PS file, and redirects it to ghostscript to produce a bit image which then comes out onto your dot-matrix printer. It's a nasty hack -- anybody who can make a better one, please do! The filter is set up to produce Epson fx80 output, but you can change the source easily to produce laserjet or bubblejet output. Non-PS files go straight to the dot matrix as text format. The printcap entry I use is: # @(#)printcap 5.3 (Berkeley) 6/30/90 lp|lp0|uts|local line printer:\ :lp=/dev/lpt0:sd=/var/spool/lpd:lf=/var/log/lpd-errs:pw#80:\ :if=/usr/tmp/gsfilter:sh: and the filter (gsfilter.c) is below. Cheers, Warren wkt@csadfa.cs.adfa.oz.au /* Filter to check if the input for the printer is PostScript * ( %! as first two characters), and if so, redirect the output * to Ghostscript. Otherwise, pass as is to the printer. * * Written by Warren Toomey wkt@csadfa.cs.adfa.oz.au */ #include <stdio.h> #define GS_PROGRAM "/usr/local/bin/gs -q -I/usr/local/X11/lib/ghostscript -sDEVICE=eps9high -sOutputFile=- -" FILE * popen(); char buf[1024]; main() { FILE *gsout; int i; int c; c= fgetc(stdin); /* Get the first character */ if (c==-1) { fprintf(stderr, "gsfilter: No input chars\n"); exit(1); /* Failed, give up */ } if (c != '%') { ungetc(c, stdin); /* Not PS, push back, and go to normal */ goto normal; /* Yuk, a goto */ } c= fgetc(stdin); /* Get the second character */ if (c==-1) { ungetc(c, stdin); /* Not PS, push back, and go to normal */ goto normal; /* Yuk, a goto */ } if (c != '!') { ungetc(c, stdin); /* Not PS, push back, and go to normal */ ungetc('%', stdin); goto normal; /* Yuk, a goto */ } ghostscript: ungetc('!', stdin); /* Push back the %! */ ungetc('%', stdin); /* * Why can't I just execlp() here, instead of popen()ing a pipe? */ gsout= popen( GS_PROGRAM, "w"); /* Open a pipe to gs, and send */ while ((i = fread(buf, 1, 1024, stdin)) > 0) fwrite(buf, 1, i, gsout); pclose(gsout); exit(0); normal: while ((i = fread(buf, 1, 1024, stdin)) > 0) /* Cat our stdin */ fwrite(buf, 1, i, stdout); exit(0); } #! rnews 1378 sserve.cc.adfa.oz.au Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!elroy.jpl.nasa.gov!swrinde!cs.utexas.edu!natinst.com!hrd769.brooks.af.mil!hrd769.brooks.af.mil!not-for-mail From: burgess@hrd769.brooks.af.mil (Dave Burgess) Newsgroups: comp.os.386bsd.questions Subject: Re: Sorry, I lost the 'drive light on and locked' patch. Date: 20 Jul 1993 16:41:18 -0500 Organization: Armstrong Laboratory, Brooks AFB, TX Lines: 25 Message-ID: <22hoqc$67d@hrd769.brooks.af.mil> References: <22gd69$6j3@hrd769.brooks.af.mil> <22helq$qe6@pdq.coe.montana.edu> NNTP-Posting-Host: hrd769.brooks.af.mil In article <22helq$qe6@pdq.coe.montana.edu> nate@bsd.coe.montana.edu (Nate Williams) writes: }In article <22gd69$6j3@hrd769.brooks.af.mil> burgess@hrd769.brooks.af.mil (Dave Burgess) writes: }> }>There was some discussion about three weeks ago about the system hang }>where the hard drive locks up with the the drive light lit. Someone, }>whose name I have regretfully forgotten, posted either a description of }>a change that (s)he had made to the system that reset the drive. } }rm /dev/drum }touch /dev/drum } }(Maybe this should go in the FAQ. *grin*) } } Not that one; it is already in the FAQ *grin* (well the pre-faq anyway). I will try this and see if it helps. It sure can't hurt... -- ------ TSgt Dave Burgess NCOIC AL/Management Information Systems Office Brooks AFB, TX