source: trunk/athena/bin/xdpr/xdpr.sh @ 8019

Revision 8019, 3.2 KB checked in by cfields, 29 years ago (diff)
Put the -x's back (had been substituted by -r's) because Irix lpr is not readable. Then, make it moot by testing for /usr/athena/bin/lpr first; but also test for Ultrix, since lpr is in ucb there and we need to avoid the -x that Ultrix 4.2a test doesn't have.
  • Property svn:executable set to *
Line 
1#! /bin/sh
2# Copyright 1985,1988 Massacusetts Institute of Technology.
3# $XConsortium: xdpr.script,v 1.9 91/06/30 19:20:16 rws Exp $
4# origin: William Kucharski, Solbourne Computer, Inc. 3/24/90
5#         translated from csh script xdpr.script "paul 4/12/88"
6
7# initialize variables
8
9display="$DISPLAY"
10header=
11bsdlprv=
12lprv=
13out=
14svlprv=
15trailer=
16xprv=
17xwdv=
18
19usage="Usage: xdpr [filename] [-out filename ] \
20[-display host:display] [[-Pprinter] | [-dprinter]] [-device devtype] \
21[{-root | -id <id> | -name <name>}] [-nobdrs] [-xy] \
22[-scale scale] [-height inches] [-width inches] [-left inches] \
23[-top inches] [-split n] [-header string] [-trailer string] \
24[-landscape] [-portrait] [-rv] [-compact] [-noff] [-frame] \
25[-plane number] [-gray number] [-psfig] [-density dpi] \
26[-cutoff level] [-noposition] [-gamma correction] [-render algorithm] \
27[-slide] [-add value] [-help]"
28
29# Guess if we are BSD or System V
30# or Athena.
31
32if [ -r /ultrixboot -o -r /usr/athena/bin/lpr ]
33then
34        LP=lpr
35        BSD=1
36
37elif [ -x /usr/ucb/lpr -o -x /usr/bin/lpr -o -x /bin/lpr -o -x /usr/bsd/lpr ]
38then
39        LP=lpr
40        BSD=1
41elif [ -x /usr/bin/lp -o -x /bin/lp ]
42then
43        LP=lp
44        BSD=0
45else
46        LP=lpr
47        BSD=1
48fi
49
50# parse arguments...
51
52while [ $1 ]; do
53        case "$1" in
54
55# ...arguments interpreted by xdpr itself...
56
57        -help)
58                echo $usage;
59                exit 0;;
60
61# ...arguments to xwd...
62
63        -nobdrs|-root|-xy|-frame)
64                xwdv="$xwdv $1";;
65        -display)
66                display=$2
67                xwdv="$xwdv $1 $2";
68                shift;;
69        -id|-name)
70                xwdv="$xwdv $1 $2";
71                shift;;
72        -out|-add)
73                out=true
74                xwdv="$xwdv $1 $2";
75                shift;;
76
77# ...arguments to xpr...
78
79        -scale|-height|-width|-left|-top|-split|-device)
80                xprv="$xprv $1 $2";
81                shift;;
82        -plane|-gray|-density|-cutoff|-gamma|-render)
83                xprv="$xprv $1 $2";
84                shift;;
85        -header)
86                shift;
87                header="$1";;
88        -trailer)
89                shift;
90                trailer="$1";;
91        -landscape|-portrait|-rv|-compact|-noff|-psfig|-noposition|-slide)
92                xprv="$xprv $1";;
93
94# ...arguments to lp[r]...
95
96        -P*|-#?*|-C?*|-J?*|-h|-m)
97                bsdlprv="$bsdlprv $1";;
98
99        -d*|-H*|-q*|-n*|-o*|-w)
100                svlprv="$svlprv $1";;
101
102# ...disallow other arguments; print usage message
103
104        -*)
105                echo "xdpr: Unknown option $1";
106                echo $usage;
107                exit 1;;
108
109# ...input filename...
110
111        *)
112                if [ ! "$infile" ]; then
113                        infile=true
114                        xprv="$xprv $1"
115                else
116                        echo "xdpr: Invalid argument "$1""
117                        echo $usage                     
118                        exit 1
119                fi
120        esac
121        shift
122done
123
124# quit if there is no DISPLAY specified
125
126if [ ! "$display" ]; then
127        echo "xdpr: DISPLAY variable must be set or a display specified."
128        exit
129fi
130
131# Command lines:
132
133# Set up lp[r] options...
134
135if [ $BSD -eq 0 ]
136then
137        lprv=$svlprv
138else
139        lprv=$bsdlprv
140fi
141
142# disallow concurrent input and  -out arguments
143if [ "$out" -a "$infile" ]; then
144        echo "xdpr: -out <filename> cannot be used if an input file is also specified."
145        exit 0
146fi
147
148# dump only
149if [ "$out" ]; then
150        if [ "$xprv" -o "$lprv" ]; then
151                echo "xdpr: The following arguments will be ignored:"
152                echo $xprv $lprv
153        fi
154        xwd $xwdv
155        exit 0
156fi
157
158# print only
159if [ "$infile" ]; then
160        if [ "$xwdv" ]; then
161                echo "xdpr: The following arguments will be ignored:"
162                echo $xwdv
163        fi
164        xpr -header "$header" -trailer "$trailer" $xprv | $LP $lprv
165        exit 0
166fi
167
168# dump & print (default)
169xwd $xwdv | xpr -header "$header" -trailer "$trailer" $xprv | $LP $lprv
170exit 0 
171
172# EOF
Note: See TracBrowser for help on using the repository browser.