hardcopy 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/rc
  2. # Generate paper output from the data that a PostScript program normally
  3. # sends back to a host computer using file output operators.
  4. #
  5. POSTLIB=/sys/lib/postscript/prologues
  6. PROLOGUE=$POSTLIB/hardcopy.ps
  7. OPTIONS=
  8. MODE=portrait
  9. NONCONFORMING='%!PS'
  10. ENDPROLOG='%%EndProlog'
  11. BEGINSETUP='%%BeginSetup'
  12. ENDSETUP='%%EndSetup'
  13. TRAILER='%%Trailer'
  14. SETUP=HardcopySetup
  15. DONE='(%stdout)(w) file -1 write'
  16. while (! ~ $#* 0 && ~ $1 -*) {
  17. switch ($1) {
  18. case -c; shift; OPTIONS=$OPTIONS' /#copies '$1' store'
  19. case -c*; OPTIONS=$OPTIONS' /#copies `{echo $1 | sed s/-c//}' store'
  20. case -f; shift; OPTIONS=$OPTIONS' /font '/$1' def'
  21. case -f*; OPTIONS=$OPTIONS' /font '/`{echo $1 | sed s/-f//}' def'
  22. case -p; shift; MODE=$1
  23. case -p*; MODE=`{echo $1 | sed s/-p//}
  24. case -m; shift; OPTIONS=$OPTIONS' /magnification '$1' def'
  25. case -m*; OPTIONS=$OPTIONS' /magnification '`{echo $1 | sed s/-m//}' def'
  26. case -s; shift; OPTIONS=$OPTIONS' /pointsize '$1' def'
  27. case -s*; OPTIONS=$OPTIONS' /pointsize '`{echo $1 | sed s/-s//}' def'
  28. case -x; shift; OPTIONS=$OPTIONS' /xoffset '$1' def'
  29. case -x*; OPTIONS=$OPTIONS' /xoffset '`{echo $1 | sed s/-x//}' def'
  30. case -y; shift; OPTIONS=$OPTIONS' /yoffset '$1' def'
  31. case -y*; OPTIONS=$OPTIONS' /yoffset '`{echo $1 | sed s/-y//}' def'
  32. case -L; shift; PROLOGUE=$1
  33. case -L*; PROLOGUE=`{echo $1 | sed s/-L//}
  34. case --;
  35. case -*; echo '$0: illegal option $1' >&2; exit 1
  36. }
  37. shift
  38. }
  39. switch ($MODE) {
  40. case l*; OPTIONS=$OPTIONS' /landscape true def'
  41. case *; OPTIONS=$OPTIONS' /landscape false def'
  42. }
  43. echo $NONCONFORMING
  44. cat $PROLOGUE
  45. echo $ENDPROLOG
  46. echo $BEGINSETUP
  47. echo $OPTIONS
  48. echo $SETUP
  49. echo $ENDSETUP
  50. cat $*
  51. echo $TRAILER
  52. echo $DONE