#!/bin/sh
# This is a wrapper script for LyX/Cygwin to let LyX use the native
# Windows' version of epstopdf which is part of MikTeX.
#
# This script simply changes all Cygwin pathnames into Windows pathnames.
# If the pathnames contain spaces, either enclose them in double quotes
# or escape the spaces. For example:
# epstopdf --outfile="output file.pdf" "input file.eps"
# epstopdf --outfile=output\ file.pdf input\ file.eps
#
# 2006-02-13 Enrico Forestieri
# =======================================================================

# The program to call (This should be in the PATH)
prog=epstopdf.exe

while [ $# -gt 0 ] ; do
    case "$1" in
	-*=*) opt=`echo "$1" | cut -d= -f1`
	      file=`echo "$1" | cut -d= -f2-`
	      file=`cygpath -m -- "$file"`
	      prog="$prog $opt='\"$file\"'"
	      ;;
	-*)   prog="$prog $1"
	      ;;
	*)    prog="$prog '`cygpath -m -- "$1"`'"
	      ;;
    esac
    shift
done

eval "exec $prog"
