#!/usr/bin/sh
# (c) Copyright 1993,1994 Hewlett-Packard Company. All Rights Reserved.
#@(#) $Header: /users/hpnp/odyssey/repository/sh/net_lj3plus.psh,v 1.19 1999/10/12 09:28:40 hpnp Exp $
#-----------------------------------------------------------------------
# USER CAUTION: If any changes are desired, you should first make a copy
# of this model under a new name. Changes can then be made to the copy
#-----------------------------------------------------------------------
PERSONALTY="AUTO" # CHANGE LANGUAGE
TOPCL=/opt/hpnp/sh/topcl
TOPS=/opt/hpnp/sh/tops
HPNPS=/opt/hpnp/bin/hpnps
log=/var/adm/lp/log
# [ Modified by Suresha on 26th Sep 99 to support JPIU
TOPCL=/opt/hpnpl/sh/topcl
TOPS=/opt/hpnpl/sh/tops
HPNPS=/opt/hpnpl/bin/hpnps
# end of change by suresha ]
BANNER="yes" # CHANGE BANNER PAGE PRINTING
TMP=/var/tmp
# [ Modify by the Amit R. to solve the problem of security on 20th Feb. 1998
HPNP=/opt/hpnp
# [ Modified by Suresha on 26th Sep 99 to support JPIU
HPNP=/opt/hpnpl
# end of change by suresha ]
# [ Commented by Vijay to remove support of 2up and 4up on 26/7/99
#MPAGE=$HPNP/bin/mpage #Added by Ramki on 14th Oct 98 for PSNUP
# End of change by Vijay ]
ID=/usr/bin/id
CUT=/usr/bin/cut
AWK=/usr/bin/awk
MKDIR=/usr/bin/mkdir
USERNAME=`$ID | $CUT -f1 -d" " | $CUT -f2 -d"(" | $CUT -f1 -d")"` # get user name
if [ $USERNAME = "root" -o $USERNAME = "lp" ]
then
TMP=$HPNP/tmp
else
/usr/bin/sun > /dev/null 2>&1
if [ $? -eq 0 ]
then
# [ Modified by Amit Raval to fix the defect#57434 on 20th Apr. 1999
# HOME=`$AWK 'BEGIN { FS=":" }
# {if ( $1 == UNAME) print $6 ; }' UNAME=$USERNAME /etc/passwd` # get home dir. from /etc/passwd
JAHOME=`$AWK 'BEGIN { FS=":" }
{if ( $1 == UNAME) { print $6 ; exit } }' UNAME=$USERNAME /etc/passwd` # get home dir. from /etc/passwd
# ]
else
# [ Modified by Amit Raval to fix the defect#57434 on 20th Apr. 1999
# HOME=`$AWK -v UNAME=$USERNAME 'BEGIN { FS=":" }
# {if ( $1 == UNAME) print $6 ; }' /etc/passwd` # get home dir. from /etc/passwd
JAHOME=`$AWK -v UNAME=$USERNAME 'BEGIN { FS=":" }
{if ( $1 == UNAME) { print $6 ; exit } }' /etc/passwd` # get home dir. from /etc/passwd
# ]
fi
if [ -z "$JAHOME" ] # Handle the NIS issue
then
JAHOME=$HOME # Assign the env veriable HOME if JAHOME is null.
fi
# [Modified by Kumaresan for JPIU on 26th Sept '99.
if [ ! -d $JAHOME/.jpiu ]
then
$MKDIR $JAHOME/.jpiu > /dev/null 2>&1
if [ $? -eq 0 ]
then
TMP=$JAHOME/.jpiu
fi
else
TMP=$JAHOME/.jpiu
fi
fi
# ]
# --------- Definitions of functions used within this script ------------
# list all options on a page after banner.
all_options()
{ # map lf->cr+lf; bold
echo "\033&k2G\033(s3B\t\t\033&d0D\c"
echo "Available Options for Model Script net_lj3plus\n"
echo "\033&d@SYNOPSIS:\033(s0B\c"
echo "\tlp -o -o ... ...\n"
echo "\033(s3BDESCRIPTION:\033(s0B"
echo "This script is intended for Hewlett-Packard LaserJet III or IIID printers"
echo "with PostScript Cartridge Plus (Part No. C2089A) only.\n"
echo "\033(s3BOPTIONS:\033(s0B\033&k2S\033&l6C\c" # compressed font, 8 line/in
# >>>>>>>>>>>> OPTIONS SECTION <<<<<<<<<<<<<<<<
echo "
options list all options
auto (default) auto-switch language (PS/PCL) based on the file type
postscript/post,pcl print in PostScript/PCL mode
hpgl2,hpgl2_p print in HP-GL/2 landscape mode or portrait mode
relay pass data to printer without any added commands.
r/raw print in PCL raw mode
yb, nb print, or do not print banner page (Default: $BANNER)
btray1,btray2, feed banner page from tray1(upper), tray2(lower)
simplex single side printing
duplex/hduplex double sided printing, long edge/short edge binding
legal,letter,A4,exec select legal, letter, A4, or executive sized paper
manual,tray1(upper),
tray2(lower),com10env feed paper from the indicated tray
PostScript ONLY
a/ascii print text, without interpreting it.
f specify font (valid only when ascii is also specified)
PCL ONLY
2up/4up print 2/4 pages on one side of paper
3hole adjust left/top margin to account for the holes (TEXT)
portrait,landscape print in portrait/landscape mode (Default: Front Panel)
ln66 print 66 lines of text on portrait
md/mduplex manual double sided printing
rev reverse the output page (TEXT only)
l#, tl# set logical page length/text length to # lines
tm#, lm#, rm# set top margin to # lines, left/right margin in column #
c, 10, 12, fp# set font pitch to compressed, or 10/12/# char/inch
ps, fs select proportional, or fixed spacing font
lpi# print at # lines per inch
hsi#, vsi# set horizontal/vertical spacing increment
cs#, type# set character set/typeface to #
height# set height to #
style#, i, upright set font style to #, italic, or upright
weight#, b/bold set font stroke weight to #, or bold
n/nroff, pr print output of nroff/pr (run nroff first)
HP Network Printer Only (see also man pages for xjjm and jetdirect)
debugm/debugm send model script output to a file for examination. If
no file name, $TMP/ is used. File name must be
preceded by absolute path.
job/jobnp,nojob bring, or not bring the job monitor up or for this job.
a display name can be specified by -ojob+.
"
# >>>>>>>>>>>>> END OF OPTION SECTION <<<<<<<<<<<<<<<<<<<
echo "\n\033&k0S\033(s3BNOTE:\033(s0B\033&l8C\c"
echo "
1. 2up/4up will use the defaults for all options except duplex, orientation,
in/out tray selection, and banner page printing.
2. Most options described above are intended for text (ASCII) files.
3. AUTO option requires the utility \"/usr/lib/hpnp/bin/hpnps\". If it does
not exist, print files will be printed in PCL mode. PostScript files must
have PostScript header (such as %!PS) in order to be recognized correctly.
"
echo "\033E\c"
}
# option summary; Alway printed on banner page
partial_options()
{
echo "\033&a5976v40L\c"
echo "********* Option Summary *********"
echo "(use -ooptions to get a description)\n"
echo "\033&k2S\c" # use compressed font
echo "auto (default), postscript, pcl, hpgl2, hpgl2_p, raw, relay"
echo "manual, tray1, tray2, tray3, com10env "
echo "yb, nb 3hole"
echo "dpi#, simplex, duplex, hduplex "
echo "legal, letter, A4, exec ln66"
echo "2up, 4up portrait, landscape "
echo "ascii f "
# draw box
echo "\033&a5818v2808H\033*c4h1440v0P\033*c2880h4v0P\c"
echo "\033&a7258v2808H\033*c2880h4v0P\c"
echo "\033&a5818v5688H\033*c4h1440v0P\c"
}
# PCL banner
do_banner()
{
# Print the standard header
echo "\033&l0O\c" # always in portrait mode
echo "\033)8U\033)s1p60v1s0b16901T\n $user\033)s14v0S"
user1=`pwget -n $user | line | cut -d: -f5`
if [ -n "$user1" ]
then
echo "\n\t\t\t\t\t\t\t\tUser: $user1\n"
else
echo "\n\t\t\t\t\t\t\t\tUser: (No User Info in /etc/passwd)\n"
fi
echo "\t\t\t\t\t\t\t\tRequest: $reqid from $syst\n"
echo "\t\t\t\t\t\t\t\tOptions: $options\n"
if [ -n "$title" ]
then
echo "\t\t\t\t\t\t\t\tTitle: $title"
else
echo ""
fi
date1=`date`
echo " $date1"
echo "\c"
# draw box
echo "\033&l0E\c"
echo "\033&a120v0H\033*c4h1680v0P\033*c5616h4v0P\c"
echo "\033&a1800v0H\033*c5616h4v0P\c"
echo "\033&a120v5616H\033*c4h1680v0P\c"
# shade the area
echo "\033&l0e8C\033&a0v0H\c"
echo "\033*c5616h1800v10g2P\c"
partial_options
# [ Modified by Suresha on 26th Sep 99 to support JPIU
#if [ -r /opt/hpnp/etc/hplogo.pcl ]
if [ -r $HPNP/etc/hplogo.pcl ]
# end of change by suresha ]
then
echo "\033&a140v5075H\c"
# [ Modified by Suresha on 26th Sep 99 to support JPIU
#cat /opt/hpnp/etc/hplogo.pcl
cat $HPNP/etc/hplogo.pcl
# end of change by suresha ]
fi
}
# PS banner page
do_ps_banner()
{
date=`date`
capuser=$user
user=`pwget -n $user | line | cut -d: -f5`
cat <<-EOF
/TopOfPage 10.70 72 mul def
/LeftMargin .375 72 mul def
/optv 2.875 72 mul def
/opth 4.25 72 mul def
/box1 {
562 0 rlineto
0 -150 rlineto
-562 0 rlineto
closepath
} def
/box2 {
255 0 rlineto
0 -144 rlineto
-255 0 rlineto
closepath
} def
%%
newpath
LeftMargin TopOfPage moveto
box1
stroke
newpath
opth 10 sub optv moveto
box2
stroke
newpath
LeftMargin TopOfPage moveto
box1
0.98 setgray fill
%% reset gray scale for print characters
0 setgray
%%
/Times-Italic findfont
60 scalefont
setfont
LeftMargin TopOfPage 42 sub moveto
( $capuser) show
LeftMargin currentpoint exch pop moveto
currentpoint 25 sub moveto
216 0 rmoveto
%%
/Times-Roman findfont
14 scalefont
setfont
(User: $user) show
LeftMargin currentpoint exch pop moveto
currentpoint 17 sub moveto
216 0 rmoveto
(Request: $reqid from $syst) show
LeftMargin currentpoint exch pop moveto
currentpoint 19 sub moveto
216 0 rmoveto
(Options: $options) show
LeftMargin currentpoint exch pop moveto
currentpoint 19 sub moveto
216 0 rmoveto
($title) show
LeftMargin currentpoint exch pop moveto
currentpoint 19 sub moveto
( $date) show
%% option listing
/Times-Roman findfont
12 scalefont
setfont
opth optv 18 sub moveto
(********** Options Summary **********) show
opth currentpoint exch pop moveto
currentpoint 20 sub moveto
((For details, print a file and specify "-ooptions")) show
%%
opth currentpoint exch pop moveto
currentpoint 20 sub moveto
/Times-Roman findfont
8 scalefont
setfont
(language: auto, postscript, pcl, raw, relay, hpgl2, hpgl2_p) show
currentpoint 14 sub moveto
opth currentpoint exch pop moveto
(Duplex Printing: simplex, duplex, hduplex) show
opth currentpoint exch pop moveto
0 -10 rmoveto
(Input Tray Selection: manual, upper, lower, com10env) show
opth currentpoint exch pop moveto
0 -10 rmoveto
(Paper Size Selection: legal, letter, A4, exec) show
opth currentpoint exch pop moveto
currentpoint 14 sub moveto
(Text printing: ascii, f#) show
%%
/Courier findfont
10 scalefont
setfont
%%
showpage
EOF
}
pslp()
{
# pslp --- PostScript emulation of LaserJet default mode - 82 chars, 66 lines
#
#
# Put out the header
cat <<-EnD
%!PS-Adobe-2.0
%%Title: pslp
%
/$font findfont 11.5 scalefont setfont
/inch {72 mul} def
/deltay 10.5 66.5 div inch def % allow .25 inch margins all sides
/leftmargin .4 inch def
/topmargin 10.75 inch deltay sub def
/gotop {
leftmargin topmargin moveto
/linecount 0 def
} def
/checkpage {
linecount 66 ge
{
showpage
gotop
}
if % end of page?
/linecount linecount 1 add def % incr linecount
} def
/crlf {
currentpoint exch pop deltay sub leftmargin exch moveto
} def
gotop
%%EndProlog pslp
EnD
# Put out the text
# expand tabs:
# [ UnCommented by Vijay to remove support of 2up and 4up on 26/7/99
#[ Modified by Ramki for PSNUP on 30 Oct 98
expand $file |
#]
# End of change by Vijay ]
# [ Commented by Vijay to remove support of 2up and 4up on 26/7/99
#expand $psnupfile |
# End of change by Vijay ]
# delete control chars unknown to PS:
tr -s '[\001-\011][\016-\037]' '@' |
# escape chars special to PS
# and format each line as
# checkpage (This is the text.) show crlf
sed -e 's/\\/\\\\/g' -e 's/[()]/\\&/g' \
-e 's/^/checkpage (/' -e 's/$/) show crlf/'
cat <<-'EnD'
%%Trailer pslp
showpage
EnD
} # end of function pslp
#------------------------
# [ Modified by Amit Raval to fix the defect# 57429 on Apr. 20th 1999
#PATH="$PATH:/usr/bin:/usr/lbin"
PATH="/usr/bin:$PATH:/usr/lbin"
# ]
export PATH
# set up redirection of stderr
exec 2>>$log
# [ Modify by the Amit R. to solve the problem of security on 20th Feb. 1998
/usr/bin/rm -f $TMP/lj3p*
# ]
# Save the arguments to the model
printer=`basename $0`
reqid=$1
user=$2
title=$3 # CHANGE TITLE
copies=$4 # CHANGE COPIES
options=$5 # CHANGE OPTIONS
opt6=$6
# Assume that the rest of the arguments are files
shift; shift; shift; shift; shift
files="$*"
# find out orignal submitted system
dfname=`basename $opt6`
cfname=`dirname $opt6`/c`expr match $dfname '\d\(.*\)'`
syst=`sed -n "/^H/s/H//p" $cfname`
# for serial connection
baudrate="9600"
# Set up interface (parallel/serial, no effect on JetDirect)
if [ -t 1 ]
then
stty raw $baudrate -parenb cs8 ixon -istrip clocal <&1 2>/dev/null
else
slp -r 2>/dev/null
fi
# Handle disable and cancel traps.
CancelJob()
{
# [ Modify by the Amit R. to solve the problem of security on 20th Feb. 1998
# #ifndef UX9
# rm -f $TMP/lj3p$$
# #else /* UX9 */
# rm -f /tmp/lj3p$$
# #endif UX9
rm -f $TMP/lj3p$$
# ]
echo "$reqid is cancelled" >> $log
if [ -t 1 ]
then
stty raw $baudrate -parenb cs8 ixon -istrip clocal <&1 2>/dev/null
fi
exit 0
}
trap CancelJob 15
# initialize the variables
lang_user=$PERSONALTY
lang=$PERSONALTY
listopt=""
# internal use
nroff=""
reverse=""
banner=$BANNER
ThreeHoles="" # CHANGE DEFAULT 3HOLE OPTION
ln66=""
# [ Commented by Vijay to remove support of 2up and 4up on 26/7/99
#psnup="" #Added by Ramki on 14th Oct 98 for PSNUP
# End of change by Vijay ]
dividing="" # CHANGE DEFAULE PAGE DIVIDE MODE , '-hh' for 2+, '-h'
# for 2up and '-q' for 4up
manuald=""
outputmode="cooked"
omode_user="cooked"
bannerpagesrc="def" # CHANGE DEFAULT BANNER PAGE SOURCE
ascii="" # for PS only
font="Courier" # for PS only # CHANGE DEFAULT FONT FOR POSTSCRIPT
duplex="def" # CHANGE DEFAULT DUPLEX MODE
mediasrc="def" # CHANGE DEFAULT MEDIA SOURCE
orientation="def" # CHANGE DEFAULT ORIENTATION
paper="def" # CHANGE DEFAULT PAPER SIZE
length="def"
pitch="def"
hsi="def"
lpagelen="def"
textlen="def"
lmargin="def"
rmargin="def"
tmargin="def"
italic=""
spacing="def"
lpi="def"
vsi="def"
charset="def"
height="def"
style="def"
typeface="def"
weight="def"
# Determine which options have been invoked
for i in $options
do
case "$i" in
#
auto)
lang="AUTO"
lang_user="AUTO";;
relay)
for file in $files; do
cat "$file"
done
exit 0;;
postscript | post )
lang="PS"
lang_user="PS";;
pcl )
lang="PCL"
lang_user="PCL";;
hpgl2)
lang="PCL"
lang_user="HPGL2"
outputmode="raw";;
hpgl2_p)
lang="PCL"
lang_user="HPGL2_P"
outputmode="raw";;
r | raw)
lang="PCL"
lang_user="PCL"
outputmode="raw";;
n | nroff)
nroff="-n"
length="-l66";;
pr)
nroff="-p"
length="";;
nb ) # No banner page
banner="";;
yb ) # output banner page
banner="yes";;
options )
listopt="yes";;
rev)
reverse="yes";;
3hole)
ThreeHoles="yes";;
portrait) # print in portrait mode
orientation="p";;
landscape) # print in landscape mode
orientation="l";;
# duplex
simplex)
duplex="simplex";;
vd | duplex | double | d ) # vertical binding
duplex="vduplex";;
hd | hduplex | hdouble) # double side, horizontal binding
duplex="hduplex";;
md | mduplex | mdouble) # duplexing manually
manuald="mdouble";;
# paper source
manual | m | man | mb ) # manual sheet feed
mediasrc="2";;
tray1 | upper | ub | ubin) # feed from upper tray
mediasrc="1";;
tray2 | lower | lb | lbin) # feed from lower tray
mediasrc="4";;
com10env) # feed from envelope tray,
mediasrc="6";;
# paper size
legal)
paper="legal";;
letter)
paper="letter";;
A4)
paper="A4";;
exec)
paper="exec";;
# feed banner page from upper(1)/lower (4) tray,
btray1 | bupper | ubb | ubbin)
bannerpagesrc="1";;
btray2 | blower | lbb | lbbin)
bannerpagesrc="4";;
# 2-up/4-up.
half | 2 | 2up)
# [ Commented by Vijay to remove support of 2up and 4up on 26/7/99
# psnup="2" #Added by Ramki on 14th Oct 98 for PSNUP
# End of change by Vijay ]
dividing="-h";;
quarter | 4 | 4up)
# [ Commented by Vijay to remove support of 2up and 4up on 26/7/99
# psnup="4" #Added by Ramki on 14th Oct 98 for PSNUP
# End of change by Vijay ]
dividing="-q";;
# PCL Font Control
10) # set to 10.00 cpi
pitch="10";;
12) # set to 12.00 cpi
pitch="12";;
c) # compressed print
pitch="c";;
# set font pitch to value following fp
fp[0-9]* | fp.[0-9]*)
pitch="`echo "$i" | sed 's/^[-]*fp//'`" ;;
# set horizontal spacing increment to #/120 in.
hsi[0-9]*)
hsi="`echo "$i" | sed 's/^[-]*hsi//'`";;
ps) # proportional spacing
spacing="1";;
fs) # fixed spacing
spacing="0";;
# set lines per inch
lpi[0-9]*)
lpi="`echo "$i" | sed 's/^[-]*lpi//'`";;
# set vertical spacing increment to #/48 inch
vsi[0-9]*)
vsi="`echo "$i" | sed 's/^[-]*vsi//'`";;
# set character set to value following cs
cs[0-9]*)
charset="`echo "$i" | sed 's/^[-]*cs//'`";;
# set height value
height[0-9]*)
height="`echo "$i" | sed 's/^[-]*height//'`";;
# set font style
style[0-1])
style="`echo "$i" | sed 's/^[-]*style//'`";;
i | italic)
style=italic;;
upright)
style="0";;
# set typeface
type[0-9]*)
typeface="`echo "$i" | sed 's/^[-]*type//'`";;
# set font weight
weight[0-9]* | weight-[0-9]*)
weight="`echo "$i" | sed 's/^[-]*weight//'`";;
# set font weight
b | bold)
weight=1;;
#set absolute length of page
ln66)
ln66="yes";;
l[0-9]*)
lpagelen="`echo "$i" | sed 's/^[-]*l//'`";;
#set text length of page
tl[0-9]*)
textlen="`echo "$i" | sed 's/^[-]*tl//'`";;
# set left margin in columns
tm[0-9]*)
tmargin="`echo "$i" | sed 's/^[-]*lm//'`";;
# set right margin in columns
lm[0-9]*)
lmargin="`echo "$i" | sed 's/^[-]*lm//'`";;
# set right margin in columns
rm[0-9]*)
rmargin="`echo "$i" | sed 's/^[-]*rm//'`";;
# PS specific
a | ascii) # print postscript text
ascii="yes";;
f*) # new font used by ASCII-to-PS
font="`echo "$i" | sed 's/^[-]*f//'`";;
esac
done
# settle outputmode precedence: raw, 2/4-up, and mdouble
if [ "$outputmode" = "raw" ]
then
dividing="" # invalidate 2/4-up
manuald="" # invalidate manual duplex
fi
if [ -n "$manuald" ]
then
outputmode="mdouble"
omode_user="mdouble"
fi
if [ -n "$dividing" ] # override manaul double
then
outputmode="divide"
omode_user="divide"
fi
if [ "$ln66" = "yes" ]
then
vsi="7.4"
textlen="66"
pitch="10.7"
orientation="p"
lpi="def" # reset, if specified.
fi
if [ "$ThreeHoles" = "yes" ]
then
pitch="10.7"
if [ "$orientation" = "def" ]
then
orientation="p"
fi
if [ "$orientation" = "p" ]
then
lmargin="4"
else
tmargin="4"
vsi="7.85"
fi
fi
if [ "$mediasrc" = "6" ]
then
banner=""
orientation="l"
paper="com10"
fi
# ********** Start sending bytes out ****************
# Print the spooled files
i=1
while [ $i -le $copies ]
do
for file in $files
do
if [ $lang_user = "AUTO" ]
then
if [ -x $HPNPS ]
then # file does exist
$HPNPS -q <$file > /dev/null
pers=$?
if [ $pers -eq 1 ]
then # PS
lang="PS"
elif [ $pers -eq 0 ]
then
# Text file
lang="PCL"
case "$omode_user" in
divide) outputmode="divide";;
cooked) outputmode="cooked";;
mdouble) outputmode="mdouble";;
esac
elif [ $pers -eq 2 ]
then
lang="PCL"
outputmode="raw"
elif [ $pers -eq 3 ]
then
lang="RELAY"
fi
else # file not exist
lang_user="PCL" # no need to stay AUTO for next file
lang="PCL"
fi
fi
case "$lang" in
RELAY)
if [ -n "$banner" ]
then
cat $TOPCL
echo "\033&k2G\c"
do_banner
banner=""
echo "\033E\c"
fi
cat "$file" # straight to the printer
;;
PS)
cat $TOPS # switch to ps
# banner page ;
if [ -n "$banner" -a -z "$reverse" ]
then
echo "statusdict begin mark"
if [ "$bannerpagesrc" -eq 1 ]
then
echo "0 setpapertray"
elif [ "$bannerpagesrc" -eq 4 ]
then
echo "1 setpapertray"
elif [ "$mediasrc" = "1" ]
then
echo "0 setpapertray"
elif [ "$mediasrc" = "4" ]
then
echo "1 setpapertray"
fi
# where does the paper go to
echo "cleartomark end"
do_ps_banner
echo "\004\c"
banner=""
fi
if [ "$listopt" = "yes" ]
then
cat $TOPCL
all_options
listopt=""
cat $TOPS
fi
echo "statusdict begin mark"
case "$mediasrc" in
1) echo "0 setpapertray";; # upper tray ;;
4) echo "1 setpapertray";; # lower tray;;
6) echo "com10envelopetray";; # envelope tray ;
2) echo "manualfeed true";; # feed from manual
esac
case "$paper" in
A4) echo "a4tray";;
exec) echo "executivetray";;
letter) echo "lettertray";;
legal) echo "legaltray";;
# [ Added by Ramki to resolve #52937
com10) echo "com10envelopetray";;
# End ]
esac
case "$duplex" in
simplex) echo "false setduplexmode";;
vduplex) echo "true setduplexmode"
echo "false settumble";;
hduplex) echo "true setduplexmode"
echo "true settumble";;
esac
echo "cleartomark end"
# [ Commented by Vijay to remove support of 2up and 4up on 26/7/99
#[ Added by Ramki on 29/10/98 for supporting legal,letter in PSNUP
# case $paper in
# legal) nuppaper="Legal";;
# letter) nuppaper="Letter";;
# *) nuppaper="A4";;
# esac
#]
# End of change by Vijay ]
# [ Uncommented by Vijay to remove support of 2up and 4up on 26/7/99
#[ Commented by Ramki on 30 Oct 98 for supporting PSNUP
if [ -z "$ascii" ] # a postscript file, dump it
then
cat "$file"
else
pslp # print ASCII file
fi
#]
# End of change by Vijay ]
# [ Commented by Vijay to remove support of 2up and 4up on 26/7/99
#[ Modified by Ramki to support PSNUP on 30 Oct 1998
# if [ -z "$ascii" ] # a postscript file, dump it
# then
# # if psnup is set no need of cat'ing the file separately
# if [ -n "$psnup" ]
# then
# $MPAGE -b${nuppaper} -${psnup} $file
# else
# cat "$file"
# fi
# else
# #if file to be dumped without interpretting, print PSNUP commands too
# if [ -n "$psnup" ]
# then
# $MPAGE -b${nuppaper} -${psnup} $file > $TMP/mpage.$$
# pslp $TMP/mpage.$$
# rm -f $TMP/mpage.$$
# else
# pslp # print ASCII file
# fi
# fi
#]
echo "\004\c"
;;
PCL)
cat $TOPCL # switch to pcl
# banner page ;
if [ -n "$banner" -a -z "$reverse" ]
then
echo "\033&k2G\c"
# where does the paper come from
if [ "$bannerpagesrc" != "def" ]
then
echo "\033&l${bannerpagesrc}H\c"
elif [ "$mediasrc" = "1" -o "$mediasrc" = "4" ]
then
echo "\033&l${mediasrc}H\c"
fi
# where does the paper go to
do_banner
echo "\033E\c" # kick the page out
banner=""
fi
if [ "$listopt" = "yes" ]
then
all_options
listopt=""
fi
if [ "$outputmode" != "raw" ]
then
echo "\033&k2G\c"
fi
# download font if dividing is "half" or "quarter"; text only
if [ $outputmode = "divide" ]
then
# reset following if they are set
reverse=""
pitch="def"
hsi="def"
spacing="def"
lpi="def"
vsi="def"
charset="def"
style="def"
typeface="def"
weight="def"
lpagelen="def"
textlen="def"
lmargin="def"
rmargin="def"
nroff=""
italic=""
length="def"
case "$orientation" in
p | def)
orientation="p"
case "$dividing" in
-h);;
-q) fontdl /usr/lib/lp/fonts/lp4p;;
esac;;
l)
case "$dividing" in
-h) fontdl /usr/lib/lp/fonts/lp2l;;
-q) fontdl -l /usr/lib/lp/fonts/lp4l;;
esac;;
esac
fi
case "$mediasrc" in
def);;
*) echo "\033&l${mediasrc}H\c";;
esac
case "$paper" in
A4) echo "\033&l26A\c";;
exec) echo "\033&l1A\c";;
letter) echo "\033&l2A\c";;
legal) echo "\033&l3A\c";;
com10) echo "\033&l81A\c";;
esac
case "$duplex" in
simplex) echo "\033&l0S\c";;
vduplex) echo "\033&l1S\c";;
hduplex) echo "\033&l2S\c";;
esac
case "$orientation" in
p) echo "\033&l0O\c";;
l) echo "\033&l1O\c"
length="-l45";;
esac
case "$vsi" in
def);;
*) echo "\033&l${vsi}C\c";;
esac
case "$lpi" in
def);;
*) echo "\033&l${lpi}D\c";;
esac
case "$lpagelen" in
def) if [ "$length" = "def" ]
then
length="-l60"
fi
;;
*) echo "\033&l${lpagelen}P\c"
length="-l$lpagelen";;
esac
case "$textlen" in
def);;
*) echo "\033&l${textlen}F\c"
length="-l$textlen";;
esac
case "$charset" in
def);;
*) echo "\033(${charset}\c";;
esac
case "$spacing" in
def);;
*) echo "\033(s${spacing}P\c";;
esac
case "$pitch" in
def);;
c) echo "\033&k2S\c";;
*) echo "\033(s${pitch}H\c";;
esac
case "$hsi" in
def);;
*) echo "\033&k${hsi}H\c";;
esac
case "$height" in
def);;
*) echo "\033(s${height}V\c";;
esac
case "$style" in
def);;
italic) echo "\033(s1S\c"
italic="-i";;
*) echo "\033(s${style}S\c";;
esac
case "$weight" in
def);;
*) echo "\033(s${weight}B\c";;
esac
case "$typeface" in
def);;
*) echo "\033(s${typeface}T\c";;
esac
case "$lmargin" in
def);;
*) echo "\033&a${lmargin}L\c";;
esac
case "$rmargin" in
def);;
*) echo "\033&a${rmargin}M\c";;
esac
case "$tmargin" in
def);;
*) echo "\033&l${tmargin}E\c";;
esac
case "$outputmode" in
raw)
echo "\033&k0G\c"
case "$lang_user" in
# [[ Changed by Devu on Sept 25 1999 to fix problems
# with -ohpgl* options resetting all previous PCL commands
#HPGL2_P) echo "\033E\033&l3O\033%1B\c";;
#HPGL2) echo "\033E\033%1B\c";;
HPGL2_P) echo "\033&l3O\033%1B\c";;
HPGL2) echo "\033%1B\c";;
# end of change Devu]]
*) ;;
esac
# [ Modify by the Amit R. to solve the problem of security on 20th Feb. 1998
# #ifndef UX9
# cat "$file" 2>$TMP/lj3p$$
# if [ -s $TMP/lj3p$$ ]
# #else /* UX9 */
# cat "$file" 2>/tmp/lj3p$$
# if [ -s /tmp/lj3p$$ ]
# #endif UX9
cat "$file" 2>$TMP/lj3p$$
if [ -s $TMP/lj3p$$ ]
# ]
then
case "$lang_user" in
HPGL2 | HPGL2_P )
# [ Modify by the Amit R. to solve the problem of security on 20th Feb. 1998
# #ifndef UX9
# cat $TMP/lj3p$$ >> $log;;
# *) cat $TMP/lj3p$$ ;; # output any errors
# #else /* UX9 */
# cat /tmp/lj3p$$ >> $log;;
# *) cat /tmp/lj3p$$ ;; # output any errors
# #endif UX9
cat $TMP/lj3p$$ >> $log;;
*) cat $TMP/lj3p$$ ;; # output any errors
# ]
esac
fi
# [ Modify by the Amit R. to solve the problem of security on 20th Feb. 1998
# #ifndef UX9
# rm -f $TMP/lj3p$$;;
# #else /* UX9 */
# rm -f /tmp/lj3p$$;;
# #endif UX9
rm -f $TMP/lj3p$$;;
# ]
cooked)
echo "\r\c"
if [ -n "$reverse" ]
then
lprpp $italic $length $nroff < "$file" 2>&1 | reverse $length
else
lprpp $italic $length $nroff < "$file" 2>&1
fi
;;
mdouble)
if [ -n "$reverse" ]
then
lprpp $italic $length $nroff -o < "$file" 2>&1 | reverse $length
else
lprpp $italic $length $nroff -o < "$file" 2>&1
fi
echo "\033&l2H\c"
lprpp $italic $length $nroff -e < "$file" 2>&1;;
# [ Commented by Vijay to remove support of 2up and 4up on 26/7/99
# divide)
# divpage -$orientation "$dividing" "$file" 2>&1;;
# End of change by Vijay ]
esac
echo "\033E\c";; # Reset Printer; end of PCL file
esac # end of one file (PCL/PS)
done
i=`expr $i + 1`
done
if [ -n "$banner" ]
then
cat $TOPCL
echo "\033&k2G\c"
if [ "$bannerpagesrc" != "def" ]
then
echo "\033&l${bannerpagesrc}H\c"
elif [ "$mediasrc" = "1" -o "$mediasrc" = "4" ]
then
echo "\033&l${mediasrc}H\c"
fi
do_banner
echo "\033E\c"
fi
# end of job
# RS-232 interface insure all buffers are flushed to printer
if [ -t 1 ]
then
stty raw $baudrate -parenb cs8 ixon -istrip clocal <&1 2>/dev/null
fi
exit 0