]> git.lyx.org Git - wiki-uploads.git/blob - Windows/Cygwin/Enrico/epstopdf
Import uploads from wiki
[wiki-uploads.git] / Windows / Cygwin / Enrico / epstopdf
1 #!/bin/sh
2 # This is a wrapper script to let LyX/Cygwin use either a native Win32 or
3 # Cygwin version of epstopdf (coming with either teTeX or MikTeX).
4 #
5 # This script simply changes all input pathnames into Windows or Cygwin
6 # pathnames depending on which version of epstopdf is being used.
7 # If the pathnames contain spaces, either enclose them in double quotes
8 # or escape the spaces. For example:
9 # epstopdf --outfile="output file.pdf" "input file.eps"
10 # epstopdf --outfile=output\ file.pdf input\ file.eps
11 #
12 # 2007-02-15 Enrico Forestieri
13 # =======================================================================
14
15 # The program to call (This should be in the PATH)
16 prog=epstopdf.exe
17
18 # If no epstopdf.exe is in the PATH, hope we have the cygwin script
19 if [ "`which $prog 2>/dev/null`" = "" ]; then
20     prog=/usr/bin/epstopdf
21     flag=""
22 else
23     flag="-m"
24 fi
25
26 while [ $# -gt 0 ] ; do
27     case "$1" in
28         -*=*) opt=`echo "$1" | cut -d= -f1`
29               file=`echo "$1" | cut -d= -f2-`
30               file=`cygpath $flag -- "$file"`
31               prog="$prog $opt='\"$file\"'"
32               ;;
33         -*)   prog="$prog $1"
34               ;;
35         *)    prog="$prog '`cygpath $flag -- "$1"`'"
36               ;;
37     esac
38     shift
39 done
40
41 eval "exec $prog"