Plan 9 from Bell Labs’s /usr/web/sources/plan9/sys/lib/lp/process/testpost

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/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

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].