Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 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
 
9
set -e
10
 
11
POSTBIN=/usr/lbin/postscript
12
POSTLIB=/usr/lib/postscript
13
FONTDIR=/usr/lib/font
14
 
15
POSTIO=$POSTBIN/postio
16
TROFFTABLE=$POSTBIN/trofftable
17
 
18
BAUDRATE=
19
DEVICE=
20
LIBRARY=
21
 
22
while [ -n "$1" ]; do
23
    case $1 in
24
	-C)  shift; OPTIONS="$OPTIONS -C$1";;
25
	-C*) OPTIONS="$OPTIONS $1";;
26
 
27
	-F)  shift; FONTDIR=$1;;
28
	-F*) FONTDIR=`echo $1 | sed s/-F//`;;
29
 
30
	-H)  shift; OPTIONS="$OPTIONS -H$1";;
31
	-H*) OPTIONS="$OPTIONS $1";;
32
 
33
	-S)  shift; LIBRARY=$1;;
34
	-S*) LIBRARY=`echo $1 | sed s/-S//`;;
35
 
36
	-T)  shift; DEVICE=$1;;
37
	-T*) DEVICE=`echo $1 | sed s/-T//`;;
38
 
39
	-b)  shift; BAUDRATE=$1;;
40
	-b*) BAUDRATE=`echo $1 | sed s/-b//`;;
41
 
42
	-c)  shift; OPTIONS="$OPTIONS -c$1";;
43
	-c*) OPTIONS="$OPTIONS $1";;
44
 
45
	-l)  shift; LINE=$1;;
46
	-l*) LINE=`echo $1 | sed s/-l//`;;
47
 
48
	-s)  shift; OPTIONS="$OPTIONS -s$1";;
49
	-s*) OPTIONS="$OPTIONS $1";;
50
 
51
	-t)  shift; OPTIONS="$OPTIONS -t$1";;
52
	-t*) OPTIONS="$OPTIONS $1";;
53
 
54
	-?)  OPTIONS="$OPTIONS $1$2"; shift;;
55
	-?*) OPTIONS="$OPTIONS $1";;
56
 
57
	*)   break;;
58
    esac
59
    shift
60
done
61
 
62
if [ ! "$DEVICE" -a ! "$LIBRARY" ]; then
63
    echo "$0: no device or shell library" >&2
64
    exit 1
65
fi
66
 
67
LIBRARY=${LIBRARY:-${FONTDIR}/dev${DEVICE}/shell.lib}
68
 
69
#
70
# No arguments means build everything return by the AllTables function.
71
#
72
 
73
if [ $# -eq 0 ]; then
74
    . $LIBRARY
75
    set -- `AllTables`
76
fi
77
 
78
for i do
79
    SHORT=`echo $i | awk '{print $1}'`
80
    LONG=`echo $i | awk '{print $2}'`
81
 
82
    if [ "$LINE" ]
83
	then echo "==== Building table $SHORT ===="
84
	else echo "==== Creating table program $SHORT.ps ===="
85
    fi
86
 
87
    $TROFFTABLE -S$LIBRARY $OPTIONS $SHORT $LONG >$SHORT.ps
88
 
89
    if [ "$LINE" ]; then
90
	$POSTIO -t -l$LINE ${BAUDRATE:+-b${BAUDRATE}} $SHORT.ps >$SHORT
91
	rm -f $SHORT.ps
92
    fi
93
done
94