hpost 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. #!/bin/rc
  2. if (! ~ $DEBUG '') flag x +
  3. REVFLAG=''
  4. if (~ $LPCLASS *reverse*) {
  5. switch ($REVERSE) {
  6. case '';
  7. REVFLAG=1
  8. case 1;
  9. REVFLAG=''
  10. }
  11. }
  12. if (! ~ $REVFLAG '')
  13. postreverse
  14. if (~ $NOHEAD '') {
  15. DATE=`{date}
  16. face='FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  17. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  18. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  19. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  20. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  21. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  22. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  23. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  24. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  25. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  26. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  27. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  28. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  29. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  30. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  31. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  32. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
  33. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'
  34. facedom=`{awk '{ if(match("'$LPMACHID'", $1)) {print $2; exit}}' /lib/face/.machinelist}
  35. if (~ $#facedom 0) facedom=$LPMACHID
  36. facefile=`{awk '/^'$facedom'\/'$LPUSERID' /{print $2}' /lib/face/48x48x4/.dict}
  37. facedepth=4
  38. if (~ $#facefile 0) {
  39. facefile=`{awk '/^'$facedom'\/'$LPUSERID' /{print $2}' /lib/face/48x48x2/.dict}
  40. facedepth=2
  41. }
  42. if (~ $#facefile 0) {
  43. facefile=`{awk '/^'$facedom'\/'$LPUSERID' /{print $2}' /lib/face/48x48x1/.dict}
  44. facedepth=1
  45. }
  46. if (~ $#facefile 0) {facefile=u/unknown.1; facedepth=1}
  47. facefile=/lib/face/48x48x$facedepth/$facefile
  48. if (! ~ $#facefile 0 1)
  49. facefile=$facefile(1)
  50. if (~ $#facefile 0 || ! test -f $facefile ) {facefile=/lib/face/48x48x2/u/unknown.1; facedepth=2}
  51. if (test -r $facefile ) {
  52. switch($facedepth){
  53. case 1 2
  54. face=`{cat $facefile |
  55. sed -e 's/0x//g' -e 's/, *//g' |
  56. tr 0123456789abcdef fedcba9876543210 };
  57. case 4
  58. face=`{iconv -u -c k4 $facefile |
  59. dd -bs 60 -skip 1 >[2]/dev/null |
  60. xd -b | sed 's/^[^ ]+ //;s/ //g' }
  61. }
  62. }
  63. }
  64. # We have to make sure the face information is set before rc sees the HERE file
  65. # so the cat has to be in a separate if statement. This is an rc bug.
  66. if (~ $NOHEAD '') cat <<EOF
  67. %!PS-Adobe-2.0 div 112 page header - research!pg
  68. /banner {
  69. /saveobj save def
  70. erasepage initgraphics
  71. /#copies 1 def
  72. /inch {72 mul} bind def
  73. /pageborder {
  74. 25 747 moveto
  75. 590 747 lineto
  76. 590 25 lineto
  77. 25 25 lineto
  78. closepath
  79. 2 setlinewidth
  80. 0 setgray
  81. stroke
  82. } def
  83. /topborder {
  84. 25 773 moveto
  85. 590 773 lineto
  86. 590 747 lineto
  87. 25 747 lineto
  88. closepath
  89. 2 setlinewidth
  90. 0 setgray
  91. stroke
  92. } def
  93. /toptext {
  94. 120 756 moveto
  95. /Courier-Bold findfont 14 scalefont setfont
  96. ($LPUSERID $DATE) show
  97. } def
  98. /prface {
  99. gsave
  100. translate rotate scale
  101. setgray
  102. 48 48 $facedepth [48 0 0 -48 0 48] {<$face>} image
  103. grestore
  104. } def
  105. EOF
  106. if (~ $NOHEAD '') switch ($LPCLASS) {
  107. case *hp4simx*;
  108. echo '
  109. %% set the default papertray to be the lower tray for HP4siMX printers
  110. statusdict begin defaultpapertray end 1 ne {
  111. statusdict begin
  112. 1 setdefaultpapertray
  113. end
  114. } if'
  115. }
  116. if (~ $NOHEAD '') cat <<EOF
  117. statusdict /setduplexmode known {statusdict begin false setduplexmode end} if
  118. statusdict begin /manualfeed false def end
  119. pageborder
  120. topborder
  121. toptext
  122. 0 14 14 0 94 752 prface
  123. .3 180 180 -90 3.0 inch 10.2 inch prface
  124. showpage
  125. saveobj
  126. restore
  127. } bind def
  128. banner
  129. EOF
  130. if (~ $REVFLAG '') cat
  131. exit ''