1
0

p9bitpost 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!/bin/rc
  2. # convert plan 9 image to PostScript
  3. if (~ $DEBUG 1) flag x +
  4. PATCH='%%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'''' >[1=2]
  53. }
  54. }
  55. if (! ~ $#DUPLEX 0) {
  56. switch ($DUPLEX) {
  57. case 0;
  58. DUPLEX=false
  59. case 1;
  60. DUPLEX=true
  61. }
  62. PATCH=$PATCH'
  63. %%BeginFeature: *Set DuplexMode
  64. [{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
  65. << /Duplex '$DUPLEX' >> setpagedevice
  66. } {statusdict /setduplexmode known {statusdict begin '$DUPLEX' setduplexmode end} if} ifelse
  67. } stopped cleartomark
  68. %%EndFeature'
  69. }
  70. PATCH=$PATCH'
  71. %%EndPatch from lp'
  72. if (! ~ $PATCH '' -P*)
  73. PATCH=-P$PATCH;
  74. if (! ~ $LAND '') LAND=-L
  75. if not LAND=()
  76. # if (! ~ $COPIES '' -c*) COPIES=-c^$COPIES
  77. if (! ~ $MAG '') MAG=-m^$MAG
  78. if (~ $MAG '') MAG=()
  79. # if (! ~ $NPAG '' -n*) NPAG=-n^$NPAG
  80. # if (! ~ $XOFF '' -x*) XOFF=-x^$XOFF
  81. # if (! ~ $YOFF '' -y*) YOFF=-y^$YOFF
  82. /$cputype/bin/aux/p9bitpost $MAG $LAND $PATCH | $LPLIB/process/hpost
  83. exit