Debian Codegraph @

lib/dvipdf

raw symbols SCIP
1 #!/bin/sh
2 # Convert DVI to PDF.
3 #
4 # Please contact Andrew Ford <[email protected]> with any questions
5 # about this file.
6 #
7 # Based on ps2pdf
8
9 # This definition is changed on install to match the
10 # executable name set in the makefile
11 GS_EXECUTABLE=gs
12
13
14 OPTIONS=""
15 DVIPSOPTIONS=""
16 while true
17 do
18 case "$1" in
19 -R*) DVIPSOPTIONS="$DVIPSOPTIONS $1";;
20 -?*) OPTIONS="$OPTIONS $1" ;;
21 *) break ;;
22 esac
23 shift
24 done
25
26 if [ $# -lt 1 -o $# -gt 2 ]; then
27 echo "Usage: `basename \"$0\"` [options...] input.dvi [output.pdf]" 1>&2
28 exit 1
29 fi
30
31 infile=$1;
32
33 if [ $# -eq 1 ]
34 then
35 case "${infile}" in
36 *.dvi) base=`basename "${infile}" .dvi` ;;
37 *) base=`basename "${infile}"` ;;
38 esac
39 outfile="${base}".pdf
40 else
41 outfile=$2
42 fi
43
44 # We have to include the options twice because -I only takes effect if it
45 # appears before other options.
46 exec dvips -Ppdf $DVIPSOPTIONS -q -f "$infile" | $GS_EXECUTABLE $OPTIONS -q -P- -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sstdout=%stderr -sOutputFile="$outfile" $OPTIONS -