Skip to content

Commit

Permalink
Improve escaping in find_platform.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucc committed Jun 20, 2016
1 parent 330c27a commit 0219fce
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions scripts/find_platform
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

. inc/platform.sh

# The backslash has to be put here 8 times: foctor two to get past the initial
# The backslash has to be put here 4 times: foctor two to get past the initial
# shell quoting, another factor two because it is used in the replacement
# string for sed, another factor two because the output of belows echo will be
# used in the replacement text in the sed call in the makefile. This yields
# one backslash that can escape the single quote in the configured vimpager
# script.
AWK=$(echo "$AWK" | sed "s/'/'\\\\\\\\''/g")
SED=$(echo "$SED" | sed "s/'/'\\\\\\\\''/g")
# string for sed. This yields one backslash that can escape the single quote
# in the configured vimpager script.
AWK=$(echo "$AWK" | sed "s/'/'\\\\''/g")
SED=$(echo "$SED" | sed "s/'/'\\\\''/g")

# The final sed is used to escape special characters for the sed command in
# the makefile, where the output will be used.
echo \
${bsd:+bsd=$bsd} \
${cygwin:+cygwin=$cygwin} \
Expand All @@ -25,5 +25,6 @@ echo \
"AWK='$AWK'" \
"SED='$SED'" \
${HEAD_SYNTAX:+HEAD_SYNTAX=$HEAD_SYNTAX} \
| sed -e 's/\\/\\\\/g' -e 's/|/\|/g'

# vim: sw=4 et tw=0:

0 comments on commit 0219fce

Please sign in to comment.