1
0

hpost 3.3 KB

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