Import sources from 2011-03-30 iso image - sys/lib

This commit is contained in:
Taru Karttunen 2011-03-30 16:53:33 +03:00
parent b41b903422
commit e463eb4036
1144 changed files with 388460 additions and 0 deletions

82
sys/lib/lp/process/dpost Executable file
View file

@ -0,0 +1,82 @@
#!/bin/rc
if (~ $DEBUG 1) flag x +
# convert troff output to PostScript
PATCH='%%Patch from lp'
switch ($LPCLASS) {
case *hp4simx*;
PATCH=$PATCH'
%% set the default papertray to be the lower tray for HP4siMX printers
statusdict begin defaultpapertray end 1 ne {
statusdict begin
1 setdefaultpapertray
end
} if'
}
for (i in `{echo $IBIN|awk -F, '{ n=split($0, a, ","); for (i=1;i<=n;i++) print a[i]; }'}) {
switch ($i) {
case -P*;
case man manual manualfeed;
PATCH=$PATCH'
%%BeginFeature: *Select ManualFeed
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /ManualFeed true >> setpagedevice
} {statusdict begin /manualfeed true def end} ifelse
} stopped cleartomark
%%EndFeature'
case simplex;
DUPLEX=0
case [0-9];
PATCH=$PATCH'
%%BeginFeature: *Select InputTray
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /MediaType (tray'$i') >> setpagedevice
} {statusdict begin '$i' setpapertray end} ifelse
} stopped cleartomark
%%EndFeature'
case 11x17 [Ll]edger;
PATCH=$PATCH'
%%BeginFeature: *Select Ledger
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /PageSize [792 1224] >> setpagedevice
} {statusdict begin '$i'tray end} ifelse
} stopped cleartomark
%%EndFeature'
case transparency vg viewgraph;
PATCH=$PATCH'
%%BeginFeature: *Select Transparency
[{ << /MediaType (Transparency) >> setpagedevice
} stopped cleartomark
%%EndFeature'
case *;
echo illegal option ''''-i $i'''' >[1=2]
}
}
if (! ~ $#DUPLEX 0) {
switch ($DUPLEX) {
case 0;
DUPLEX=false
case 1;
DUPLEX=true
}
PATCH=$PATCH'
%%BeginFeature: *Set DuplexMode
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /Duplex '$DUPLEX' >> setpagedevice
} {statusdict /setduplexmode known {statusdict begin '$DUPLEX' setduplexmode end} if} ifelse
} stopped cleartomark
%%EndFeature';
}
if (! ~ $PATCH '' -P*)
PATCH=-P''''$PATCH'''';
switch ($LAND) {
case -p*;
case ''; LAND=-pp
case 1; LAND=-pl
}
if (! ~ $COPIES '' -c*) COPIES=-c^$COPIES
if (! ~ $MAG '' -m*) MAG=-m^$MAG
if (! ~ $NPAG '' -n*) NPAG=-n^$NPAG
if (! ~ $XOFF '' -x*) XOFF=-x^$XOFF
if (! ~ $YOFF '' -y*) YOFF=-y^$YOFF
eval /$cputype/bin/aux/dpost -e2 -w0.5 $XOFF $YOFF $COPIES $MAG $NPAG $LAND $OLIST $PATCH | $LPLIB/process/hpost
exit

120
sys/lib/lp/process/dvipost Executable file
View file

@ -0,0 +1,120 @@
#!/bin/rc
if (~ $DEBUG 1) flag x +
# convert Tex dvi to PostScript
PATCH='%!PS-Adobe-2.0'
switch ($LPCLASS) {
case *hp4simx*;
PATCH=$PATCH'
%% set the default papertray to be the lower tray for HP4siMX printers
statusdict begin defaultpapertray end 1 ne {
statusdict begin
1 setdefaultpapertray
end
} if'
}
for (i in `{echo $IBIN|awk -F, '{ n=split($0, a, ","); for (i=1;i<=n;i++) print a[i]; }'}) {
switch ($i) {
case man manual manualfeed;
PATCH=$PATCH'
%%BeginFeature: *Select ManualFeed
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /ManualFeed true >> setpagedevice
} {statusdict begin /manualfeed true def end} ifelse
} stopped cleartomark
%%EndFeature'
case simplex;
DUPLEX=0
case [0-9];
switch ($LPCLASS) {
case *post2*;
switch ($i) {
case 0; PATCH=$PATCH'
systemdict/languagelevel known {languagelevel 2 eq {true (0) startjob dup not
{/exitserver errordict/invalidaccess get exec}if}{false}ifelse}{false}ifelse
{
currentpagedevice/InputAttributes get {0 get} stopped
{pop pop} {2 dict dup /InputAttributes 1 dict dup
/Priority[0] put put dup /TraySwitch false put setpagedevice} ifelse
false (0) startjob pop
} if'
case 1; PATCH=$PATCH'
systemdict/languagelevel known {languagelevel 2 eq {true (0) startjob dup not
{/exitserver errordict/invalidaccess get exec}if}{false}ifelse}{false}ifelse
{
currentpagedevice/InputAttributes get {1 get} stopped
{pop pop} {2 dict dup /InputAttributes 1 dict dup
/Priority[1] put put dup /TraySwitch false put setpagedevice} ifelse
false (0) startjob pop
} if'
}
case *; PATCH=$PATCH'
statusdict begin $i setpapertray end'
}
case 11x17 ledger; PATCH=$PATCH'
statusdict begin '$i'tray end'
}
}
if (! ~ $#DUPLEX 0) {
switch ($DUPLEX) {
case 0;
DUPLEX=false
case 1;
DUPLEX=true
}
PATCH=$PATCH'
%%BeginFeature: *Set DuplexMode
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /Duplex '$DUPLEX' >> setpagedevice
} {statusdict /setduplexmode known {statusdict begin '$DUPLEX' setduplexmode end} if} ifelse
} stopped cleartomark
%%EndFeature'
}
if (! ~ $#LAND 0 && ~ $LAND 1)
LAND='-tlandscape'
if (~ $LPCLASS *reverse*) {
switch ($REVERSE) {
case '';
REVFLAG=1
case 1;
REVFLAG=''
}
}
switch ($LPCLASS) {
case *post100*;
DPI='-Z -D100'
case *600dpi*;
DPI='-Z -D600'
case *1200dpi*;
DPI='-Z -D1200'
case *;
DPI=''
}
if (! ~ $COPIES '' -c*) COPIES=-c^$COPIES
if (! ~ $OLIST '' '='*) OLIST=`{echo $OLIST | sed 's/-o/=/' | sed 's/-/:/g' }
switch ($REVFLAG) {
case 1;
echo $PATCH
switch ($OLIST) {
case '';
eval dvips -q -f $DPI -r $LAND $COPIES $1
case *;
DVIFILE=/tmp/dv$pid.dvi
dviselect -s $OLIST $1 > $DVIFILE
eval dvips -q -f $DPI -r $LAND $COPIES $DVIFILE
rm -f $DVIFILE
}
$LPLIB/process/hpost </dev/null
case '';
$LPLIB/process/hpost </dev/null
echo $PATCH
switch ($OLIST) {
case '';
eval dvips -q -f $DPI $LAND $COPIES $1
case *;
DVIFILE=/tmp/dv$pid.dvi
dviselect -s $OLIST $1 > $DVIFILE
eval dvips -q -f $DPI $LAND $COPIES $DVIFILE
rm -f $DVIFILE
}
}
exit

84
sys/lib/lp/process/g3post Executable file
View file

@ -0,0 +1,84 @@
#!/bin/rc
# convert CCITT G3 Fax format to PostScript
if (! ~ $DEBUG '') flag x +
PATCH='%%Patch from lp'
switch ($LPCLASS) {
case *hp4simx*;
PATCH=$PATCH'
%% set the default papertray to be the lower tray for HP4siMX printers
statusdict begin defaultpapertray end 1 ne {
statusdict begin
1 setdefaultpapertray
end
} if'
}
for (i in `{echo $IBIN|awk -F, '{ n=split($0, a, ","); for (i=1;i<=n;i++) print a[i]; }'}) {
switch ($i) {
case -P*;
case man manual manualfeed;
PATCH=$PATCH'
%%BeginFeature: *Select ManualFeed
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /ManualFeed true >> setpagedevice
} {statusdict begin /manualfeed true def end} ifelse
} stopped cleartomark
%%EndFeature'
case simplex;
DUPLEX=0
case [0-9];
PATCH=$PATCH'
%%BeginFeature: *Select InputTray
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< '$i' << /MediaType (tray'$i') >> >>
<< /MediaType (tray'$i') >> setpagedevice
} {statusdict begin '$i' setpapertray end} ifelse
} stopped cleartomark
%%EndFeature'
case 11x17 [Ll]edger;
PATCH=$PATCH'
%%BeginFeature: *Select Ledger
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /PageSize [792 1224] >> setpagedevice
} {statusdict begin '$i'tray end} ifelse
} stopped cleartomark
%%EndFeature'
case transparency vg viewgraph;
PATCH=$PATCH'
%%BeginFeature: *Select Transparency
[{ << /MediaType (Transparency) >> setpagedevice
} stopped cleartomark
%%EndFeature'
case *;
echo illegal option ''''-i $i'''' >[1=2]
}
}
if (! ~ $#DUPLEX 0) {
switch ($DUPLEX) {
case 0;
DUPLEX=false
case 1;
DUPLEX=true
}
PATCH=$PATCH'
%%BeginFeature: *Set DuplexMode
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /Duplex '$DUPLEX' >> setpagedevice
} {statusdict /setduplexmode known {statusdict begin '$DUPLEX' setduplexmode end} if} ifelse
} stopped cleartomark
%%EndFeature'
}
PATCH=$PATCH'
%%EndPatch from lp'
if (! ~ $PATCH '' -P*)
PATCH=-P$PATCH;
if (~ $MAG '') MAG=1
if (~ $MAG [.0-9]*) MAG=-m^$MAG^,^`{echo $MAG '*' 2 | hoc}
if (! ~ $LAND '') LAND=-L
if not LAND=()
/$cputype/bin/aux/g3p9bit |
/$cputype/bin/aux/p9bitpost $MAG $LAND $PATCH |
$LPLIB/process/hpost
exit

218
sys/lib/lp/process/generic Executable file
View file

@ -0,0 +1,218 @@
#!/bin/rc
# Tries to determine what type of file you are printing and do the correct
# thing with it.
# It currently knows about images, troff intermediate, and ascii files.
rfork e
temp=/tmp/lp$pid
fn sigexit { rm -f $temp }
proc=$LPLIB/process
if (! ~ $DEBUG '')
flag x +
cat >$temp
type=`{file $temp}
switch ($type(2)) {
case troff
switch ($LPCLASS) {
case *Latin1* *post* *opost*
switch ($type(5)) {
# Latin1 is for compatibility with old research UNIX systems,
# doesn't work on Plan 9
case Latin1 post
tcs -s -f utf -t latin1 <$temp | $proc/dpost
case UTF
$proc/tr2post <$temp
}
case *gs!* *gsijs!*
switch ($type(5)) {
# Latin1 is for compatibility with old research UNIX systems,
# doesn't work on Plan 9
case Latin1 post
tcs -s -f utf -t latin1 <$temp | $proc/dpost |
$proc/gspipe
case UTF
$proc/tr2post <$temp | $proc/gspipe
}
case *
echo $type(2) -T$type(5) output is improper for $LPDEST >[1=2]
}
case special
switch ($type(4)) {
case '#b'
switch ($LPCLASS) {
case *post*
$proc/p9bitpost <$temp
case *gs!*
$proc/p9bitpost <$temp | $proc/gspipe
case *gsijs!*
$proc/p9bitpost <$temp | $proc/gspipeijs
}
case *
echo $type file is improper for $LPDEST >[1=2]
}
case Compressed plan old subfont
# type is really 'Compressed image' or 'plan 9 image' or
# 'old plan 9 image'
# 'subfont' is to cope with a bug in png (writing wrong length),
# 6 may 2008
switch ($LPCLASS) {
case *post*
$proc/p9bitpost <$temp
case *gs!*
$proc/p9bitpost <$temp | $proc/gspipe
case *gsijs!*
$proc/p9bitpost <$temp | $proc/gspipeijs
}
case jpeg
switch ($LPCLASS) {
case *post*
$proc/jpgpost <$temp
case *gs!*
$proc/jpgpost <$temp | $proc/gspipe
case *gsijs!*
$proc/jpgpost <$temp | $proc/gspipeijs
}
case GIF
switch ($LPCLASS) {
case *post*
$proc/gifpost <$temp
case *gs!*
$proc/gifpost <$temp | $proc/gspipe
case *gsijs!*
$proc/gifpost <$temp | $proc/gspipeijs
}
case PNG
switch ($LPCLASS) {
case *post*
$proc/pngpost <$temp
case *gs!*
$proc/pngpost <$temp | $proc/gspipe
case *gsijs!*
$proc/pngpost <$temp | $proc/gspipeijs
}
case ccitt-g31
switch ($LPCLASS) {
case *post*
$proc/g3post <$temp
case *gs!*
$proc/g3post <$temp | $proc/gspipe
case *gsijs!*
$proc/g3post <$temp | $proc/gspipeijs
}
case bitmap
# bitmap for research UNIX compatibility, does not work on Plan 9.
switch ($LPCLASS) {
case *post*
$proc/bpost <$temp
case *mhcc*
$proc/bpost <$temp | $proc/mhcc
case *
echo $type(2) file is improper for $LPDEST >[1=2]
}
case tex
mv $temp $temp.dvi
temp=$temp.dvi
switch ($LPCLASS) {
case *post*
$proc/dvipost $temp
case *gs!*
$proc/dvipost $temp | $proc/gspipe
case *gsijs!*
$proc/dvipost $temp | $proc/gspipeijs
case *
echo $type(2) file is improper for $LPDEST >[1=2]
}
case postscript
switch ($LPCLASS) {
case *post*
$proc/post <$temp
case *gs!*
$proc/post <$temp | $proc/gspipe
case *gsijs!*
$proc/post <$temp | $proc/gspipeijs
case *
echo $type(2) file is improper for $LPDEST >[1=2]
}
case HPJCL HP
switch ($LPCLASS) {
case *HPJCL*
$proc/noproc <$temp
case *
echo $type(2) file is improper for $LPDEST >[1=2]
}
case daisy
switch ($LPDEST) {
case *
echo $type(2) file is improper for $LPDEST >[1=2]
}
case tiff
switch ($LPCLASS) {
case *post*
$proc/tiffpost $temp
case *gs!*
$proc/tiffpost $temp | $proc/gspipe
case *gsijs!*
$proc/tiffpost $temp | $proc/gspipeijs
case *
echo Unrecognized class of line printer for $LPDEST >[1=2]
}
case PDF
switch ($LPCLASS) {
case *pdf*
# if (~ $LPCLASS *duplex* && ~ $LPCLASS *HPJCL*)
# echo -n '&l1S' # HP JCL: duplex on
if (~ $LPCLASS *duplex* && ~ $LPCLASS *HPJCL*) {
echo '%-12345X@PJL DEFAULT DUPLEX=ON' # HP PJL
echo '%-12345X'
echo '%-12345X@PJL DEFAULT PS:MBT=ON' # `memory boost'
echo '%-12345X'
}
cat $temp # pass pdf unaltered to pdf printer
case *post*
$proc/pdfpost $temp
case *gs!*
$proc/pdfgs $temp
case *gsijs!*
$proc/pdfgsijs $temp
case *
echo Unrecognized class of line printer for $LPDEST >[1=2]
}
case microsoft # office document
switch ($LPCLASS) {
case *post*
doc2ps $temp | $proc/post
case *gs!*
doc2ps $temp | $proc/post | $proc/gspipe
case *gsijs!*
doc2ps $temp | $proc/post | $proc/gspipeijs
case *
echo $type(2) file is improper for $LPDEST >[1=2]
}
case empty
echo file is empty >[1=2]
case cannot
echo cannot open file >[1=2]
case English short extended alef limbo [Aa]scii assembler c latin rc sh \
as mail email message/rfc822 manual HTML
switch ($LPCLASS) {
case *post*
$proc/ppost <$temp
case *gs!*
$proc/ppost <$temp | $proc/gspipe
case *gsijs!*
$proc/ppost <$temp | $proc/gspipeijs
case *canon*
$proc/can $* <$temp
case *
echo Unrecognized class of line printer for $LPDEST >[1=2]
}
case *
echo $type(2) file is improper for $LPDEST >[1=2]
}
wait
rv=$status
rm -f $temp
# exit $rv
exit

