From 6174642093bdcef4116ae78dbdf4f2e608494258 Mon Sep 17 00:00:00 2001 From: rsc Date: Wed, 31 Aug 2005 02:15:26 +0000 Subject: Initial lp. --- lp/process/hpost | 143 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100755 lp/process/hpost (limited to 'lp/process/hpost') diff --git a/lp/process/hpost b/lp/process/hpost new file mode 100755 index 00000000..169cb2ac --- /dev/null +++ b/lp/process/hpost @@ -0,0 +1,143 @@ +#!/usr/local/plan9/bin/rc +if (! ~ $DEBUG '') flag x + +REVFLAG='' +if (~ $LPCLASS *reverse*) { + switch ($REVERSE) { + case ''; + REVFLAG=1 + case 1; + REVFLAG='' + } +} +if (! ~ $REVFLAG '') + postreverse + +if (~ $NOHEAD '') { + DATE=`{date} + face='FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' + facedom=`{awk '{ if(match("'$LPMACHID'", $1)) {print $2; exit}}' $PLAN9/face/.machinelist} + if (~ $#facedom 0) facedom=$LPMACHID + + facefile=`{awk '/^'$facedom'\/'$LPUSERID' /{print $2}' $PLAN9/face/48x48x4/.dict} + facedepth=4 + + if (~ $#facefile 0) { + facefile=`{awk '/^'$facedom'\/'$LPUSERID' /{print $2}' $PLAN9/face/48x48x2/.dict} + facedepth=2 + } + + if (~ $#facefile 0) { + facefile=`{awk '/^'$facedom'\/'$LPUSERID' /{print $2}' $PLAN9/face/48x48x1/.dict} + facedepth=1 + } + + if (~ $#facefile 0) {facefile=u/unknown.1; facedepth=1} + facefile=$PLAN9/face/48x48x$facedepth/$facefile + + if (! ~ $#facefile 0 1) + facefile=$facefile(1) + + if (~ $#facefile 0 || ! test -f $facefile ) {facefile=$PLAN9/face/48x48x2/u/unknown.1; facedepth=2} + if (test -r $facefile ) { + switch($facedepth){ + case 1 2 + face=`{cat $facefile | + sed -e 's/0x//g' -e 's/, *//g' | + tr 0123456789abcdef fedcba9876543210 }; + case 4 + face=`{iconv -u -c k4 $facefile | + dd -bs 60 -skip 1 >[2]/dev/null | + xd -b | sed 's/^[^ ]+ //;s/ //g' } + } + } +} + +# We have to make sure the face information is set before rc sees the HERE file +# so the cat has to be in a separate if statement. This is an rc bug. +if (~ $NOHEAD '') cat <} image + grestore + } def +EOF +if (~ $NOHEAD '') switch ($LPCLASS) { +case *hp4simx*; + echo ' +%% set the default papertray to be the lower tray for HP4siMX printers + statusdict begin defaultpapertray end 1 ne { + statusdict begin + 1 setdefaultpapertray + end + } if' +} +if (~ $NOHEAD '') cat <