Debian Codegraph @

texk/dvipdfm-x/dvipdft

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 # dvipdft, completely rewritten by Thomas Esser for teTeX after an
3 # original script by Mark A. Wicks
4 #
5 # Thomas Esser. Public Domain.
6 #
7 # Modified by Matthias Franz for dvipdfmx (when running as dvipdfm) and
8 # TeX Live.
9
10 # This script makes a first (fast) run with dvipdfm, then calls gs on
11 # the resulting pdf file to get the thumbnails and finally calls dvipdfm.
12
13 progname=dvipdft
14 version=20090604.0046
15
16 # set trap for error
17 trap '
18 echo "$progname: fatal error." >&2
19 exit 1
20 ' 1
21
22 testscip-shell system . . test. -f /bin/sh5scip-shell filesystem . . `/bin/sh5`. && testscip-shell system . . test. -z "$RUNNING_SH5" \
23 && { UNAMES=`unamescip-shell system . . uname. -s`; testscip-shell system . . test. "x$UNAMES" = xULTRIX; } 2>/dev/nullscip-shell filesystem . . `/dev/null`. \
24 && { RUNNING_SH5=true; export RUNNING_SH5; exec /bin/sh5scip-shell filesystem . . `/bin/sh5`. $0 ${1+"$@"}; }
25 unset RUNNING_SH5
26
27 testscip-shell system . . test. -f /bin/bshscip-shell filesystem . . `/bin/bsh`. && testscip-shell system . . test. -z "$RUNNING_BSH" \
28 && { UNAMES=`unamescip-shell system . . uname. -s`; testscip-shell system . . test. "x$UNAMES" = xAIX; } 2>/dev/nullscip-shell filesystem . . `/dev/null`. \
29 && { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bshscip-shell filesystem . . `/bin/bsh`. $0 ${1+"$@"}; }
30 unset RUNNING_BSH
31
32 # hack around a bug in zsh:
33 testscip-shell system . . test. -n "${ZSH_VERSION+set}" && alias -g '${1+"$@"}'='"$@"'
34
35 help="Usage: $progname [options] dvifile
36 $progname --help
37 $progname --version"
38
39 quoteitscip-shell shell texlive-bin 2026.20260303.78225+ds-4 quoteit().()
40 {
41 echoscip-shell system . . echo. "x$1" | sedscip-shell system . . sed. "s@.@@; s@'@'\\\\''@; s@^@'@; s@\$@'@"
42 }
43
44 # process args 1 to (n-1) and scan for a -o argument keep a properly
45 # quoted backup of the options, so that they can be restored later
46 unset s outfile
47 while testscip-shell system . . test. $# -gt 1; do
48 case $1 in
49 -o) outfile=$2;;
50 esac
51 s="$s${s+ }"`quoteitscip-shell shell texlive-bin 2026.20260303.78225+ds-4 quoteit(). "$1"`
52 shift
53 done
54
55 # check for last argument
56 case $1 in
57 --help)
58 echoscip-shell system . . echo. "$help"
59 exit 0
60 ;;
61 --version)
62 echoscip-shell system . . echo. "$progname version $version by Thomas Esser and others"
63 exit 0
64 ;;
65 "")
66 echoscip-shell system . . echo. "$help"
67 exit 1
68 ;;
69 esac
70
71 # args 1 to (n-1) are gone, last one must be the dvifile
72 dvifile="$1"
73
74 # outfile comes from -o argument, else it is derived from the input file
75 testscip-shell system . . test. -n "$outfile" \
76 || outfile=`echoscip-shell system . . echo. "$dvifile" | sedscip-shell system . . sed. 's@.*/@@; s@\.dvi$@@; s@[email protected]@'`
77
78 # outBase is part of the thumbname files just as dvipdfm expects them:
79 outBase=`echoscip-shell system . . echo. "$outfile" | sedscip-shell system . . sed. 's@\.pdf$@@'`
80
81 lsscip-shell system . . ls. "$outBase".[1-9]* >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 && {
82 echoscip-shell system . . echo. "$progname: Please move the following files out of the way:" >&2
83 lsscip-shell system . . ls. "$outBase".[1-9]* >&2
84 exit 1
85 }
86
87 # restore args 1 to (n-1):
88 eval set x "$s"; shift
89
90 # set trap for cleanup
91 trap '
92 rm -f "$outBase".[1-9]*
93 ' 0
94
95 # Run dvipdfm with the fastest options for the first pass
96 echoscip-shell system . . echo. "$progname: running dvipdfm $@ -z0 $dvifile" >&2
97 dvipdfm ${1+"$@"} -z0 "$dvifile"
98
99 # run gs
100 echoscip-shell system . . echo. "$progname: running gs" >&2
101 gs -r10 -dNOPAUSE -dBATCH -sDEVICE=png256 -sOutputFile="$outBase.%d" "$outfile"
102
103 # run dvipdfm with the users specified options for the last pass
104 echoscip-shell system . . echo. "$progname: running dvipdfm -t $@ $dvifile" >&2
105 dvipdfm ${1+"$@"} -t "$dvifile"