84
sys/lib/lp/process/gifpost Executable file
View file

@ -0,0 +1,84 @@
#!/bin/rc
# convert GIF format to PostScript
if (! ~ $DEBUG '') flag x +
PATCH='%%Patch from lp'
switch ($LPCLASS) {
case *hp4simx*;
PATCH=$PATCH'
%% set the default papertray to be the lower tray for HP4siMX printers
statusdict begin defaultpapertray end 1 ne {
statusdict begin
1 setdefaultpapertray
end
} if'
}
for (i in `{echo $IBIN|awk -F, '{ n=split($0, a, ","); for (i=1;i<=n;i++) print a[i]; }'}) {
switch ($i) {
case -P*;
case man manual manualfeed;
PATCH=$PATCH'
%%BeginFeature: *Select ManualFeed
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /ManualFeed true >> setpagedevice
} {statusdict begin /manualfeed true def end} ifelse
} stopped cleartomark
%%EndFeature'
case simplex;
DUPLEX=0
case [0-9];
PATCH=$PATCH'
%%BeginFeature: *Select InputTray
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< '$i' << /MediaType (tray'$i') >> >>
<< /MediaType (tray'$i') >> setpagedevice
} {statusdict begin '$i' setpapertray end} ifelse
} stopped cleartomark
%%EndFeature'
case 11x17 [Ll]edger;
PATCH=$PATCH'
%%BeginFeature: *Select Ledger
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /PageSize [792 1224] >> setpagedevice
} {statusdict begin '$i'tray end} ifelse
} stopped cleartomark
%%EndFeature'
case transparency vg viewgraph;
PATCH=$PATCH'
%%BeginFeature: *Select Transparency
[{ << /MediaType (Transparency) >> setpagedevice
} stopped cleartomark
%%EndFeature'
case *;
echo illegal option ''''-i $i'''' >[1=2]
}
}
if (! ~ $#DUPLEX 0) {
switch ($DUPLEX) {
case 0;
DUPLEX=false
case 1;
DUPLEX=true
}
PATCH=$PATCH'
%%BeginFeature: *Set DuplexMode
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /Duplex '$DUPLEX' >> setpagedevice
} {statusdict /setduplexmode known {statusdict begin '$DUPLEX' setduplexmode end} if} ifelse
} stopped cleartomark
%%EndFeature'
}
PATCH=$PATCH'
%%EndPatch from lp'
if (! ~ $PATCH '' -P*)
PATCH=-P$PATCH;
if (~ $MAG '') MAG=1
if (~ $MAG [.0-9]*) MAG=-m^$MAG
if (! ~ $LAND '') LAND=-L
if not LAND=()
/$cputype/bin/gif -t |
/$cputype/bin/aux/p9bitpost $MAG $LAND $PATCH |
$LPLIB/process/hpost
exit

24
sys/lib/lp/process/gspipe Executable file
View file

@ -0,0 +1,24 @@
#!/bin/rc
if (! ~ $DEBUG '') flag x +
# usage: gspipe [dev]
# assumes postscript on stdin
switch($#*) {
case 0
GSDEVICE=`{echo $LPCLASS | sed 's/(.*\+)?gs!([^+]*)(\+.*)?/\2/'}
case 1
GSDEVICE=$1
case *
echo 'usage: gspipe [dev]' >[1=2]
exit gspipe
}
GSTMPFILE=/tmp/gsp^$pid
GSOPT=('-sDEVICE='^$GSDEVICE '-sOUTPUTFILE='$GSTMPFILE -dSAFER -dNOPAUSE -dQUIET -dBATCH)
gs $GSOPT - >/dev/null
cat $GSTMPFILE
rm -f $GSTMPFILE
exit ''

