diff options
Diffstat (limited to 'distrib/miniroot/list2sh.awk')
-rw-r--r-- | distrib/miniroot/list2sh.awk | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/distrib/miniroot/list2sh.awk b/distrib/miniroot/list2sh.awk index f9564e27c23..9245163b10f 100644 --- a/distrib/miniroot/list2sh.awk +++ b/distrib/miniroot/list2sh.awk @@ -1,4 +1,4 @@ -# $OpenBSD: list2sh.awk,v 1.3 1997/04/30 18:52:47 niklas Exp $ +# $OpenBSD: list2sh.awk,v 1.4 1997/05/05 11:56:33 grr Exp $ # $NetBSD: list2sh.awk,v 1.2 1996/05/04 15:45:31 pk Exp $ BEGIN { @@ -51,11 +51,16 @@ $1 == "COPYDIR" { next; } $1 == "SPECIAL" { - printf("echo '%s'\n", $0); - printf("(cd ${TARGDIR};"); - for (i = 2; i <= NF; i++) - printf(" %s", $i); - printf(")\n"); +# escaping shell quotation is ugly whether you use " or ', use cat <<'!' ... + work=$0; + gsub("[\\\\]", "\\\\", work); + gsub("[\"]", "\\\"", work); + gsub("[$]", "\\$", work); + gsub("[`]", "\\&", work); + printf("echo \"%s\"\n", work); + work=$0; + sub("^[ ]*" $1 "[ ]*", "", work); + printf("(cd ${TARGDIR}; %s)\n", work); next; } { |