Do not spawn processes when converting cygwin paths. Signficant performance enhancement.

Thanks to paxunix@acm.org for the patch.
Bug #206643 r=bryner sr=cls a=mkaply
This commit is contained in:
cls%seawood.org 2003-08-14 21:32:11 +00:00
Родитель 26d4f767e3
Коммит dc2a33bd91
1 изменённых файлов: 41 добавлений и 10 удалений

Просмотреть файл

@ -7,17 +7,48 @@ shift
if test -z "$prog"; then
exit 0
fi
mountpoint=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
mountpoint=$CYGDRIVE_MOUNT
if test -z "$mountpoint"; then
mountpoint=`mount -p`
if test -z "$mountpoint"; then
print "Cannot determine cygwin mount points. Exiting"
exit 1
fi
mountpoint=`echo $mountpoint | sed 's|/$||'`
if test "$prog" = "-up"; then
prog=$1
shift
args=`echo $* | sed -e "s|-I\([a-zA-Z]\):/|-I${mountpoint}/\1/|g;"`
else
args=`echo $* | sed -e "s|${mountpoint}/\([a-zA-Z]\)/|\1:/|g;"`
fi
mountpoint=${mountpoint#*/}
mountpoint=/${mountpoint%%[!A-Za-z0-9_]*}
mountpoint=${mountpoint%/}
args=""
up=""
if test "${prog}" = "-up"; then
up=1
prog=${1}
shift
fi
for i in "${@}"
do
if test -n "${up}"; then
pathname=${i#-I[a-zA-Z]:/}
if ! test "${pathname}" = "${i}"; then
no_i=${i#-I}
driveletter=${no_i%%:*}
i=-I${mountpoint}/${driveletter}/${pathname}
fi
else
eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}'
if ! test "${leader}" = "${i}"; then
eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}'
eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}'
driveletter=${no_mountpoint%%/*}
i=${leader}${driveletter}:/${pathname}
fi
fi
args="${args} ${i}"
done
exec $prog $args