35
sys/lib/lp/process/gspipeijs Executable file
View file

@ -0,0 +1,35 @@
#!/bin/rc
# extended to IJS driver by K.Okamoto
# duble-sided printing for PSC 2550 printer
#
if (! ~ $DEBUG '') flag x +
# usage: gspipeijs [dev]
# assumes postscript on stdin
switch($#*) {
case 0
MODEL=`{echo $LPCLASS | sed 's/(.*\+)?gsijs!([^+]*)(\+.*)?/\2/'}
NUMBER=`{echo $LPCLASS | sed 's/(.*\+)?gsijs!([^+]*)\+(.*)?/\3/'}
case 1
IJS=$1
case *
echo 'usage: gspipeijs [dev]' >[1=2]
exit gspipeijs
}
GSTMPFILE=/tmp/gsp$pid
switch($NUMBER) {
case 2100
GSOPT=(-q -sDEVICE'='ijs -sIjsServer'='hpijs -sDeviceManufacturer'='HP '-sDeviceModel='"$MODEL^' '^$NUMBER" -r600 -sOutputFile'='^$GSTMPFILE -sPAPERSIZE'='a4 -dIjsUseOutputFD -dSAFER -dNOPAUSE -DBATCH)
case 2500
GSOPT=(-q -sDEVICE'='ijs -sIjsServer'='hpijs -sDeviceManufacturer'='HP '-sDeviceModel='"$MODEL^' '^$NUMBER" -r600 -sOutputFile'='^$GSTMPFILE -dDuplex'='true -sPAPERSIZE'='a4 -dIjsUseOutputFD -dSAFER -dNOPAUSE -DBATCH)
}
gs $GSOPT -
cat $GSTMPFILE
rm $GSTMPFILE
exit

