summaryrefslogtreecommitdiff
path: root/Master/bin/alpha-linux/dvipdft
diff options
context:
space:
mode:
Diffstat (limited to 'Master/bin/alpha-linux/dvipdft')
-rwxr-xr-xMaster/bin/alpha-linux/dvipdft85
1 files changed, 30 insertions, 55 deletions
diff --git a/Master/bin/alpha-linux/dvipdft b/Master/bin/alpha-linux/dvipdft
index db53bd2f5a0..3bcd0027db1 100755
--- a/Master/bin/alpha-linux/dvipdft
+++ b/Master/bin/alpha-linux/dvipdft
@@ -1,15 +1,24 @@
#!/bin/sh
-
-#
-# dvipdft, completely rewtitten by Thomas Esser for teTeX after an
+# dvipdft, completely rewritten by Thomas Esser for teTeX after an
# original script by Mark A. Wicks
#
# Thomas Esser. Public Domain.
-#
+#
+# Modified by Matthias Franz for dvipdfmx (when running as dvipdfm) and
+# TeX Live.
# This script makes a first (fast) run with dvipdfm, then calls gs on
# the resulting pdf file to get the thumbnails and finally calls dvipdfm.
+progname=dvipdft
+version=20090604.0046
+
+# set trap for error
+trap '
+ echo "$progname: fatal error." >&2
+ exit 1
+' 1
+
test -f /bin/sh5 && test -z "$RUNNING_SH5" \
&& { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \
&& { RUNNING_SH5=true; export RUNNING_SH5; exec /bin/sh5 $0 ${1+"$@"}; }
@@ -23,16 +32,10 @@ unset RUNNING_BSH
# hack around a bug in zsh:
test -n "${ZSH_VERSION+set}" && alias -g '${1+"$@"}'='"$@"'
-progname=dvipdft
-version=1111942378 # seconds since `00:00:00 1970-01-01 UTC'
- # date '+%s' (with GNU date)
-
help="Usage: $progname [options] dvifile
$progname --help
$progname --version"
-tmpdir=${TMPDIR-${TEMP-${TMP-/tmp}}}/$progname.$$
-
quoteit()
{
echo "x$1" | sed "s@.@@; s@'@'\\\\''@; s@^@'@; s@\$@'@"
@@ -56,7 +59,7 @@ case $1 in
exit 0
;;
--version)
- echo "$progname version $version by Thomas Esser"
+ echo "$progname version $version by Thomas Esser and others"
exit 0
;;
"")
@@ -66,7 +69,7 @@ case $1 in
esac
# args 1 to (n-1) are gone, last one must be the dvifile
-dvifile=$1
+dvifile="$1"
# outfile comes from -o argument, else it is derived from the input file
test -n "$outfile" \
@@ -75,56 +78,28 @@ test -n "$outfile" \
# outBase is part of the thumbname files just as dvipdfm expects them:
outBase=`echo "$outfile" | sed 's@\.pdf$@@'`
-# restore args 1 to (n-1):
-eval set x "$s"; shift
-
-# Run dvipdfm with the fastest options for the first pass
-echo "$progname: running dvipdfm $@ -e -z0 $dvifile" >&2
-dvipdfm ${1+"$@"} -e -z0 "$dvifile" || {
- echo "$progname: dvipdfm failed." >&2
+ls "$outBase".[1-9]* >/dev/null 2>&1 && {
+ echo "$progname: Please move the following files out of the way:" >&2
+ ls "$outBase".[1-9]* >&2
exit 1
}
-# before we create the tmpdir, set trap for cleanup
-trap '
- rm -rf $tmpdir
- exit 1
-' 1 2 3 7 13 15
+# restore args 1 to (n-1):
+eval set x "$s"; shift
-mkdir "$tmpdir" || {
- echo "$progname: failed to create temp directory." >&2
- exit 1
-}
+# set trap for cleanup
+trap '
+ rm -f "$outBase".[1-9]*
+' 0
-# if outBase contains a /, we might need to create a directory
-case $outBase in
- */*)
- fq=`echo "$tmpdir/$outBase" | sed 's@//@/@g; s@/[^/]*$@@'`
- test -d "$fq" || mkdir -p "$fq" || {
- echo "$progname: failed to create temp thumbnail directory." >&2
- rm -rf $tmpdir
- exit 1
- }
- ;;
-esac
+# Run dvipdfm with the fastest options for the first pass
+echo "$progname: running dvipdfm $@ -z0 $dvifile" >&2
+dvipdfm ${1+"$@"} -z0 "$dvifile"
# run gs
echo "$progname: running gs" >&2
-gs -r10 -dNOPAUSE -dBATCH -sDEVICE=png256 \
- -sOutputFile="$tmpdir/$outBase.%d" "$outfile" || {
- echo "$progname: gs failed." >&2
- rm -rf $tmpdir
- exit 1
-}
+gs -r10 -dNOPAUSE -dBATCH -sDEVICE=png256 -sOutputFile="$outBase.%d" "$outfile"
# run dvipdfm with the users specified options for the last pass
-echo "$progname: running dvipdfm -dt $@ $dvifile" >&2
-TMP=$tmpdir dvipdfm -dt ${1+"$@"} "$dvifile" || {
- echo "$progname: dvipdfm failed." >&2
- rm -rf $tmpdir
- exit 1
-}
-
-# nothing failed, so cleanup and report success to caller
-rm -rf $tmpdir
-exit 0
+echo "$progname: running dvipdfm -t $@ $dvifile" >&2
+dvipdfm ${1+"$@"} -t "$dvifile"