summaryrefslogtreecommitdiff
path: root/ylwrap
diff options
context:
space:
mode:
authorMarc Lehmann <pcg@goof.com>1998-10-08 17:26:54 -0600
committerJeff Law <law@gcc.gnu.org>1998-10-08 17:26:54 -0600
commit9f2f70f40485e9a96342c15f1a958343b489919b (patch)
tree8644cbbbbf1a1412a83ba7c7ab9d65b6ba351c14 /ylwrap
parent1e025bde1dce0fc33fc8a6b299182e0b4670cf2e (diff)
ylwrap: Change absolute path checks to check for DOS style path names.
� * ylwrap: Change absolute path checks to check for DOS style path names. * ylwrap: Don't use a full path name if the source file is in the same directory. From hjl@lucon.org (H.J. Lu). Brought over from devo. From-SVN: r22945
Diffstat (limited to 'ylwrap')
-rwxr-xr-xylwrap22
1 files changed, 19 insertions, 3 deletions
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=$?