Index: texi2dvi =================================================================== --- texi2dvi (revision 6639) +++ texi2dvi (working copy) @@ -86,15 +86,35 @@ : ${EGREP=egrep} # Systems which define $COMSPEC or $ComSpec use semicolons to separate -# directories in TEXINPUTS -- except for Cygwin, where COMSPEC +# directories in TEXINPUTS -- except for Cygwin and Msys, where COMSPEC # might be inherited, but : is used. -if test -n "$COMSPEC$ComSpec" \ - && uname | $EGREP -iv 'cygwin' >/dev/null; then - path_sep=";" -else - path_sep=":" -fi +# In the case of Msys, uname returns a value derived from MSYSTEM, as +# MSYSTEM is user configurable, it is not so safe to use it to detect +# Msys. It is safer to use OSTYPE, this is why we set MSYSTEM to +# $OSTYPE before calling uname +case `MSYSTEM=$OSTYPE uname`"(:)$COMSPEC$ComSpec" in + *msys*"(:)"?*) + # MSYS case + path_sep=":" + tex_path_sep=";" + msys_w_pwd_opt=-W + ;; + *cygwin*"(:)"?* | *"(:)") + # Cygwin | Linux case + path_sep=":" + tex_path_sep=":" + msys_w_pwd_opt= + ;; + *"(:)"?*) + # DJGPP case + path_sep=";" + tex_path_sep=";" + msys_w_pwd_opt= + ;; +esac + + # Pacify verbose cds. CDPATH=${ZSH_VERSION+.}$path_sep @@ -268,15 +288,32 @@ absolute () { case $1 in - [\\/]* | ?:[\\/]*) - # Absolute paths don't need to be expanded. + ?:[\\/]*) + # Absolute MSW style paths don't need to be expanded. echo "$1" ;; + [\\/]*) + # Absolute *nixy style paths need to be converted to MSW style in case of MSYS + # otherwise they don't need to be expanded + if test -z "$msys_w_pwd_opt"; then + echo "$1" + else + absolute_slashes=`echo "$1" | $SED -n 's,.*[^/]\(/*\)$,\1,p'` + if test -d "$1"; then + save_cur_dir=`pwd` + cd "$1" + echo `pwd $msys_w_pwd_opt` + cd "$save_cur_dir" + else + error 1 "not a directory: $1" + fi + fi + ;; *) absolute_slashes=`echo "$1" | $SED -n 's,.*[^/]\(/*\)$,\1,p'` absolute_rel=$orig_pwd/`func_dirname "$1"` if test -d "$absolute_rel"; then (cd "$absolute_rel" 2>/dev/null \ - && absolute_name=`pwd`/`basename "$1"`"$absolute_slashes" + && absolute_name=`pwd $msys_w_pwd_opt`/`basename "$1"`"$absolute_slashes" echo "$absolute_name") else error 1 "not a directory: $absolute_rel" @@ -381,7 +418,7 @@ # list_concat_dirs LIST-NAME DIR-LIST - Append to LIST-NAME all the -# components (including empty ones) from the $path_sep-separated list +# components (including empty ones) from the $tex_path_sep-separated list # DIR-LIST. Make the paths absolute. list_concat_dirs () { @@ -389,9 +426,9 @@ # Empty path components are meaningful to tex. We rewrite them as # `EMPTY' so they don't get lost when we split on $path_sep. # Hopefully no one will have an actual directory named EMPTY. - lcd_replace_EMPTY="-e 's/^$path_sep/EMPTY$path_sep/g' \ - -e 's/$path_sep\$/${path_sep}EMPTY/g' \ - -e 's/$path_sep$path_sep/${path_sep}EMPTY:/g'" + lcd_replace_EMPTY="-e 's/^$tex_path_sep/EMPTY$tex_path_sep/g' \ + -e 's/$tex_path_sep\$/${tex_path_sep}EMPTY/g' \ + -e 's/$tex_path_sep$tex_path_sep/${tex_path_sep}EMPTY${tex_path_sep}/g'" save_IFS=$IFS IFS=$path_sep set x `echo "$2" | eval $SED $lcd_replace_EMPTY`; shift @@ -434,7 +471,7 @@ eval set X \$$1 shift save_IFS="$IFS" - IFS=$path_sep + IFS=$tex_path_sep echo "$*" IFS=$save_IFS } @@ -501,12 +538,12 @@ # Empty path components are meaningful to tex. We rewrite them as # `EMPTY' so they don't get lost when we split on $path_sep. # Hopefully no one will have an actual directory named EMPTY. - af_replace_empty="-e 's/^$path_sep/EMPTY$path_sep/g' \ - -e 's/$path_sep\$/${path_sep}EMPTY/g' \ - -e 's/$path_sep$path_sep/${path_sep}EMPTY:/g'" + af_replace_empty="-e 's/^$tex_path_sep/EMPTY$tex_path_sep/g' \ + -e 's/$tex_path_sep\$/${tex_path_sep}EMPTY/g' \ + -e 's/$tex_path_sep$tex_path_sep/${tex_path_sep}EMPTY${tex_path_sep}/g'" af_result=`echo "$1" | eval $SED $af_replace_empty` save_IFS=$IFS - IFS=$path_sep + IFS=$tex_path_sep set x $af_result; shift af_result= af_path_sep= @@ -528,7 +565,7 @@ fi ;; esac - af_path_sep=$path_sep + af_path_sep=$tex_path_sep done echo "$af_result" } @@ -1365,10 +1402,10 @@ # directories included. # . If we have any includes, put those at the end. - common="$orig_pwd$path_sep$in_dir$path_sep" + common="$work_bak$tex_path_sep$orig_pwd$tex_path_sep$in_dir$tex_path_sep" # - txincludes=`list_infix includes $path_sep` - test -n "$txincludes" && common="$common$txincludes$path_sep" + txincludes=`list_infix includes $tex_path_sep` + test -n "$txincludes" && common="$common$txincludes$tex_path_sep" # for var in $tex_envvars; do eval val="\$common\$${var}_orig"