buildtables.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #
  2. # Builds one or more font width tables or the typesetter description
  3. # file on a PostScript printer. Assumes you have direct access to the
  4. # printer's serial port. No arguments means build a standard collection
  5. # of tables - usually the LaserWriter Plus set. See trofftable and the
  6. # shell library files /usr/lib/font/dev*/shell.lib for more details.
  7. #
  8. set -e
  9. POSTBIN=/usr/lbin/postscript
  10. POSTLIB=/usr/lib/postscript
  11. FONTDIR=/usr/lib/font
  12. POSTIO=$POSTBIN/postio
  13. TROFFTABLE=$POSTBIN/trofftable
  14. BAUDRATE=
  15. DEVICE=
  16. LIBRARY=
  17. while [ -n "$1" ]; do
  18. case $1 in
  19. -C) shift; OPTIONS="$OPTIONS -C$1";;
  20. -C*) OPTIONS="$OPTIONS $1";;
  21. -F) shift; FONTDIR=$1;;
  22. -F*) FONTDIR=`echo $1 | sed s/-F//`;;
  23. -H) shift; OPTIONS="$OPTIONS -H$1";;
  24. -H*) OPTIONS="$OPTIONS $1";;
  25. -S) shift; LIBRARY=$1;;
  26. -S*) LIBRARY=`echo $1 | sed s/-S//`;;
  27. -T) shift; DEVICE=$1;;
  28. -T*) DEVICE=`echo $1 | sed s/-T//`;;
  29. -b) shift; BAUDRATE=$1;;
  30. -b*) BAUDRATE=`echo $1 | sed s/-b//`;;
  31. -c) shift; OPTIONS="$OPTIONS -c$1";;
  32. -c*) OPTIONS="$OPTIONS $1";;
  33. -l) shift; LINE=$1;;
  34. -l*) LINE=`echo $1 | sed s/-l//`;;
  35. -s) shift; OPTIONS="$OPTIONS -s$1";;
  36. -s*) OPTIONS="$OPTIONS $1";;
  37. -t) shift; OPTIONS="$OPTIONS -t$1";;
  38. -t*) OPTIONS="$OPTIONS $1";;
  39. -?) OPTIONS="$OPTIONS $1$2"; shift;;
  40. -?*) OPTIONS="$OPTIONS $1";;
  41. *) break;;
  42. esac
  43. shift
  44. done
  45. if [ ! "$DEVICE" -a ! "$LIBRARY" ]; then
  46. echo "$0: no device or shell library" >&2
  47. exit 1
  48. fi
  49. LIBRARY=${LIBRARY:-${FONTDIR}/dev${DEVICE}/shell.lib}
  50. #
  51. # No arguments means build everything return by the AllTables function.
  52. #
  53. if [ $# -eq 0 ]; then
  54. . $LIBRARY
  55. set -- `AllTables`
  56. fi
  57. for i do
  58. SHORT=`echo $i | awk '{print $1}'`
  59. LONG=`echo $i | awk '{print $2}'`
  60. if [ "$LINE" ]
  61. then echo "==== Building table $SHORT ===="
  62. else echo "==== Creating table program $SHORT.ps ===="
  63. fi
  64. $TROFFTABLE -S$LIBRARY $OPTIONS $SHORT $LONG >$SHORT.ps
  65. if [ "$LINE" ]; then
  66. $POSTIO -t -l$LINE ${BAUDRATE:+-b${BAUDRATE}} $SHORT.ps >$SHORT
  67. rm -f $SHORT.ps
  68. fi
  69. done