summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-05-20 09:18:24 -0700
committerKarl Berry <karl@freefriends.org>2012-05-20 09:18:24 -0700
commit5bde137d4911eb44fabcc394b4a7c29a4f3a5de6 (patch)
tree56b27ca993af9065fe14e31b737456e6101d42ea /build-aux
parent387c96fc38b1985d677a25881ab99a449a00af22 (diff)
downloadgnulib-5bde137d4911eb44fabcc394b4a7c29a4f3a5de6.tar.gz
autoupdate
Diffstat (limited to 'build-aux')
-rw-r--r--[-rwxr-xr-x]build-aux/ylwrap31
1 files changed, 19 insertions, 12 deletions
diff --git a/build-aux/ylwrap b/build-aux/ylwrap
index 36543daa74..6879d8debb 100755..100644
--- a/build-aux/ylwrap
+++ b/build-aux/ylwrap
@@ -62,10 +62,25 @@ EOF
;;
esac
+get_dirname ()
+{
+ case $1 in
+ */*|*\\*) printf '%s\n' "$1" | sed -e 's,\([\\/]\)[^\\/]*$,\1,';;
+ # Otherwise, we want the empty string (not ".").
+ esac
+}
+
+quote_for_sed ()
+{
+ # FIXME: really we should care about more than '.' and '\'.
+ sed -e 's,[\\.],\\&,g'
+}
# The input.
input="$1"
shift
+# We'll later need for a correct munging of "#line" directives.
+input_sub_rx=`get_dirname "$input" | quote_for_sed`
case "$input" in
[\\/]* | ?:[\\/]*)
# Absolute path; do nothing.
@@ -125,11 +140,7 @@ if test $ret -eq 0; then
y_tab_nodot="yes"
fi
- # The directory holding the input.
- input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
- # Quote $INPUT_DIR so we can use it in a regexp.
- # FIXME: really we should care about more than '.' and '\'.
- input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'`
+ input_rx=`get_dirname "$input" | quote_for_sed`
while test "$#" -ne 0; do
from="$1"
@@ -161,15 +172,11 @@ if test $ret -eq 0; then
realtarget="$target"
target="tmp-`echo $target | sed s/.*[\\/]//g`"
fi
- # Edit out '#line' or '#' directives.
- #
+ # Munge "#line" or "#" directives.
# We don't want the resulting debug information to point at
- # an absolute srcdir; it is better for it to just mention the
- # .y file with no path.
- #
+ # an absolute srcdir.
# We want to use the real output file name, not yy.lex.c for
# instance.
- #
# We want the include guards to be adjusted too.
FROM=`echo "$from" | sed \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
@@ -178,7 +185,7 @@ if test $ret -eq 0; then
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
- sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \
+ sed -e "/^#/!b" -e "s,$input_rx,$input_sub_rx," -e "s,$from,$2," \
-e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?
# Check whether header files must be updated.