X-Git-Url: https://git.madduck.net/etc/mailfilter.git/blobdiff_plain/a61350bc7ddd403460f79498a48e07f101fc2067..b3338ec6a5a8bb8aa937e49846aa891b753c12fc:/procmail/sql-escape diff --git a/procmail/sql-escape b/procmail/sql-escape index 08d0903..c8bb8c9 100644 --- a/procmail/sql-escape +++ b/procmail/sql-escape @@ -1,17 +1,14 @@ -SQ="'\\''" -SQE="'\\\''" - :0 * DATA ?? . -{ +{ + # 1. replace ' with '' + # 2. add quotes to each line + # 3. swap comma outside DATA="`echo \"$DATA\" \ - | sed -re 's,'\'','$SQE$SQE',g;' \ - -e 's/^.*$/'\$SQE'&'\$SQE'/' \ - -e 's/,'$SQE'$/'\$SQE',/'`" + | sed -re \"s,','',g\" \ + -e \"s/^.*$/'&'/\" \ + -e \"s/,'$/',/\"`" } :0 E { LOG="sql-escape: WARNING: no \$DATA provided!$NL" } - -SQE -SQ