Cover V02, I02
Article
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Listing 1
Listing 10
Listing 2
Listing 3
Listing 4
Listing 5
Listing 6
Listing 7
Listing 8
Listing 9

mar93.tar


Listing 6: The proxmap.sh script

1: #
2: # proxmap.sh:
3: # Map $ptype and $DEPT into specific lp options
4: # ("Sourced" by llp, getptr and gethead)
5: #
6: # Uses tables: paper.map, proximity.map, master.map
7: # Uses $0 to show name of invoking script in error messages.
8: # Returns: lp option string in $lpopts.
9: #
10:
11: if tmp=`grep ":$ptype:" $PTRDIR/paper.map`
12: then
13:     ptype=`echo $tmp | cut -d, -f1`
14: else
15:     echo "$0: Error: bad $WHAT type \"$ptype\""
16:     exit 1
17: fi
18:
19: if echo $tmp | grep "^$ptype,.*$CODECHAR[A-Z]*$" >/dev/null
20: then
21:     :
22: else
23:     echo "$0: $WHAT type \"$ptype\" is not accepted by this command."
24:     exit 1
25: fi
26:
27: if tmp=`grep "^$ptype,.*[^a-zA-Z0-9]$DEPT," $PTRDIR/proximity.map`
28: then
29:     ptr=`echo $tmp | cut -f3 -d, | tr -d "\011 "`
30: else
31:     echo "$0 error: undefined mapping of Dept=$DEPT, ptype=$ptype" >&2
32:     exit 1
33: fi
34:
35: [ $DEBUG = Y ] && echo "Department description = $DEPTDESC"
36: [ $DEBUG = Y ] && echo "ptr = \"$ptr\""
37:
38: #
39: # Now, map $ptr and paper type into appropriate lp command text in $lpopts:
40: #
41:
42: if tmp=`grep "^$ptr,.*[^a-zA-Z0-9]$ptype," $PTRDIR/master.map`
43: then
44:     lpopts="-d`echo $tmp | cut -f2 -d, | tr -d '\011 '`"
45:     field=4
46:     [ "`echo $tmp | cut -d, -f5 | tr -d '\011 '`" = "$ptype" ] && field=6
47:     lpopts="$lpopts `echo $tmp | cut -d, -f$field | tr -d '\011 '`"
48: else
49:     echo "$0: Error: bad paper spec (ptr = $ptr, ptype = $ptype)" >&2
50:     exit 1
51: fi
52:
53: [ $DEBUG = Y ] && echo "lpopts = \"$lpopts\""
54:
55: