laser on xenix

William E. Davidsen Jr davidsen at steinmetz.ge.com
Wed Apr 13 07:19:52 AEST 1988


In article <3799 at dasys1.UUCP> pechter at dasys1.UUCP (Bill Pechter) writes:
| Anyone have a good filter for an Okidata laser printer (hp l-jet
| compatible) which doesn't do newline expansion to carriage return
| newline.   The darn thing's on a parallel port which rules out stty.

  I have been running my lj+ on a parallel port for two years. Here is
my filter, and since it can download fonts and characteristics, I
include my interface routine and characteristics, too.

  I sent the characteristics files in binary mode, since they lack
trailing newlines and have some control characters embedded. If you lack
uudecode you is in DEEP trouble.

  The files names LJ.NNNxNN and LJ.NNNxNNm are formats. The NNN is the
width, and the NN lines per page. A trailing 'm' means force a left
margin of 1/2 inch. The land8 and land16 are landscape fonts, 16 cpi and
8 point. There are a few others, one 16 pitch 8 point and a reset. The
interface routine loads them. Note that '-or' is the raw option and
doesn't use filter.

  I don't know what you do for newline mapping, this has worked just
fine for me.

#!/bin/sh
# shar:	Shell Archiver  (v1.15)
#
#	Run the following text with /bin/sh to create:
#	  lj.c
#	  ljet.int
#	  LJ.102x66
#	  LJ.102x66m
#	  LJ.102x68m
#	  LJ.132x100
#	  LJ.132x100m
#	  LJ.132x90m
#	  LJ.land16
#	  LJ.land8
#	  LJ.reset
#
echo "x - extracting lj.c (Text)"
sed 's/^X//' << 'Dog Germs' > lj.c
X/*****************************************************************
X |  lj - HP Laserjet output filter
X |----------------------------------------------------------------
X |  Author: Bill Davidsen 10-5-86
X |
X |  Adds returns before newlines and expands tabs
X ****************************************************************/
X
X#include <stdio.h>
X
X#define TRUE	1
X#define FALSE	0
X
Xmain ()
X{
X    register int  ch,		/* input character */
X                  column = 0,	/* for tab expansion */
X                  wasret = FALSE; /* flag if last char was RETURN */
X
X    while ((ch = getchar ()) != EOF)
X    { /* check for newline, add return */
X	switch (ch) {
X	case '\n': /* newline */
X	    if (!wasret)
X		putchar ('\r');
X	case '\r': /* return */
X	    column = 0;
X	    wasret = TRUE;
X	    break;
X	case '\t': /* tab */
X	    while ((column++ & 7) != 7)
X	    { /* tab via spaces */
X		putchar (' ');
X	    }
X	    wasret = FALSE;
X	    ch = ' '; /* output as blank */
X	    break;
X	default: /* anything else */
X	    column++;
X	    wasret = FALSE;
X	}
X
X	putchar (ch);
X    }
X}
Dog Germs
chmod 0644 lj.c
echo "x - extracting ljet.int (Text)"
sed 's/^X//' << 'Dog Germs' > ljet.int
X:
X#	%Z% %M% %I% %D% %Q%
X#
X#	Copyright (C) The Santa Cruz Operation, 1985.
X#	This Module contains Proprietary Information of
X#	The Santa Cruz Operation, Microsoft Corporation
X#	and AT&T, and should be treated as Confidential.
X#
X#!	HP Laserjet+ printer
X#
Xprinter=`basename $0`
Xrequest=$1
Xname=$2
Xtitle=$3
Xcopies=$4
Xoptions=$5
Xshift; shift; shift; shift; shift
X
X# If it is necessary to change the baud rate or other stty settings for
X# your serial printer insert a line similar to the following here:
X# stty option ... 0<&1
X
X# reset the printer
Xecho "\033E\c"
X
X# border around the banner
Xx="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
X
X# the fifth field of the /etc/passwd file is assigned to the variable user
Xuser=`sed -n "s/^$name:.*:.*:.*:\(.*\):.*:.*$/\1/p" /etc/passwd`
X
X# nhead gets the value of BANNERS or 1 by default
Xnhead=`sed -n 's/^BANNERS=//p' /etc/default/lpd`
X[ "$nhead" -ge 0 -a "$nhead" -le 5 ] || nhead=1
X
X# print the banner $nhead times
Xwhile	[ "$nhead" -gt 0 ]
Xdo
X	echo "$x\n"
X	banner "$name"
X	echo "$x\n"
X	[ "$user" ] && echo "User: $user\n"
X	echo "Request id: $request\n"
X	echo "Printer: $printer\n"
X	date
X	echo
X	[ "$title" ] && banner $title
X	echo "\f\c"
X	nhead=`expr $nhead - 1`
Xdone | /local/bin/lj
X
X# set initial option values
Xdispprog=/local/bin/lj
X
X# process option(s)
Xfor opt in $options
Xdo	case $opt in
X	16)	# 16 pitch
X		cat /local/etc/LJ.132x100;;
X	16m)	# 16 pitch with 3/4" margin
X		cat /local/etc/LJ.132x100m;;
X	16m8)	# 16 pitch with margin, 8.5 point
X		cat /local/etc/LJ.132x90m;;
X	12)	# 12 point/pitch
X		cat /local/etc/LJ.102x66;;
X	m|12m)	# 12 pitch with 3/4" margin
X		cat /local/etc/LJ.102x66m;;
X	r)	#raw mode
X		dispprog=cat;;
X	esac
Xdone
X
X# send the file(s) to the standard out $copies times
Xwhile	[ "$copies" -gt 0 ]
Xdo	filenum=1
X	for file
X	do
X		nice -4 $dispprog <$file 2>&1
X		if [ $filenum -lt $# ]
X		then	echo "\f\c"
X			filenum=`expr $filenum + 1`
X		fi
X	done
X	copies=`expr $copies - 1`
Xdone
X
X# reset the printer
Xecho "\033E\c"
X
Xexit 0
Dog Germs
chmod 0755 ljet.int
echo "x - extracting LJ.102x66 (Binary)"
sed 's/^X//' << 'Dog Germs' > ._temp_
Xbegin 600 LJ.102x66
X8&T4;*',Q,'8Q,D@;)FPT93<N-#5C-C9&
X`
Xend
Dog Germs
echo "uudecoding file LJ.102x66"
uudecode < ._temp_ && rm -f ._temp_
chmod 0644 LJ.102x66
echo "x - extracting LJ.102x66m (Binary)"
sed 's/^X//' << 'Dog Germs' > ._temp_
Xbegin 600 LJ.102x66m
X=&T4;*',Q,'8Q,D@;)FPT93<N,#5C-C9&&R9A.4P`
X`
Xend
Dog Germs
echo "uudecoding file LJ.102x66m"
uudecode < ._temp_ && rm -f ._temp_
chmod 0644 LJ.102x66m
echo "x - extracting LJ.102x68m (Binary)"
sed 's/^X//' << 'Dog Germs' > ._temp_
Xbegin 600 LJ.102x68m
X=&T4;*',Q,'8Q,D@;)FPT93<N,#5C-CA&&R9A.4P`
X`
Xend
Dog Germs
echo "uudecoding file LJ.102x68m"
uudecode < ._temp_ && rm -f ._temp_
chmod 0644 LJ.102x68m
echo "x - extracting LJ.132x100 (Binary)"
sed 's/^X//' << 'Dog Germs' > ._temp_
Xbegin 600 LJ.132x100
X9&T4;*',W=C$V+C5(&R9L,F4T+CAC,3(P1@``
X`
Xend
Dog Germs
echo "uudecoding file LJ.132x100"
uudecode < ._temp_ && rm -f ._temp_
chmod 0644 LJ.132x100
echo "x - extracting LJ.132x100m (Binary)"
sed 's/^X//' << 'Dog Germs' > ._temp_
Xbegin 600 LJ.132x100m
X?&T4;*',W=C$V+C5(&R9L,F4T+CAC,3(P1ALF83$R3``+
X`
Xend
Dog Germs
echo "uudecoding file LJ.132x100m"
uudecode < ._temp_ && rm -f ._temp_
chmod 0644 LJ.132x100m
echo "x - extracting LJ.132x90m (Binary)"
sed 's/^X//' << 'Dog Germs' > ._temp_
Xbegin 600 LJ.132x90m
XB&T4;*',X+C5V,38N-4@;)FPR934N,S-C,3(P1ALF83$R3```
X`
Xend
Dog Germs
echo "uudecoding file LJ.132x90m"
uudecode < ._temp_ && rm -f ._temp_
chmod 0644 LJ.132x90m
echo "x - extracting LJ.land16 (Binary)"
sed 's/^X//' << 'Dog Germs' > ._temp_
Xbegin 600 LJ.land16
XD&T4;)FPQ;S at N,T0;*#A5&RAS,'`Q-BXV:#@N-78P<S!B,%0*
X`
Xend
Dog Germs
echo "uudecoding file LJ.land16"
uudecode < ._temp_ && rm -f ._temp_
chmod 0644 LJ.land16
echo "x - extracting LJ.land8 (Binary)"
sed 's/^X//' << 'Dog Germs' > ._temp_
Xbegin 600 LJ.land8
X=&T4;)FPQ3QLH.%4;*',P<#$P:#$R=C!S,&(S5`H`
X`
Xend
Dog Germs
echo "uudecoding file LJ.land8"
uudecode < ._temp_ && rm -f ._temp_
chmod 0644 LJ.land8
echo "x - extracting LJ.reset (Binary)"
sed 's/^X//' << 'Dog Germs' > ._temp_
Xbegin 600 LJ.reset
X"&T44
X`
Xend
Dog Germs
echo "uudecoding file LJ.reset"
uudecode < ._temp_ && rm -f ._temp_
chmod 0644 LJ.reset
exit 0

-- 
	bill davidsen		(wedu at ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.unix.xenix mailing list