dots

Personal dotfiles
git clone git://git.gormless.xyz/dots.git
Log | Files | Refs

post (1974B)


      1 #!/var/usrlocal/plan9/bin/rc
      2 if (! ~ $DEBUG '') flag x +
      3 PATCH='%!PS
      4 %%Patch from lp'
      5 switch ($LPCLASS) {
      6 case *hp4simx*;
      7 	PATCH=$PATCH'
      8 %% set the default papertray to be the lower tray for HP4siMX printers
      9 	statusdict begin defaultpapertray end 1 ne {
     10 		statusdict begin
     11 			1 setdefaultpapertray
     12 		end
     13 	} if'
     14 }
     15 for (i in `{echo $IBIN|awk -F, '{ n=split($0, a, ","); for (i=1;i<=n;i++) print a[i]; }'}) {
     16 	switch ($i) {
     17 	case -P*;
     18 	case man manual manualfeed;
     19 		PATCH=$PATCH'
     20 %%BeginFeature: *Select ManualFeed
     21 [{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
     22     << /ManualFeed true >> setpagedevice
     23    } {statusdict begin /manualfeed true def end} ifelse
     24  } stopped cleartomark
     25 %%EndFeature'
     26 	case simplex;
     27 		DUPLEX=0
     28 	case [0-9];
     29 		PATCH=$PATCH'
     30 %%BeginFeature: *Select InputTray
     31 [{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
     32 	<< '$i' << /MediaType (tray'$i') >> >>
     33     << /MediaType (tray'$i') >> setpagedevice
     34    } {statusdict begin '$i' setpapertray end} ifelse
     35  } stopped cleartomark
     36 %%EndFeature'
     37 	case 11x17 [Ll]edger;
     38 		PATCH=$PATCH'
     39 %%BeginFeature: *Select Ledger
     40 [{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
     41     << /PageSize [792 1224] >> setpagedevice
     42    } {statusdict begin '$i'tray end} ifelse
     43  } stopped cleartomark
     44 %%EndFeature'
     45 	case transparency vg viewgraph;
     46 		PATCH=$PATCH'
     47 %%BeginFeature: *Select Transparency
     48 [{ << /MediaType (Transparency) >> setpagedevice
     49  } stopped cleartomark
     50 %%EndFeature'
     51 	case *;
     52 		echo illegal option ''''-i $i'''' ignored >[1=2]
     53 	}
     54 }
     55 #if (! ~ $#DUPLEX 0) {
     56 #	if (~ $DUPLEX 1 )
     57 #		PATCH=$PATCH'
     58 #statusdict /setduplexmode known {statusdict begin true setduplexmode end} if';
     59 #	if (~ $DUPLEX 0 )
     60 #		PATCH=$PATCH'
     61 #statusdict /setduplexmode known {statusdict begin false setduplexmode end} if';
     62 #}
     63 PATCH=$PATCH'
     64 %%EndPatch from lp
     65 '
     66 
     67 { echo $PATCH; psextract } | $LPLIB/process/hpost
     68