dpost 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/bin/rc
  2. if (~ $DEBUG 1) flag x +
  3. # convert troff output to PostScript
  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. << /MediaType (tray'$i') >> setpagedevice
  33. } {statusdict begin '$i' setpapertray end} ifelse
  34. } stopped cleartomark
  35. %%EndFeature'
  36. case 11x17 [Ll]edger;
  37. PATCH=$PATCH'
  38. %%BeginFeature: *Select Ledger
  39. [{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
  40. << /PageSize [792 1224] >> setpagedevice
  41. } {statusdict begin '$i'tray end} ifelse
  42. } stopped cleartomark
  43. %%EndFeature'
  44. case transparency vg viewgraph;
  45. PATCH=$PATCH'
  46. %%BeginFeature: *Select Transparency
  47. [{ << /MediaType (Transparency) >> setpagedevice
  48. } stopped cleartomark
  49. %%EndFeature'
  50. case *;
  51. echo illegal option ''''-i $i'''' >[1=2]
  52. }
  53. }
  54. if (! ~ $#DUPLEX 0) {
  55. switch ($DUPLEX) {
  56. case 0;
  57. DUPLEX=false
  58. case 1;
  59. DUPLEX=true
  60. }
  61. PATCH=$PATCH'
  62. %%BeginFeature: *Set DuplexMode
  63. [{ systemdict /languagelevel known {languagelevel 1 gt product (HP LaserJet 4Si) ne and} if {
  64. << /Duplex '$DUPLEX' >> setpagedevice
  65. } {statusdict /setduplexmode known {statusdict begin '$DUPLEX' setduplexmode end} if} ifelse
  66. } stopped cleartomark
  67. %%EndFeature';
  68. }
  69. if (! ~ $PATCH '' -P*)
  70. PATCH=-P''''$PATCH'''';
  71. switch ($LAND) {
  72. case -p*;
  73. case ''; LAND=-pp
  74. case 1; LAND=-pl
  75. }
  76. if (! ~ $COPIES '' -c*) COPIES=-c^$COPIES
  77. if (! ~ $MAG '' -m*) MAG=-m^$MAG
  78. if (! ~ $NPAG '' -n*) NPAG=-n^$NPAG
  79. if (! ~ $XOFF '' -x*) XOFF=-x^$XOFF
  80. if (! ~ $YOFF '' -y*) YOFF=-y^$YOFF
  81. eval /$cputype/bin/aux/dpost -e2 -w0.5 $XOFF $YOFF $COPIES $MAG $NPAG $LAND $OLIST $PATCH | $LPLIB/process/hpost
  82. exit