[comp.unix.ultrix] printcap for hp laserjet ii

kerm@mcnc.org (Cary E. Burnette) (08/11/89)

I have recently installed a HP Laserjet II on one of our 
computers. I have been able to print regular files (ASCII)
with no problem. But we need to be able to print tex files
we have dvi-to-hp program that produces the correct file.
But when we use the lpr command we get nothing put garbage.
We think the control signals are getting filtered out, how
can we prevent this.

Thanks

Cary E. Burnette

kerm@mcnc.org

grr@cbmvax.UUCP (George Robbins) (08/11/89)

In article <1319@speedy.mcnc.org> kerm@mcnc.org (Cary E. Burnette) writes:
> I have recently installed a HP Laserjet II on one of our 
> computers. I have been able to print regular files (ASCII)
> with no problem. But we need to be able to print tex files
> we have dvi-to-hp program that produces the correct file.
> But when we use the lpr command we get nothing put garbage.
> We think the control signals are getting filtered out, how
> can we prevent this.

Most of the filters do peculiar and undocumented things.  Some, like
ln03rof, do fewer peculiar things than ln03, so you might want to
give that a try.  When in doubt, specifying /bin/cat for the
"accounting filter" is a good starting point.

I posted the source for the BSD 4.3, "do almost nothing" filter where a
while ago, send e-mail if you can't find it and could use a copy...

