]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* config/general.m4sh (sed_double_backslash): Improve this sed
authorNoah Misch <noah@cs.caltech.edu>
Thu, 21 Oct 2004 16:51:07 +0000 (16:51 +0000)
committerGary V. Vaughan <gary@gnu.org>
Thu, 21 Oct 2004 16:51:07 +0000 (16:51 +0000)
expression to correct left anchored $ input to
double_quote_subst, as well as backslash escaped $ preceded by
any odd-numbered amount of  characters.

ChangeLog
config/general.m4sh

index 64036ce94a96fc8f89d809325d32b4d60ef54416..fef23ce47aa0adf022c4591b07866a365c35fe16 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-10-21  Noah Misch  <noah@cs.caltech.edu>,
+           Gary V. Vaughan  <gary@gnu.org>
+
+       * config/general.m4sh (sed_double_backslash): Improve this sed
+       expression to correct left anchored \$ input to
+       double_quote_subst, as well as backslash escaped $ preceded by
+       any odd-numbered amount of \ characters.
+
 2004-10-20  Gary V. Vaughan  <gary@gnu.org>
 
        * config/general.m4sh (sed_double_backslash): New sed expression
index efecf7cd6016e0a7050ba30db4badce5bc9e474d..af88d38455e6650afa74744f28d745243aa72dd7 100644 (file)
@@ -94,12 +94,14 @@ sed_quote_subst='s/\([[`"$\\]]\)/\\\1/g'
 # Same as above, but do not quote variable references.
 double_quote_subst='s/\([["`\\]]\)/\\\1/g'
 
-# Save mangling of backslash escaped dollars by the above.  Running this
-# substitution after double_quote_subst notices and corrects expansion
-# of already escaped meta-chars.  \$x -> double_quote_subst -> \\$x,
-# which doesn't protect $x from expansion.  To correct this we do:
-# \\$x -> sed_double_backslash -> \\\$x, properly protecting $x.
-sed_double_backslash='s/\([[^\\]]\)\\\\$/\1\\\\\\$/g'
+# Re-`\' parameter expansions in output of double_quote_subst that were
+# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
+# in input to double_quote_subst, that '$' was protected from expansion.
+# Since each input `\' is now two `\'s, look for any number of runs of
+# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.  Note
+# that the embedded single quotes serve only to enhance readability.
+sed_double_backslash='s/^\(\(''\\\\''\\\\''\)*''\\\\''\$\)/\\\1/;
+                s/\([[^\\]]\(''\\\\''\\\\''\)*''\\\\''\$\)/\\\1/g'
 
 # test EBCDIC or ASCII
 case `$ECHO A|tr A '\301'` in