148
sys/lib/lp/process/hpost Executable file
View file

@ -0,0 +1,148 @@
#!/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}}' /lib/face/.machinelist}
if (~ $#facedom 0) facedom=$LPMACHID
facefile=`{awk '/^'$facedom'\/'$LPUSERID' /{print $2}' /lib/face/48x48x8/.dict}
facedepth=8
if (~ $#facefile 0) {
facefile=`{awk '/^'$facedom'\/'$LPUSERID' /{print $2}' /lib/face/48x48x4/.dict}
facedepth=4
}
if (~ $#facefile 0) {
facefile=`{awk '/^'$facedom'\/'$LPUSERID' /{print $2}' /lib/face/48x48x2/.dict}
facedepth=2
}
if (~ $#facefile 0) {
facefile=`{awk '/^'$facedom'\/'$LPUSERID' /{print $2}' /lib/face/48x48x1/.dict}
facedepth=1
}
if (~ $#facefile 0) {facefile=u/unknown.1; facedepth=1}
facefile=/lib/face/48x48x$facedepth/$facefile
if (! ~ $#facefile 0 1)
facefile=$facefile(1)
if (~ $#facefile 0 || ! test -f $facefile ) {facefile=/lib/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 8
face=`{iconv -u -c k4 $facefile |
dd -bs 60 -skip 1 >[2]/dev/null |
xd -b | sed 's/^[^ ]+ //;s/ //g' }
facedepth=8
}
}
}
# 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 <<EOF
%!PS-Adobe-2.0 div 112 page header - research!pg
/banner {
/saveobj save def
erasepage initgraphics
/#copies 1 def
/inch {72 mul} bind def
/pageborder {
25 747 moveto
590 747 lineto
590 25 lineto
25 25 lineto
closepath
2 setlinewidth
0 setgray
stroke
} def
/topborder {
25 773 moveto
590 773 lineto
590 747 lineto
25 747 lineto
closepath
2 setlinewidth
0 setgray
stroke
} def
/toptext {
120 756 moveto
/Courier-Bold findfont 14 scalefont setfont
($LPUSERID $DATE) show
} def
/prface {
gsave
translate rotate scale
setgray
48 48 $facedepth [48 0 0 -48 0 48] {<$face>} 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 <<EOF
statusdict /setduplexmode known {statusdict begin false setduplexmode end} if
statusdict begin /manualfeed false def end
pageborder
topborder
toptext
0 14 14 0 94 752 prface
.3 180 180 -90 3.0 inch 10.2 inch prface
showpage
saveobj
restore
} bind def
banner
EOF
if (~ $REVFLAG '') cat
exit ''

84
sys/lib/lp/process/jpgpost Executable file
View file

@ -0,0 +1,84 @@
#!/bin/rc
# convert JPG to PostScript
if (! ~ $DEBUG '') flag x +
PATCH='%%Patch from lp'
switch ($LPCLASS) {
case *hp4simx*;
PATCH=$PATCH'
%% set the default papertray to be the lower tray for HP4siMX printers
statusdict begin defaultpapertray end 1 ne {
statusdict begin
1 setdefaultpapertray
end
} if'
}
for (i in `{echo $IBIN|awk -F, '{ n=split($0, a, ","); for (i=1;i<=n;i++) print a[i]; }'}) {
switch ($i) {
case -P*;
case man manual manualfeed;
PATCH=$PATCH'
%%BeginFeature: *Select ManualFeed
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /ManualFeed true >> setpagedevice
} {statusdict begin /manualfeed true def end} ifelse
} stopped cleartomark
%%EndFeature'
case simplex;
DUPLEX=0
case [0-9];
PATCH=$PATCH'
%%BeginFeature: *Select InputTray
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< '$i' << /MediaType (tray'$i') >> >>
<< /MediaType (tray'$i') >> setpagedevice
} {statusdict begin '$i' setpapertray end} ifelse
} stopped cleartomark
%%EndFeature'
case 11x17 [Ll]edger;
PATCH=$PATCH'
%%BeginFeature: *Select Ledger
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /PageSize [792 1224] >> setpagedevice
} {statusdict begin '$i'tray end} ifelse
} stopped cleartomark
%%EndFeature'
case transparency vg viewgraph;
PATCH=$PATCH'
%%BeginFeature: *Select Transparency
[{ << /MediaType (Transparency) >> setpagedevice
} stopped cleartomark
%%EndFeature'
case *;
echo illegal option ''''-i $i'''' >[1=2]
}
}
if (! ~ $#DUPLEX 0) {
switch ($DUPLEX) {
case 0;
DUPLEX=false
case 1;
DUPLEX=true
}
PATCH=$PATCH'
%%BeginFeature: *Set DuplexMode
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /Duplex '$DUPLEX' >> setpagedevice
} {statusdict /setduplexmode known {statusdict begin '$DUPLEX' setduplexmode end} if} ifelse
} stopped cleartomark
%%EndFeature'
}
PATCH=$PATCH'
%%EndPatch from lp'
if (! ~ $PATCH '' -P*)
PATCH=-P$PATCH;
if (~ $MAG '') MAG=1
if (~ $MAG [.0-9]*) MAG=-m^$MAG
if (! ~ $LAND '') LAND=-L
if not LAND=()
/$cputype/bin/jpg -t9 |
/$cputype/bin/aux/p9bitpost $MAG $LAND $PATCH -p 32 26.17 |
$LPLIB/process/hpost
exit

3
sys/lib/lp/process/noproc Executable file
View file

@ -0,0 +1,3 @@
#!/bin/rc
# No processing, copy file from input to output
cat

83
sys/lib/lp/process/p9bitpost Executable file
View file

