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 5: The initmap.sh script

1: #
2: # initmap.sh: implementation-dependent departmental mappings
3: #   "Sourced" by llp, getptr and gethead.
4: #
5:
6: DEBUG=N             # set to Y to display diagnostic info
7:
8: ###########################################################################
9: # The following section may contain code to modify the $DEPT variable
10: # in its symbolic form, before it is converted to a numeric dept. ID:
11: #
12:
13: # if user's .profile does not initialize DEPT, use mktg as the default:
14: [ $DEPT = "" ] && DEPT=mktg
15:
16: # If one department shares another's printers, fold the two onto one:
17: [ $DEPT = per ] && DEPT=mktg        # Periodicals uses Mktg's printers
18:
19: # Allow definition of DEPTP to override a user's "natural" department:
20: [ "$DEPTP" != "" ] && DEPT=$DEPTP
21: #
22: ###########################################################################
23:
24: #
25: # Process command line printer/paper selectors:
26: #
27:
28: if [ $# -eq 0 ]; then
29:     ptype=P
30: else
31:     ptype="`echo "$1" | tr -d "-" | tr '[a-z]' '[A-Z]'`"
32:     shift
33:     [ $DEBUG = Y ] && echo "ptype set to: $ptype"
34: fi
35:
36: if grep ":$ptype:" $PTRDIR/paper.map >/dev/null
37: then
38:     :
39: else
40:     echo "$0: Unknown $WHAT type: $ptype"
41:     exit 1
42: fi
43:
44: #
45: # Now map department name into dept. number ($DEPT), description ($DEPTDESC)
46: #
47:
48: if tmp=`grep "[^\011 ]$DEPT," $PTRDIR/dept.map`
49: then
50:     DEPT=`echo $tmp | cut -f1 -d, `
51:     DEPTDESC="`echo $tmp | cut -f2 -d\\\"`"
52: else
53:     echo "Error: unknown Department name $DEPT specified." >&2
54: fi