summaryrefslogtreecommitdiff
path: root/distrib/miniroot
diff options
context:
space:
mode:
authorgrr <grr@cvs.openbsd.org>1997-05-05 11:56:34 +0000
committergrr <grr@cvs.openbsd.org>1997-05-05 11:56:34 +0000
commit1b127fef0b29215a9a877391e203cb4375376104 (patch)
tree406b5ffb6b35539f57dec081fa7c0c9219f8ab5a /distrib/miniroot
parentebdbb93ce762333ae75691602e96acbc20b381be (diff)
make list2sh.awk safe for meta-characters in SPECIAL
Diffstat (limited to 'distrib/miniroot')
-rw-r--r--distrib/miniroot/list2sh.awk17
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;
}
{