X-Git-Url: https://git.madduck.net/etc/mailfilter.git/blobdiff_plain/a61350bc7ddd403460f79498a48e07f101fc2067..1291690f108172bad19b29a83fadccb1d53d16a1:/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