Date: Fri, 29 Dec 1995 14:37:13 +0000 () From: James Raynard <james@parody.tecc.co.uk> To: doc@freebsd.org Subject: Handbook - printer setup Message-ID: <Pine.BSF.3.91.951229135243.322B-100000@parody.tecc.co.uk>
index | next in thread | raw e-mail
I spent most of last night trying to set up a printer for the first time
ever under Unix following the Handbook step-by-step. On the whole, it was
quite a good set of instructions, but there were one or two points that
may be worth picking up.
Due to the staircase effect, the "Printer on a Parallel Port" test
appeared to only produce one line of output on my DeskJet 520, which was
a bit alarming until I realised what was happening. It does say "You should
see something print. Don't worry if the text doesn't look right; we'll
fix such things later"; perhaps this could be changed to "You should see
something print. Don't worry if the text doesn't look right, or if it
disappears at the end of the first line; we'll fix such things later."?
The bit that really had me tearing my hair out was when I tried to use
the suggested text filter - I kept getting errors 'execv of
/usr/local/libexec/hpif failed'. After checking the paths and were correct,
checking that the filter was world-readable and executable and successfully
piping into and out of the filter by hand I was at a complete loss.
I then noticed that the supplied /usr/libexec/lpf didn't have this problem.
It did cross my mind that it could be a problem with something being setuid.
However, the Handbook says that the text filter is run by lpd, which is not
setuid or setgid on my system, so I assumed it was something else.
As I had by now completely run out of ideas, I compiled a C program which
did the same as hpif. This worked! So the only explanation I can think of
is that it is a setuid problem and it's actually one of the other lp?
programs which execv's the filter (sorry, I know nothing about how print
spoolers work).
Anyway, something needs changing in this part of the documentation. If it's
any use, here's the C program I used:-
#include <stdio.h>
#define LINELEN 255
#define INITSTR "\033&k2G"
main() {
char buf[LINELEN];
if (printf(INITSTR) == 0)
exit(2);
while (fgets(buf, LINELEN, stdin))
printf(buf);
printf("\f");
return 0;
}
(Yes, this is the first time I've ever checked the return value from
printf 8-)
And here's the one I used for Ghostscript (I used different printer
names for text and gs, so I didn't bother with the magic number test):-
#include <stdio.h>
#define LINELEN 255
main() {
char buf[LINELEN];
FILE *fp;
if ((fp = popen("/usr/local/bin/gs -dSAFER -dNOPAUSE -q \
-sDEVICE=deskjet -sOutputFile=- -", "w")) == NULL)
exit(2);
while (fread(buf, 1, LINELEN, stdin) == LINELEN)
if(fwrite(buf, 1, LINELEN, fp) != LINELEN)
exit(2);
pclose(fp);
printf("\f");
return 0;
}
This had me tearing my hair out as well, due to a Ghostscript bug which
I've reported to them (it was using an undocumented feature of the
DeskJet500 that doesn't work on my DJ520), but that's another story!
Cheers
James
Segmentation fault (core dumped): cannot find file '.signature'
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.951229135243.322B-100000>
