quilt depends on procmail because 'quilt mail' requires formail. However, formail is only used to extract header values from messages. Since quilt already requires sed we can replace formail -x uses with sed instead. The sed script is slightly complicated because it needs to handle the case of "Long Header Fields" definied in RFC 2822, but essentially all it's doing is: look for the first line beginning with the name of header we are looking for, and print every line until one that does not start with blanks.
Signed-off-by: Kent R. Spillner <[email protected]> --- po/de.po | 4 ---- po/fr.po | 6 ------ po/ja.po | 4 ---- po/quilt.pot | 4 ---- po/ru.po | 4 ---- quilt/mail.in | 33 +++++++++++++++++++++------------ 6 files changed, 21 insertions(+), 34 deletions(-) diff --git a/po/de.po b/po/de.po index e8d32c8..923074d 100644 --- a/po/de.po +++ b/po/de.po @@ -834,10 +834,6 @@ msgstr "" msgid "Introduction message already specified" msgstr "Einleitung gespeichert als %s\\n" -#: quilt/mail.in:262 -msgid "You have to install 'formail' to use 'quilt mail'" -msgstr "" - #: quilt/mail.in:305 msgid "Could not determine the envelope sender address. Please use --sender." msgstr "" diff --git a/po/fr.po b/po/fr.po index ca85579..72dc867 100644 --- a/po/fr.po +++ b/po/fr.po @@ -846,12 +846,6 @@ msgstr "" msgid "Introduction message already specified" msgstr "Message d'introduction déjà spécifié" -#: quilt/mail.in:262 -msgid "You have to install 'formail' to use 'quilt mail'" -msgstr "" -"Vous devez installer le programme «formail» afin d'utiliser la commande " -"«quilt mail»" - #: quilt/mail.in:305 msgid "Could not determine the envelope sender address. Please use --sender." msgstr "Impossible de déterminer l'adresse d'expéditeur. Utilisez --sender." diff --git a/po/ja.po b/po/ja.po index 8e3dadd..f04c22d 100644 --- a/po/ja.po +++ b/po/ja.po @@ -818,10 +818,6 @@ msgstr "" msgid "Introduction message already specified" msgstr "序文は %s という名前で保存されました\\n" -#: quilt/mail.in:262 -msgid "You have to install 'formail' to use 'quilt mail'" -msgstr "" - #: quilt/mail.in:305 msgid "Could not determine the envelope sender address. Please use --sender." msgstr "" diff --git a/po/quilt.pot b/po/quilt.pot index b1d2889..44d95c0 100644 --- a/po/quilt.pot +++ b/po/quilt.pot @@ -544,10 +544,6 @@ msgstr "" msgid "Introduction message already specified" msgstr "" -#: quilt/mail.in:262 -msgid "You have to install 'formail' to use 'quilt mail'" -msgstr "" - #: quilt/mail.in:305 msgid "Could not determine the envelope sender address. Please use --sender." msgstr "" diff --git a/po/ru.po b/po/ru.po index 6e91e3a..fdec6f3 100644 --- a/po/ru.po +++ b/po/ru.po @@ -762,10 +762,6 @@ msgstr "" msgid "Introduction message already specified" msgstr "" -#: quilt/mail.in:262 -msgid "You have to install 'formail' to use 'quilt mail'" -msgstr "" - #: quilt/mail.in:305 msgid "Could not determine the envelope sender address. Please use --sender." msgstr "" diff --git a/quilt/mail.in b/quilt/mail.in index 5e519f9..ba48851 100644 --- a/quilt/mail.in +++ b/quilt/mail.in @@ -81,6 +81,18 @@ msgid() echo "$timestamp@${opt_sender_address#*@}" } +# Extract RFC 2822 compliant header values, including Long Header Fields, +# from messages + +extract_header_value() +{ + local header=$1 + + # Long Header Fields may span multiple lines, in which case CRLF + # is followed by space or tab (RFC 2822) + sed -n "/^${header}/,/^[^[:blank:]]/ { /^${header}/ { p; n; }; /^[^[:blank:]]/q; /^$/q; p; }" | sed "s/^${header}//" +} + # See RFC 2822 Internet Message Format for how the In-Reply-To and # References headers are generated... @@ -88,7 +100,7 @@ in_reply_to_header() { local message=$1 message_id - message_id=$(formail -x Message-ID: < "$message") + message_id=$(extract_header_value Message-ID: < "$message") message_id=${message_id# } [ -n "$message_id" ] && echo "In-Reply-To: $message_id" } @@ -97,14 +109,14 @@ references_header() { local message=$1 message_id references in_reply_to - message_id=$(formail -x Message-ID: < "$message") + message_id=$(extract_header_value Message-ID: < "$message") message_id=${message_id# } - references=$(formail -x References: < "$message") + references=$(extract_header_value References: < "$message") references=${references# } if [ -z "$references" ] then - in_reply_to=$(formail -x In-Reply-To: < "$message") + in_reply_to=$(extract_header_value In-Reply-To: < "$message") in_reply_to=${in_reply_to# } if [ -n "$in_reply_to" ] then @@ -256,9 +268,6 @@ then usage fi -# check if formail is installed before doing anything -check_external_tool formail procmail - if [ $# -ge 1 ] then if [ "$1" = - ] @@ -329,7 +338,7 @@ then local -a mh # Does this patch have a Subject: line? - subject=$(formail -x Subject: < $tmpdir/header) + subject=$(extract_header_value Subject: < $tmpdir/header) if [ -n "$subject" ] then awk ' @@ -439,7 +448,7 @@ do | quilt_mail_patch_filter "$patch" > "$tmpdir/$patch" status=${PIPESTATUS[1]} - subject=$(formail -x Replace-Subject: < "$tmpdir/$patch" | join_lines) + subject=$(extract_header_value Replace-Subject: < "$tmpdir/$patch" | join_lines) if [ $status -ne 0 -o -z "$subject" ] then printf \ @@ -482,7 +491,7 @@ then if [ -z "$opt_subject" ] then - opt_subject="Re: $(formail -x Subject: < "$opt_reply_to" \ + opt_subject="Re: $(extract_header_value Subject: < "$opt_reply_to" \ | sed -e 's/^ *\([rR][eE]: *\)*//')" fi fi @@ -531,7 +540,7 @@ then fi fi -subject=$(formail -x Subject: < $introduction | join_lines) +subject=$(extract_header_value Subject: < $introduction | join_lines) if [ -z "$subject" ] then if [ -z "$opt_message" ] @@ -550,7 +559,7 @@ then exec 1> $opt_mbox fi -subject_prefix=$(formail -x Subject-Prefix: < $introduction | join_lines) +subject_prefix=$(extract_header_value Subject-Prefix: < $introduction | join_lines) [ -n "$subject_prefix" ] && subject_prefix="$subject_prefix " subject_prefix=${subject_prefix//\'/\'\'} -- 2.2.1 _______________________________________________ Quilt-dev mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/quilt-dev
