progname=$0
package=gnulib
-cvsdatestamp='$Date: 2005-09-19 15:31:32 $'
+cvsdatestamp='$Date: 2005-09-19 15:32:08 $'
last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
exit 1
}
+# func_readlink SYMLINK
+# outputs the target of the given symlink.
+if (type -p readlink) > /dev/null 2>&1; then
+ func_readlink ()
+ {
+ # Use the readlink program from GNU coreutils.
+ readlink "$1"
+ }
+else
+ func_readlink ()
+ {
+ # Use two sed invocations. A single sed -n -e 's,^.* -> \(.*\)$,\1,p'
+ # would do the wrong link if the link target contains " -> ".
+ LC_ALL=C ls -l "$1" | sed -e 's, -> ,#%%#,' | sed -n -e 's,^.*#%%#\(.*\)$,\1,p'
+ }
+fi
+
# func_ln_if_changed SRC DEST
# Like ln -s, but avoids munging timestamps if the link is correct.
func_ln_if_changed ()
if test $# -ne 2; then
echo "usage: func_ln_if_changed SRC DEST" >&2
fi
- if test -L "$2" && test "$1" = "`readlink "$2"`"; then
+ if test -L "$2" && test "$1" = "`func_readlink "$2"`"; then
:
else
rm -f "$2"
esac
while test -h "$self_abspathname"; do
# Resolve symbolic link.
- sedexpr1='s, -> ,#%%#,'
- sedexpr2='s,^.*#%%#\(.*\)$,\1,p'
- linkval=`LC_ALL=C ls -l "$self_abspathname" | sed -e "$sedexpr1" | sed -n -e "$sedexpr2"`
+ linkval=`func_readlink "$self_abspathname"`
test -n "$linkval" || break
case "$linkval" in
/* ) self_abspathname="$linkval" ;;