ylwrap fix from HJ Lu
authorTom Tromey <tromey@redhat.com>
Fri, 17 Jul 1998 18:18:00 +0000 (18:18 +0000)
committerTom Tromey <tromey@redhat.com>
Fri, 17 Jul 1998 18:18:00 +0000 (18:18 +0000)
ChangeLog
lib/ylwrap
ylwrap

index 6247466..c85a3f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jul 17 07:37:20 1998  H.J. Lu  (hjl@gnu.org)
+
+       * ylwrap: Don't use absolute path if the input is in the
+       current directory.
+
 Fri Jul 17 11:58:27 1998  Ian Lance Taylor  <ian@cygnus.com>
 
        * automake.in: Use $(AM_MAKEFLAGS) in every invocation of $(MAKE).
index b5b6218..93bfecd 100755 (executable)
@@ -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
+ /*)
+    # 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=$?
 
diff --git a/ylwrap b/ylwrap
index b5b6218..93bfecd 100755 (executable)
--- a/ylwrap
+++ b/ylwrap
@@ -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
+ /*)
+    # 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=$?