summaryrefslogtreecommitdiff
path: root/dviware/umddvi/dev/iptex.sh
blob: 919544ad2abeaca498d1b140ab43efaf612e5d07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /bin/sh
#
# print a dvi file on the imagen

flags=
cflag=-c
# put default offset here: -X3 -Y-4 moves output .3in left, .4in up
# from the usual 1" margin in both directions.
offset=

# eat arguments

while [ $# -gt 0 ]
do
	case "$1" in
	-c)
		cflag=;;
	-d|-m|-r|-X|-Y)
		flags="$flags $1 $2"; shift;;
	-)
		break;;
	-*)
		flags="$flags $1";;
	*)
		break;;
	esac
	shift
done

if [ $# != 1 ]; then
	echo "Usage: $0 [-c] [-l] [-s] [-m mag] [-d drift] [-r resol] filename" 2>&1
	exit 1
fi

dvifile=$1
if [ x$dvifile = x- ]; then
	dvifile=
else
	# people insist that iptex should look for file.dvi first:
	if [ -r $dvifile.dvi ]; then
		dvifile=$dvifile.dvi
	else
		if [ ! -r $dvifile ]; then
			echo "$0: cannot find $1 or $1.dvi" 1>&2
			exit 1
		fi
	fi
fi

tmpfile=${TMPDIR-/tmp}/iptex$$
if [ "$cflag" = -c ]; then
	trap 'rm -f $tmpfile' 0 1 2 3 15
	if imagen1 $offset $flags $dvifile > $tmpfile; then
		ipr $tmpfile
	else
		echo "$0: output not spooled (use -c to force)" 1>&2
		exit 1
	fi
else
	imagen1 $offset $flags $dvifile | ipr
fi