@ -0,0 +1,83 @@
#!/bin/rc
# convert plan 9 image to PostScript
if (~ $DEBUG 1) flag x +
PATCH='%%Patch from lp'
switch ($LPCLASS) {
case *hp4simx*;
PATCH=$PATCH'
%% set the default papertray to be the lower tray for HP4siMX printers
statusdict begin defaultpapertray end 1 ne {
statusdict begin
1 setdefaultpapertray
end
} if'
}
for (i in `{echo $IBIN|awk -F, '{ n=split($0, a, ","); for (i=1;i<=n;i++) print a[i]; }'}) {
switch ($i) {
case -P*;
case man manual manualfeed;
PATCH=$PATCH'
%%BeginFeature: *Select ManualFeed
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /ManualFeed true >> setpagedevice
} {statusdict begin /manualfeed true def end} ifelse
} stopped cleartomark
%%EndFeature'
case simplex;
DUPLEX=0
case [0-9];
PATCH=$PATCH'
%%BeginFeature: *Select InputTray
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< '$i' << /MediaType (tray'$i') >> >>
<< /MediaType (tray'$i') >> setpagedevice
} {statusdict begin '$i' setpapertray end} ifelse
} stopped cleartomark
%%EndFeature'
case 11x17 [Ll]edger;
PATCH=$PATCH'
%%BeginFeature: *Select Ledger
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /PageSize [792 1224] >> setpagedevice
} {statusdict begin '$i'tray end} ifelse
} stopped cleartomark
%%EndFeature'
case transparency vg viewgraph;
PATCH=$PATCH'
%%BeginFeature: *Select Transparency
[{ << /MediaType (Transparency) >> setpagedevice
} stopped cleartomark
%%EndFeature'
case *;
echo illegal option ''''-i $i'''' >[1=2]
}
}
if (! ~ $#DUPLEX 0) {
switch ($DUPLEX) {
case 0;
DUPLEX=false
case 1;
DUPLEX=true
}
PATCH=$PATCH'
%%BeginFeature: *Set DuplexMode
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /Duplex '$DUPLEX' >> setpagedevice
} {statusdict /setduplexmode known {statusdict begin '$DUPLEX' setduplexmode end} if} ifelse
} stopped cleartomark
%%EndFeature'
}
PATCH=$PATCH'
%%EndPatch from lp'
if (! ~ $PATCH '' -P*)
PATCH=-P$PATCH;
if (! ~ $LAND '') LAND=-L
if not LAND=()
# if (! ~ $COPIES '' -c*) COPIES=-c^$COPIES
if (! ~ $MAG '') MAG=-m^$MAG
if (~ $MAG '') MAG=()
# if (! ~ $NPAG '' -n*) NPAG=-n^$NPAG
# if (! ~ $XOFF '' -x*) XOFF=-x^$XOFF
# if (! ~ $YOFF '' -y*) YOFF=-y^$YOFF
/$cputype/bin/aux/p9bitpost $MAG $LAND $PATCH | $LPLIB/process/hpost
exit

71
sys/lib/lp/process/pdfgs Executable file
View file

@ -0,0 +1,71 @@
#!/bin/rc
# pdfgs pdffile [gsdev] - generate PS from PDF
#
# we don't go through postscript, because to
# get to postscript, we send the pdf through gs!
# much easier to just go directly.
switch($#*) {
case 2
GSDEVICE=$2
case 1
GSDEVICE=`{echo $LPCLASS | sed 's/(.*\+)?gs!([^+]*)(\+.*)?/\2/'}
case *
echo 'usage: pdfgs pdffile [gsdev]' >[1=2]
exit usage
}
GSTMPFILE=/tmp/pdf^$pid
GSOPT=('-sDEVICE='$GSDEVICE '-sOutputFile='^$GSTMPFILE -dSAFER -dNOPAUSE \
-dQUIET -dBATCH -dNOPAUSE)
# ps level 1 is extremely verbose and tends to run our
# printers out of memory when printing images.
if(~ $GSDEVICE pswrite && ~ $LPCLASS *post2*)
GSOPT=($GSOPT '-dLanguageLevel=2')
if not if(~ $GSDEVICE pswrite)
GSOPT=($GSOPT '-dLanguageLevel=1')
if(~ $OLIST '')
gs $GSOPT $1
if not {
PGLIST=`{echo $OLIST | sed 's/-o//;s/,/ /g;s/ / /g' | tr -cd '0-9 -'}
GSPGLIST=()
for(i in $PGLIST){
switch($i){
case -*
GSPGLIST=($GSPGLIST `{seq 1 `{echo $i|tr -d '-'}})
case *-
# BUG assume 100 >= number of pages
GSPGLIST=($GSPGLIST `{seq `{echo $i|tr -d '-'} 100})
case *-*
GSPGLIST=($GSPGLIST `{seq `{echo $i|tr '-' ' '}})
case *
GSPGLIST=($GSPGLIST $i)
}
}
GSPGLIST=$"GSPGLIST
echo '
/Page null def
/Page# 0 def
/PDFSave null def
/DSCPageCount 0 def
/DoPDFPage {dup /Page# exch store pdfgetpage pdfshowpage} def
GS_PDF_ProcSet begin
pdfdict begin
('^$1^') (r) file pdfopen begin
/npage pdfpagecount def
['^$GSPGLIST^']
{
dup dup
1 ge exch npage le and
{ DoPDFPage }
{ pop }
ifelse
} forall
' | gs $GSOPT - >/dev/null >[2=1]
}
cat $GSTMPFILE
rm -f $GSTMPFILE
exit ''

63
sys/lib/lp/process/pdfgsijs Executable file
View file

@ -0,0 +1,63 @@
#!/bin/rc
# usage: pdfgsijs pdffile
gs -dSAFER -dNOPAUSE -dBATCH -q -s'DEVICE=pswrite' -d'LanguageLevel=2' -s'OutputFile=/tmp/pdf2ps.ps' $1
MODEL=`{echo $LPCLASS | sed 's/(.*\+)?gsijs!([^+]*)(\+.*)?/\2/'}
NUMBER=`{echo $LPCLASS | sed 's/(.*\+)?gsijs!([^+]*)\+(.*)?/\3/'}
GSTMPFILE=/tmp/pdf^$pid
switch($NUMBER) {
case 2100
GSOPT=(-q -sDEVICE'='ijs -sIjsServer'='hpijs -sDeviceManufacturer'='HP '-sDeviceModel='"$MODEL^' '^$NUMBER" -r600 -sOutputFile'='^$GSTMPFILE -sPAPERSIZE'='a4 -dIjsUseOutputFD -dSAFER -dNOPAUSE -dBATCH)
case 2500
GSOPT=(-q -sDEVICE'='ijs -sIjsServer'='hpijs -sDeviceManufacturer'='HP '-sDeviceModel='"$MODEL^' '^$NUMBER" -r600 -sOutputFile'='^$GSTMPFILE -dDuplex'='true -sPAPERSIZE'='a4 -dIjsUseOutputFD -dSAFER -dNOPAUSE -DBATCH)
}
if(~ $OLIST '')
gs $GSOPT /tmp/pdf2ps.ps
if not {
PGLIST=`{echo $OLIST | sed 's/-o//;s/,/ /g;s/ / /g' | tr -cd '0-9 -'}
GSPGLIST=()
for(i in $PGLIST){
switch($i){
case -*
GSPGLIST=($GSPGLIST `{seq 1 `{echo $i|tr -d '-'}})
case *-
# BUG assume 100 >= number of pages
GSPGLIST=($GSPGLIST `{seq `{echo $i|tr -d '-'} 100})
case *-*
GSPGLIST=($GSPGLIST `{seq `{echo $i|tr '-' ' '}})
case *
GSPGLIST=($GSPGLIST $i)
}
}
GSPGLIST=$"GSPGLIST
echo '
/Page null def
/Page# 0 def
/PDFSave null def
/DSCPageCount 0 def
/DoPDFPage {dup /Page# exch store pdfgetpage pdfshowpage} def
GS_PDF_ProcSet begin
pdfdict begin
('^$1^') (r) file pdfopen begin
/npage pdfpagecount def
['^$GSPGLIST^']
{
dup dup
1 ge exch npage le and
{ DoPDFPage }
{ pop }
ifelse
} forall
' | gs $GSOPT - >/dev/null >[2=1]
}
cat $GSTMPFILE
rm -f $GSTMPFILE
rm -f /tmp/pdf2ps.ps
exit ''

76
sys/lib/lp/process/pdfpost Executable file
View file

@ -0,0 +1,76 @@
#!/bin/rc
# convert PDF output to PostScript
if (! ~ $DEBUG '') flag x +
PATCH='%!PS
%%Patch from lp'
switch ($LPCLASS) {
case *hp4simx*;
PATCH=$PATCH'
%% set the default papertray to be the lower tray for HP4siMX printers
statusdict begin defaultpapertray end 1 ne {
statusdict begin
1 setdefaultpapertray
end
} if'
}
for (i in `{echo $IBIN|awk -F, '{ n=split($0, a, ","); for (i=1;i<=n;i++) print a[i]; }'}) {
switch ($i) {
case -P*;
case man manual manualfeed;
PATCH=$PATCH'
%%BeginFeature: *Select ManualFeed
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /ManualFeed true >> setpagedevice
} {statusdict begin /manualfeed true def end} ifelse
} stopped cleartomark
%%EndFeature'
case simplex;
DUPLEX=0
case [0-9];
PATCH=$PATCH'
%%BeginFeature: *Select InputTray
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /MediaType (tray'$i') >> setpagedevice
} {statusdict begin '$i' setpapertray end} ifelse
} stopped cleartomark
%%EndFeature'
case 11x17 [Ll]edger;
PATCH=$PATCH'
%%BeginFeature: *Select Ledger
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /PageSize [792 1224] >> setpagedevice
} {statusdict begin '$i'tray end} ifelse
} stopped cleartomark
%%EndFeature'
case transparency vg viewgraph;
PATCH=$PATCH'
%%BeginFeature: *Select Transparency
[{ << /MediaType (Transparency) >> setpagedevice
} stopped cleartomark
%%EndFeature'
case *;
echo illegal option ''''-i $i'''' >[1=2]
}
}
if (! ~ $#DUPLEX 0) {
switch ($DUPLEX) {
case 0;
DUPLEX=false
case 1;
DUPLEX=true
}
PATCH=$PATCH'
%%BeginFeature: *Set DuplexMode
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /Duplex '$DUPLEX' >> setpagedevice
} {statusdict /setduplexmode known {statusdict begin '$DUPLEX' setduplexmode end} if} ifelse
} stopped cleartomark
%%EndFeature'
}
PATCH=$PATCH'
%%EndPatch from lp
'
echo $PATCH
pdfgs $1 pswrite | $LPLIB/process/hpost
exit ''

84
sys/lib/lp/process/pngpost Executable file
View file

@ -0,0 +1,84 @@
#!/bin/rc
# convert PNG format to PostScript
if (! ~ $DEBUG '') flag x +
PATCH='%%Patch from lp'
switch ($LPCLASS) {
case *hp4simx*;
PATCH=$PATCH'
%% set the default papertray to be the lower tray for HP4siMX printers
statusdict begin defaultpapertray end 1 ne {
statusdict begin
1 setdefaultpapertray
end
} if'
}
for (i in `{echo $IBIN|awk -F, '{ n=split($0, a, ","); for (i=1;i<=n;i++) print a[i]; }'}) {
switch ($i) {
case -P*;
case man manual manualfeed;
PATCH=$PATCH'
%%BeginFeature: *Select ManualFeed
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /ManualFeed true >> setpagedevice
} {statusdict begin /manualfeed true def end} ifelse
} stopped cleartomark
%%EndFeature'
case simplex;
DUPLEX=0
case [0-9];
PATCH=$PATCH'
%%BeginFeature: *Select InputTray
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< '$i' << /MediaType (tray'$i') >> >>
<< /MediaType (tray'$i') >> setpagedevice
} {statusdict begin '$i' setpapertray end} ifelse
} stopped cleartomark
%%EndFeature'
case 11x17 [Ll]edger;
PATCH=$PATCH'
%%BeginFeature: *Select Ledger
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /PageSize [792 1224] >> setpagedevice
} {statusdict begin '$i'tray end} ifelse
} stopped cleartomark
%%EndFeature'
case transparency vg viewgraph;
PATCH=$PATCH'
%%BeginFeature: *Select Transparency
[{ << /MediaType (Transparency) >> setpagedevice
} stopped cleartomark
%%EndFeature'
case *;
echo illegal option ''''-i $i'''' >[1=2]
}
}
if (! ~ $#DUPLEX 0) {
switch ($DUPLEX) {
case 0;
DUPLEX=false
case 1;
DUPLEX=true
}
PATCH=$PATCH'
%%BeginFeature: *Set DuplexMode
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /Duplex '$DUPLEX' >> setpagedevice
} {statusdict /setduplexmode known {statusdict begin '$DUPLEX' setduplexmode end} if} ifelse
} stopped cleartomark
%%EndFeature'
}
PATCH=$PATCH'
%%EndPatch from lp'
if (! ~ $PATCH '' -P*)
PATCH=-P$PATCH;
if (~ $MAG '') MAG=1
if (~ $MAG [.0-9]*) MAG=-m^$MAG
if (! ~ $LAND '') LAND=-L
if not LAND=()
/$cputype/bin/png -9t |
/$cputype/bin/aux/p9bitpost $MAG $LAND $PATCH |
$LPLIB/process/hpost
exit

