diff options
Diffstat (limited to 'bin/templ/pbfields')
-rwxr-xr-x | bin/templ/pbfields | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/bin/templ/pbfields b/bin/templ/pbfields index f0a2ff7..4bbfdfc 100755 --- a/bin/templ/pbfields +++ b/bin/templ/pbfields @@ -19,13 +19,7 @@ BEGIN { NF < 2 { next } -$1 ~ /depends$|conflicts|provides/ { - for (i=2; i<=NF; i++) $i = sprintf("'%s'", $i) -} - -$1 == "source" { - for (i=2; i<=NF; i++) $i = sprintf("\"%s\"", $i) -} +$1 ~ /depends$|conflicts|provides|source/ { quotevals() } $1 == "pkgdesc" { gsub(/[$"`]/, "\\\\&", $2) @@ -77,3 +71,14 @@ function wraparray (indent) return txt } + +function quotevals () +{ + for (i=2; i<=NF; i++) $i = bashquote($i) +} + +function bashquote (val) +{ + if (val ~ /\$/) return sprintf("\"%s\"", val) + return sprintf("'%s'", val) +} |