Remember, there is a section on the printer spooler in the supplementary
documents - the system is more complicated, flexible and perverse than
meets the eye, but not as bad as it seems when you're looking at all
the printcap options...  8-) [sorry, it's getting late]

-- 
George Robbins - now working for,	uucp: {uunet|pyramid|rutgers}!cbmvax!grr
but no way officially representing	arpa: cbmvax!grr@uunet.uu.net
Commodore, Engineering Department	fone: 215-431-9255 (only by moonlite)

dan@asihub.UUCP (Dan O'Neill) (08/12/89)

Here is a copy of the "generic" filter as posted by George Robbins a
while back.


#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	Makefile
#	lpf.c
# This archive created: Wed Jul 12 04:11:28 1989
export PATH; PATH=/bin:$PATH
echo shar: extracting "'Makefile'" '(1418 characters)'
if test -f 'Makefile'
then
	echo shar: will not over-write existing file "'Makefile'"
else
sed 's/^	X//' << \SHAR_EOF > 'Makefile'
	X#
	X# Copyright (c) 1987 Regents of the University of California.
	X# All rights reserved.
	X#
	X# Redistribution and use in source and binary forms are permitted
	X# provided that the above copyright notice and this paragraph are
	X# duplicated in all such forms and that any documentation,
	X# advertising materials, and other materials related to such
	X# distribution and use acknowledge that the software was developed
	X# by the University of California, Berkeley.  The name of the
	X# University may not be used to endorse or promote products derived
	X# from this software without specific prior written permission.
	X# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
	X# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
	X# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
	X#
	X#	@(#)Makefile	5.5 (Berkeley) 6/30/88
	X#
	XCFLAGS=	-O
	XLIBC=	/lib/libc.a
	XLIBDIR=	/usr/lib
	XSRCS=	lpf.c
	XOBJS=	lpf.o
	X
	Xall: lpf
	X
	Xlpf: lpf.c
	X	${CC} -o $@ ${CFLAGS} lpf.c
	X
	Xclean: FRC
	X	rm -f ${OBJS} core lpf
	X
	Xdepend: FRC
	X	mkdep -p ${CFLAGS} ${SRCS}
	X
	Xinstall: FRC
	X	install -s -o bin -g bin -m 755 lpf ${DESTDIR}/${LIBDIR}/lpf
	X
	Xlint: FRC
	X	lint ${CFLAGS} ${SRCS}
	X
	Xtags: FRC
	X	ctags ${SRCS}
	X
	XFRC:
	X
	X# DO NOT DELETE THIS LINE -- mkdep uses it.
	X# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
	X
	Xlpf: lpf.c /usr/include/stdio.h /usr/include/signal.h
	Xlpf: /usr/include/machine/trap.h
	X
	X# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
SHAR_EOF
if test 1418 -ne "`wc -c < 'Makefile'`"
then
	echo shar: error transmitting "'Makefile'" '(should have been 1418 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'lpf.c'" '(4323 characters)'
if test -f 'lpf.c'
then
	echo shar: will not over-write existing file "'lpf.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'lpf.c'
	X/*
	X * Copyright (c) 1983 Regents of the University of California.
	X * All rights reserved.
	X *
	X * Redistribution and use in source and binary forms are permitted
	X * provided that the above copyright notice and this paragraph are
	X * duplicated in all such forms and that any documentation,
	X * advertising materials, and other materials related to such
	X * distribution and use acknowledge that the software was developed
	X * by the University of California, Berkeley.  The name of the
	X * University may not be used to endorse or promote products derived
	X * from this software without specific prior written permission.
	X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
	X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
	X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
	X */
	X
	X#ifndef lint
	Xchar copyright[] =
	X"@(#) Copyright (c) 1983 Regents of the University of California.\n\
	X All rights reserved.\n";
	X#endif /* not lint */
	X
	X#ifndef lint
	Xstatic char sccsid[] = "@(#)lpf.c	5.3 (Berkeley) 6/30/88";
	X#endif /* not lint */
	X
	X/*
	X * 	filter which reads the output of nroff and converts lines
	X *	with ^H's to overwritten lines.  Thus this works like 'ul'
	X *	but is much better: it can handle more than 2 overwrites
	X *	and it is written with some style.
	X *	modified by kls to use register references instead of arrays
	X *	to try to gain a little speed.
	X */
	X
	X#include <stdio.h>
	X#include <signal.h>
	X
	X#define MAXWIDTH  132
	X#define MAXREP    10
	X
	Xchar	buf[MAXREP][MAXWIDTH];
	Xint	maxcol[MAXREP] = {-1};
	Xint	lineno;
	Xint	width = 132;	/* default line length */
	Xint	length = 66;	/* page length */
	Xint	indent;		/* indentation length */
	Xint	npages = 1;
	Xint	literal;	/* print control characters */
	Xchar	*name;		/* user's login name */
	Xchar	*host;		/* user's machine name */
	Xchar	*acctfile;	/* accounting information file */
	X
	Xmain(argc, argv) 
	X	int argc;
	X	char *argv[];
	X{
	X	register FILE *p = stdin, *o = stdout;
	X	register int i, col;
	X	register char *cp;
	X	int done, linedone, maxrep;
	X	char ch, *limit;
	X
	X	while (--argc) {
	X		if (*(cp = *++argv) == '-') {
	X			switch (cp[1]) {
	X			case 'n':
	X				argc--;
	X				name = *++argv;
	X				break;
	X
	X			case 'h':
	X				argc--;
	X				host = *++argv;
	X				break;
	X
	X			case 'w':
	X				if ((i = atoi(&cp[2])) > 0 && i <= MAXWIDTH)
	X					width = i;
	X				break;
	X
	X			case 'l':
	X				length = atoi(&cp[2]);
	X				break;
	X
	X			case 'i':
	X				indent = atoi(&cp[2]);
	X				break;
	X
	X			case 'c':	/* Print control chars */
	X				literal++;
	X				break;
	X			}
	X		} else
	X			acctfile = cp;
	X	}
	X
	X	for (cp = buf[0], limit = buf[MAXREP]; cp < limit; *cp++ = ' ');
	X	done = 0;
	X	
	X	while (!done) {
	X		col = indent;
	X		maxrep = -1;
	X		linedone = 0;
	X		while (!linedone) {
	X			switch (ch = getc(p)) {
	X			case EOF:
	X				linedone = done = 1;
	X				ch = '\n';
	X				break;
	X
	X			case '\f':
	X				lineno = length;
	X			case '\n':
	X				if (maxrep < 0)
	X					maxrep = 0;
	X				linedone = 1;
	X				break;
	X
	X			case '\b':
	X				if (--col < indent)
	X					col = indent;
	X				break;
	X
	X			case '\r':
	X				col = indent;
	X				break;
	X
	X			case '\t':
	X				col = ((col - indent) | 07) + indent + 1;
	X				break;
	X
	X			case '\031':
	X				/*
	X				 * lpd needs to use a different filter to
	X				 * print data so stop what we are doing and
	X				 * wait for lpd to restart us.
	X				 */
	X				if ((ch = getchar()) == '\1') {
	X					fflush(stdout);
	X					kill(getpid(), SIGSTOP);
	X					break;
	X				} else {
	X					ungetc(ch, stdin);
	X					ch = '\031';
	X				}
	X
	X			default:
	X				if (col >= width || !literal && ch < ' ') {
	X					col++;
	X					break;
	X				}
	X				cp = &buf[0][col];
	X				for (i = 0; i < MAXREP; i++) {
	X					if (i > maxrep)
	X						maxrep = i;
	X					if (*cp == ' ') {
	X						*cp = ch;
	X						if (col > maxcol[i])
	X							maxcol[i] = col;
	X						break;
	X					}
	X					cp += MAXWIDTH;
	X				}
	X				col++;
	X				break;
	X			}
	X		}
	X
	X		/* print out lines */
	X		for (i = 0; i <= maxrep; i++) {
	X			for (cp = buf[i], limit = cp+maxcol[i]; cp <= limit;) {
	X				putc(*cp, o);
	X				*cp++ = ' ';
	X			}
	X			if (i < maxrep)
	X				putc('\r', o);
	X			else
	X				putc(ch, o);
	X			if (++lineno >= length) {
	X				fflush(o);
	X				npages++;
	X				lineno = 0;
	X			}
	X			maxcol[i] = -1;
	X		}
	X	}
	X	if (lineno) {		/* be sure to end on a page boundary */
	X		putchar('\f');
	X		npages++;
	X	}
	X	if (name && acctfile && access(acctfile, 02) >= 0 &&
	X	    freopen(acctfile, "a", stdout) != NULL) {
	X		printf("%7.2f\t%s:%s\n", (float)npages, host, name);
	X	}
	X	exit(0);
	X}
SHAR_EOF
if test 4323 -ne "`wc -c < 'lpf.c'`"
then
	echo shar: error transmitting "'lpf.c'" '(should have been 4323 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0
-- 
Dan O'Neill	dan@asihub.uucp    {uunet|ncr-sd}!asihub!dan
Automated Systems, Inc.  San Diego R&D

braun@dri.com (Karl T. Braun (kral)) (10/31/90)

I'm looking for a printcap entry for a Laserjet II.

Thanx,

-- 
kral * 408/647-6112 *               ...!uunet!drivax!braun * braun@dri.com
That which does not kill us Makes us stronger - Nietzche