From e7b7ddfe7ff9ffc15ca0da5c78eada39e16a3d01 Mon Sep 17 00:00:00 2001 From: Jeffrey A Law Date: Thu, 8 Oct 1998 23:26:54 +0000 Subject: =?UTF-8?q?=EF=BF=BD=20=20=20=20=20=20=20=20=20*=20ylwrap:=20Chang?= =?UTF-8?q?e=20absolute=20path=20checks=20to=20check=20for=20DOS=20style?= =?UTF-8?q?=20path=20=20=20=20=20=20=20=20=20names.=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20*=20ylwrap:=20Don't=20use=20a=20full=20path=20name=20if?= =?UTF-8?q?=20the=20source=20file=20is=20in=20the=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20same=20directory.=20=20From=20hjl@lucon.org=20(H.J.=20Lu).?= =?UTF-8?q?=20Brought=20over=20from=20devo.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@22945 138bc75d-0d04-0410-961f-82ee72b054a4 --- ylwrap | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'ylwrap') diff --git a/ylwrap b/ylwrap index b5b62184383..2288ccde3ac 100755 --- a/ylwrap +++ b/ylwrap @@ -31,7 +31,7 @@ prog="$1" shift # Make any relative path in $prog absolute. case "$prog" in - /*) ;; + /* | [A-Za-z]:\\*) ;; */*) prog="`pwd`/$prog" ;; esac @@ -39,7 +39,7 @@ esac input="$1" shift case "$input" in - /*) + /* | [A-Za-z]:\\*) # Absolute path; do nothing. ;; *) @@ -50,6 +50,13 @@ case "$input" in ;; esac +# We don't want to use the absolute path if the input in the current +# directory like when making a tar ball. +input_base=`echo $input | sed -e 's|.*/||'` +if test -f $input_base && cmp $input_base $input >/dev/null 2>&1; then + input=$input_base +fi + pairlist= while test "$#" -ne 0; do if test "$1" = "--"; then @@ -67,6 +74,15 @@ trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15 mkdir $dirname || exit 1 cd $dirname +case "$input" in + /* | [A-Za-z]:\\*) + # Absolute path; do nothing. + ;; + *) + # Make a symbolic link, hard link or hardcopy. + ln -s ../"$input" . > /dev/null 2>&1 || ln ../"$input" . > /dev/null 2>&1 || cp ../"$input" . + ;; +esac $prog ${1+"$@"} "$input" status=$? @@ -79,7 +95,7 @@ if test $status -eq 0; then # If $2 is an absolute path name, then just use that, # otherwise prepend `../'. case "$2" in - /*) target="$2";; + /* | [A-Za-z]:\\*) target="$2";; *) target="../$2";; esac mv "$1" "$target" || status=$? -- cgit v1.2.3