Debian Codegraph @

texk/texlive/linked_scripts/texlive-extra/dvired.sh

raw symbols SCIP
1 #!/bin/sh
2 #==============================================================================
3 # Version: 0.3
4 # Module: dvired
5 # Purpose: Translate dvi-file into postscript with reduced output size.
6 # Two logical pages will be put on onto each physical sheet of
7 # paper.
8 # System: Linux. UNIX(tm) systems may work as well :-)
9 # Requires: pstops (http://www.dcs.ed.ac.uk/home/ajcd/psutils/), dvips
10 # Created: 19.11.1992
11 # Last Change: 13.08.1999
12 # Language: sh
13 # Author: Thomas Esser
14 # Address: [email protected]
15 # Copyright: (c) 1994, 1999 by Thomas Esser
16 # Copying: GNU GENERAL PUBLIC LICENSE
17 #==============================================================================
18
19 test -f /bin/sh5 && test -z "$RUNNING_SH5" \
20 && { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \
21 && { RUNNING_SH5=true; export RUNNING_SH5; exec /bin/sh5 $0 ${1+"$@"}; }
22 unset RUNNING_SH5
23
24 test -f /bin/bsh && test -z "$RUNNING_BSH" \
25 && { UNAMES=`uname -s`; test "x$UNAMES" = xAIX; } 2>/dev/null \
26 && { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bsh $0 ${1+"$@"}; }
27 unset RUNNING_BSH
28
29 help()
30 {
31 cat <<eof
32
33 Usage: dvired [options] file
34
35 This programm behaves like dvips, execpt fot the fact that two logical
36 pages will be put on onto each physical sheet of paper.
37
38 For options see dvips(1). This program only interprets the options
39 -o, -P and -f. All other options will directly be passed to dvips.
40
41 If your paper is not in A4 format, you need to adjust the dimensions
42 in this program.
43
44 Examples: (it is assumed that the PRINTER-variable is set)
45 dvired -Plw foo send output to printer lw
46 dvired -o foo.ps foo send output to file foo.ps
47 dvired -pp4-7 foo send 4 output-pages to printer
48 dvired foo -f | ghostview - preview output with ghostview
49 eof
50 }
51
52 case $# in
53 0) help ; exit 1 ; ;;
54 esac
55
56 # This will work for A4 paper.
57 paper=a4 ; pstopsopt='2:0(7.44mm,7.44mm)+1(7.44mm,-141.06mm)'
58
59 # The following are *UNTESTED*. Please let me know whether they work
60 # or not, if you can test them.
61 #paper=a3 ; pstopsopt='2:0(7.44mm,7.44mm)+1(7.44mm,-202.56mm)'
62 #paper=letter ; pstopsopt='2:0(7.44mm,7.44mm)+1(7.44mm,-132.26mm)'
63 #paper=legal ; pstopsopt='2:0(7.44mm,7.44mm)+1(7.44mm,-170.36mm)'
64 #paper=ledger ; pstopsopt='2:0(7.44mm,7.44mm)+1(7.44mm,-132.26mm)'
65 #paper=tabloid ; pstopsopt='2:0(7.44mm,7.44mm)+1(7.44mm,-208.46mm)'
66
67 of=""
68 lpr_opt=""
69
70 case "$PRINTER" in
71 "") dvips_pre="" ;;
72 *) dvips_pre="-P$PRINTER" ;;
73 esac
74
75 dvips_pre="$dvips_pre -t $paper -t landscape"
76
77 while [ ! -z "$1" ] ; do
78 case $1 in
79 -P) of="" ; dvips_pre="$dvips_pre -P$2" ; lpr_opt="-P$2"
80 shift ;;
81 -P*) of="" ; dvips_pre="$dvips_pre $1" ; lpr_opt="$1" ;;
82 -o) of="$2"
83 shift ;;
84 -o*) of="`echo $1| sed 's/..//'`" ;;
85 -f) of="-" ;;
86 *) opt="$opt $1"
87 esac
88 shift
89 done
90
91 case "$of" in
92 "") dvips -x707 $dvips_pre $opt -f | pstops -q $pstopsopt | lpr $lpr_opt
93 ;;
94 "-") dvips -x707 $dvips_pre $opt -f | pstops -q $pstopsopt
95 ;;
96 *) dvips -x707 $dvips_pre $opt -f | pstops -q $pstopsopt > "$of"
97 ;;
98 esac