68
sys/lib/lp/process/post Executable file
View file

@ -0,0 +1,68 @@
#!/bin/rc
if (! ~ $DEBUG '') flag x +
PATCH='%!PS
%%Patch from lp'
switch ($LPCLASS) {
case *hp4simx*;
PATCH=$PATCH'
%% set the default papertray to be the lower tray for HP4siMX printers
statusdict begin defaultpapertray end 1 ne {
statusdict begin
1 setdefaultpapertray
end
} if'
}
for (i in `{echo $IBIN|awk -F, '{ n=split($0, a, ","); for (i=1;i<=n;i++) print a[i]; }'}) {
switch ($i) {
case -P*;
case man manual manualfeed;
PATCH=$PATCH'
%%BeginFeature: *Select ManualFeed
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /ManualFeed true >> setpagedevice
} {statusdict begin /manualfeed true def end} ifelse
} stopped cleartomark
%%EndFeature'
case simplex;
DUPLEX=0
case [0-9];
PATCH=$PATCH'
%%BeginFeature: *Select InputTray
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< '$i' << /MediaType (tray'$i') >> >>
<< /MediaType (tray'$i') >> setpagedevice
} {statusdict begin '$i' setpapertray end} ifelse
} stopped cleartomark
%%EndFeature'
case 11x17 [Ll]edger;
PATCH=$PATCH'
%%BeginFeature: *Select Ledger
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /PageSize [792 1224] >> setpagedevice
} {statusdict begin '$i'tray end} ifelse
} stopped cleartomark
%%EndFeature'
case transparency vg viewgraph;
PATCH=$PATCH'
%%BeginFeature: *Select Transparency
[{ << /MediaType (Transparency) >> setpagedevice
} stopped cleartomark
%%EndFeature'
case *;
echo illegal option ''''-i $i'''' ignored >[1=2]
}
}
#if (! ~ $#DUPLEX 0) {
# if (~ $DUPLEX 1 )
# PATCH=$PATCH'
#statusdict /setduplexmode known {statusdict begin true setduplexmode end} if';
# if (~ $DUPLEX 0 )
# PATCH=$PATCH'
#statusdict /setduplexmode known {statusdict begin false setduplexmode end} if';
#}
PATCH=$PATCH'
%%EndPatch from lp
'
{ echo $PATCH; psextract } | $LPLIB/process/hpost

99
sys/lib/lp/process/ppost Executable file
View file

@ -0,0 +1,99 @@
#!/bin/rc
# converts a regular text file to PostScript
if (! ~ $DEBUG '') flag x +
PATCH='%%Patch from lp'
switch ($LPCLASS) {
case *hp4simx*;
PATCH=$PATCH'
%% set the default papertray to be the lower tray for HP4siMX printers
statusdict begin defaultpapertray end 1 ne {
statusdict begin
1 setdefaultpapertray
end
} if'
}
for (i in `{echo $IBIN|awk -F, '{ n=split($0, a, ","); for (i=1;i<=n;i++) print a[i]; }'}) {
switch ($i) {
case -P*;
case man manual manualfeed;
PATCH=$PATCH'
%%BeginFeature: *Select ManualFeed
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /ManualFeed true >> setpagedevice
} {statusdict begin /manualfeed true def end} ifelse
} stopped cleartomark
%%EndFeature'
case simplex;
DUPLEX=0
case [0-9];
PATCH=$PATCH'
%%BeginFeature: *Select InputTray
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< '$i' << /MediaType (tray'$i') >> >>
<< /MediaType (tray'$i') >> setpagedevice
} {statusdict begin '$i' setpapertray end} ifelse
} stopped cleartomark
%%EndFeature'
case 11x17 [Ll]edger;
PATCH=$PATCH'
%%BeginFeature: *Select Ledger
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /PageSize [792 1224] >> setpagedevice
} {statusdict begin '$i'tray end} ifelse
} stopped cleartomark
%%EndFeature'
case transparency vg viewgraph;
PATCH=$PATCH'
%%BeginFeature: *Select Transparency
[{ << /MediaType (Transparency) >> setpagedevice
} stopped cleartomark
%%EndFeature'
case *;
echo illegal option ''''-i $i'''' >[1=2]
}
}
if (! ~ $#DUPLEX 0) {
switch ($DUPLEX) {
case 0;
DUPLEX=false
case 1;
DUPLEX=true
}
PATCH=$PATCH'
%%BeginFeature: *Set DuplexMode
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /Duplex '$DUPLEX' >> setpagedevice
} {statusdict /setduplexmode known {statusdict begin '$DUPLEX' setduplexmode end} if} ifelse
} stopped cleartomark
%%EndFeature'
}
PATCH=$PATCH'
%%EndPatch from lp
'
if (! ~ $PATCH '' -P*)
PATCH=-P''''$PATCH'''';
switch ($LAND) {
case -p*;
case ''; LAND=-pp
case 1; LAND=-pl
}
if (! ~ $COPIES '' -c*) COPIES=-c^$COPIES
switch ($FONT) {
case ''; FONT=-f'Courier'
case -f*;
case *; FONT=-f$FONT
}
switch ($POINT) {
case ''; POINT=-s10
case -s*;
case *; POINT=-s$POINT
}
if (! ~ $LINES '' -l*) LINES=-l^$LINES;
if (! ~ $MAG '' -m*) MAG=-m^$MAG;
if (! ~ $NPAG '' -n*) NPAG=-n^$NPAG;
if (! ~ $XOFF '' -x*) XOFF=-x`{echo $XOFF + .4|hoc};
if not XOFF=-x.4
if (! ~ $YOFF '' -y*) YOFF=-y^$YOFF;
eval /$cputype/bin/aux/text2post $FONT $XOFF $YOFF $COPIES $LINES $MAG $NPAG $POINT $LAND $OLIST $PATCH | $LPLIB/process/hpost
# eval /$cputype/bin/aux/postprint -EUTF $FONT $XOFF $YOFF $COPIES $LINES $MAG $NPAG $POINT $LAND $OLIST $PATCH | $LPLIB/process/hpost
exit

60
sys/lib/lp/process/psextract Executable file
View file

@ -0,0 +1,60 @@
#!/bin/rc
# extract pages $OLIST from postscript on stdin
if(~ $OLIST '')
exec cat
awk '
BEGIN {
x=ENVIRON["OLIST"];
gsub(/^-o/, "", x);
na = split(x, a, ",");
header = 1;
goodpage = 0;
}
header || goodpage {
print
}
/^%%EndSetup[ ]*$/ { header = 0; next }
/^%%Page:/ {
header = 0;
p=$2+0;
goodpage = 0;
for(i=1; i<=na; i++){
if(aa=match(a[i], "-")){
low=substr(a[i], 1, RSTART);
high=substr(a[i], RSTART+RLENGTH);
if(low == "")
low = 0;
else
low = low+0;
if(high == "")
high = 100000;
else
high = high+0;
if(low <= p && p <= high){
goodpage = 1;
break;
}
}else{
if(a[i] == p){
goodpage = 1;
break;
}
}
}
}
/^%%EndPage[ ]*$/ {
goodpage = 0;
}
/^%%Trailer[ ]*$/ {
goodpage = 1;
}
'

74
sys/lib/lp/process/testpost Executable file
View file

@ -0,0 +1,74 @@
#!/bin/rc
if (! ~ $DEBUG '') flag x +
PATCH='%%Patch from lp'
switch ($LPCLASS) {
case *hp4simx*;
PATCH=$PATCH'
%% set the default papertray to be the lower tray for HP4siMX printers
statusdict begin defaultpapertray end 1 ne {
statusdict begin
1 setdefaultpapertray
end
} if'
}
for (i in `{echo $IBIN|awk -F, '{ n=split($0, a, ","); for (i=1;i<=n;i++) print a[i]; }'}) {
switch ($i) {
case -P*;
case man manual manualfeed;
PATCH=$PATCH'
%%BeginFeature: *Select InputSlot
[{
systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
(<<) cvx exec
/ManualFeed true
(>>) cvx exec setpagedevice
} {statusdict begin /manualfeed true def end} ifelse
} stopped cleartomark
%%EndFeature'
case simplex;
DUPLEX=0
case [0-9];
PATCH=$PATCH'
%%BeginFeature: *Select InputSlot
[{
systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< '$i' << /MediaType (tray'$i') >> >>
<< /MediaType (tray'$i') >> setpagedevice
} {statusdict begin '$i' setpapertray end} ifelse
} stopped cleartomark
%%EndFeature'
case 11x17 ledger;
PATCH=$PATCH'
%%BeginFeature: *Select InputMedia
[{
systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
(<<) cvx exec
/MediaType '$i'
(>>) cvx exec setpagedevice
} {statusdict begin '$i'tray end} ifelse
} stopped cleartomark
%%EndFeature'
case *;
echo illegal option ''''-i $i'''' ignored >[1=2]
}
}
if (! ~ $#DUPLEX 0) {
switch ($DUPLEX) {
case 0;
DUPLEX=false
case 1;
DUPLEX=true
}
PATCH=$PATCH'
%%BeginFeature: *Set DuplexMode
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /Duplex '$DUPLEX' >> setpagedevice
} {statusdict /setduplexmode known {statusdict begin '$DUPLEX' setduplexmode end} if} ifelse
} stopped cleartomark
%%EndFeature'
}
PATCH=$PATCH'
%%EndPatch from lp
'
echo $PATCH; cat

85
sys/lib/lp/process/tiffpost Executable file
View file

@ -0,0 +1,85 @@
#!/bin/rc
# convert TIFF format to PostScript
if (! ~ $DEBUG '') flag x +
PATCH='%%Patch from lp'
switch ($LPCLASS) {
case *hp4simx*;
PATCH=$PATCH'
%% set the default papertray to be the lower tray for HP4siMX printers
statusdict begin defaultpapertray end 1 ne {
statusdict begin
1 setdefaultpapertray
end
} if'
}
for (i in `{echo $IBIN|awk -F, '{ n=split($0, a, ","); for (i=1;i<=n;i++) print a[i]; }'}) {
switch ($i) {
case -P*;
case man manual manualfeed;
PATCH=$PATCH'
%%BeginFeature: *Select ManualFeed
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /ManualFeed true >> setpagedevice
} {statusdict begin /manualfeed true def end} ifelse
} stopped cleartomark
%%EndFeature'
case simplex;
DUPLEX=0
case [0-9];
PATCH=$PATCH'
%%BeginFeature: *Select InputTray
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< '$i' << /MediaType (tray'$i') >> >>
<< /MediaType (tray'$i') >> setpagedevice
} {statusdict begin '$i' setpapertray end} ifelse
} stopped cleartomark
%%EndFeature'
case 11x17 [Ll]edger;
PATCH=$PATCH'
%%BeginFeature: *Select Ledger
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /PageSize [792 1224] >> setpagedevice
} {statusdict begin '$i'tray end} ifelse
} stopped cleartomark
%%EndFeature'
case transparency vg viewgraph;
PATCH=$PATCH'
%%BeginFeature: *Select Transparency
[{ << /MediaType (Transparency) >> setpagedevice
} stopped cleartomark
%%EndFeature'
case *;
echo illegal option ''''-i $i'''' >[1=2]
}
}
if (! ~ $#DUPLEX 0) {
switch ($DUPLEX) {
case 0;
DUPLEX=false
case 1;
DUPLEX=true
}
PATCH=$PATCH'
%%BeginFeature: *Set DuplexMode
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /Duplex '$DUPLEX' >> setpagedevice
} {statusdict /setduplexmode known {statusdict begin '$DUPLEX' setduplexmode end} if} ifelse
} stopped cleartomark
%%EndFeature'
}
PATCH=$PATCH'
%%EndPatch from lp'
if (! ~ $PATCH '' -P*)
PATCH=-P$PATCH;
if (~ $MAG '') MAG=1
if (~ $MAG [.0-9]*) MAG=-m^$MAG
if (! ~ $LAND '') LAND=-L
if not LAND=()
fb/tiff2pic $1 |
fb/3to1 rgbv |
fb/pcp -tplan9 |
/$cputype/bin/aux/p9bitpost $MAG $LAND $PATCH |
$LPLIB/process/hpost

86
sys/lib/lp/process/tr2post Executable file
View file

@ -0,0 +1,86 @@
#!/bin/rc
if (~ $DEBUG 1) flag x +
# convert troff output to PostScript
PATCH='%%Patch from lp'
switch ($LPCLASS) {
case *hp4simx*;
PATCH=$PATCH'
%% set the default papertray to be the lower tray for HP4siMX printers
statusdict begin defaultpapertray end 1 ne {
statusdict begin
1 setdefaultpapertray
end
} if'
}
for (i in `{echo $IBIN|awk -F, '{ n=split($0, a, ","); for (i=1;i<=n;i++) print a[i]; }'}) {
switch ($i) {
case -P*;
case man manual manualfeed;
PATCH=$PATCH'
%%BeginFeature: *Select ManualFeed
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /ManualFeed true >> setpagedevice
} {statusdict begin /manualfeed true def end} ifelse
} stopped cleartomark
%%EndFeature'
case simplex;
DUPLEX=0
case [0-9];
PATCH=$PATCH'
%%BeginFeature: *Select InputTray
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< '$i' << /MediaType (tray'$i') >> >>
<< /MediaType (tray'$i') >> setpagedevice
} {statusdict begin '$i' setpapertray end} ifelse
} stopped cleartomark
%%EndFeature'
case 11x17 [Ll]edger;
PATCH=$PATCH'
%%BeginFeature: *Select Ledger
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /PageSize [792 1224] >> setpagedevice
} {statusdict begin '$i'tray end} ifelse
} stopped cleartomark
%%EndFeature'
case transparency vg viewgraph;
PATCH=$PATCH'
%%BeginFeature: *Select Transparency
[{ << /MediaType (Transparency) >> setpagedevice
} stopped cleartomark
%%EndFeature'
case *;
echo illegal option ''''-i $i'''' >[1=2]
}
}
if (! ~ $#DUPLEX 0) {
switch ($DUPLEX) {
case 0;
DUPLEX=false
case 1;
DUPLEX=true
}
PATCH=$PATCH'
%%BeginFeature: *Set DuplexMode
[{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
<< /Duplex '$DUPLEX' >> setpagedevice
} {statusdict /setduplexmode known {statusdict begin '$DUPLEX' setduplexmode end} if} ifelse
} stopped cleartomark
%%EndFeature'
}
PATCH=$PATCH'
%%EndPatch from lp
'
if (! ~ $PATCH '' -P*)
PATCH=-P''''$PATCH'''';
switch ($LAND) {
case -p*;
case ''; LAND=-pp
case 1; LAND=-pl
}
if (! ~ $COPIES '' -c*) COPIES=-c^$COPIES
if (! ~ $MAG '' -m*) MAG=-m^$MAG
if (! ~ $NPAG '' -n*) NPAG=-n^$NPAG
if (! ~ $XOFF '' -x*) XOFF=-x^$XOFF
if (! ~ $YOFF '' -y*) YOFF=-y^$YOFF
eval /$cputype/bin/aux/tr2post $XOFF $YOFF $COPIES $MAG $NPAG $LAND $OLIST $PATCH | $LPLIB/process/hpost
exit