quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] [patch 1/3] Add --no-intro option


From: syrjala
Subject: [Quilt-dev] [patch 1/3] Add --no-intro option
Date: Thu, 31 Aug 2006 22:25:27 +0300
User-agent: quilt/0.45-1

Add a new --no-intro option to quilt mail to comply with akpm's
"The perfect patch" guidelines.

---

 src/quilt-0.45/quilt/mail.in |   45 ++++++++++++++++++++++++++++---------------
 1 file changed, 30 insertions(+), 15 deletions(-)

Index: villes/src/quilt-0.45/quilt/mail.in
===================================================================
--- villes.orig/src/quilt-0.45/quilt/mail.in
+++ villes/src/quilt-0.45/quilt/mail.in
@@ -21,7 +21,7 @@ fi
 
 usage()
 {
-       printf $"Usage: quilt mail {--mbox file|--send} [-m text] [--prefix 
prefix] [--sender ...] [--from ...] [--to ...] [--cc ...] [--bcc ...] 
[--subject ...]\n"
+       printf $"Usage: quilt mail {--mbox file|--send} [-m text] [--prefix 
prefix] [--sender ...] [--from ...] [--to ...] [--cc ...] [--bcc ...] 
[--subject ...] [--no-intro]\n"
        if [ x$1 = x-h ]
        then
                printf $"
@@ -55,6 +55,9 @@ with a template for the introduction. Pl
 
 --to, --cc, --bcc
        Append a recipient to the To, Cc, or Bcc header.
+
+--no-intro
+       Do not send the introduction message.
 " "@DOCSUBDIR@/README.MAIL"
                exit 0
        else
@@ -94,7 +97,7 @@ process_mail()
 
 options=`getopt -o m:h --long from:,to:,cc:,bcc:,subject: \
                       --long send,mbox:,charset:,sender: \
-                      --long prefix: -- "$@"`
+                      --long prefix:,no-intro -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -140,6 +143,9 @@ do
        --charset)
                opt_charset=$2
                shift 2 ;;
+       --no-intro)
+               opt_no_intro=1
+               shift ;;
        -h)
                usage -h ;;
        --)
@@ -384,14 +390,17 @@ subject_prefix=$(sed -ne $'s/^Subject-Pr
 
 subject_prefix=${subject_prefix//\'/\'\'}
 subject_prefix=${subject_prefix//\//\\\/}
-p=${subject_prefix//@num@/$(printf %0*d ${#total} 0)}
-p=${p//@total@/$total}
-sed -e $'s/^\\(Subject:[ \t]\\)/\\1'"$p"'/' \
-    -e '/^Subject-Prefix:/d' \
-$introduction \
-| $QUILT_DIR/scripts/edmail --charset $opt_charset \
-                 --remove-empty-headers To Cc Bcc \
-| process_mail
+
+if [ -z "$opt_no_intro" ]; then
+       p=${subject_prefix//@num@/$(printf %0*d ${#total} 0)}
+       p=${p//@total@/$total}
+       sed -e $'s/^\\(Subject:[ \t]\\)/\\1'"$p"'/' \
+           -e '/^Subject-Prefix:/d' \
+           $introduction \
+       | $QUILT_DIR/scripts/edmail --charset $opt_charset \
+                         --remove-empty-headers To Cc Bcc \
+       | process_mail
+fi
 
 if [ -n "$opt_mbox" ]; then
        exec 1>> $opt_mbox
@@ -432,11 +441,17 @@ for patch in "address@hidden"; do
        ' $body)"
        p=${subject_prefix//@num@/$(printf %0*d ${#total} $num)}
        p=${p//@total@/$total}
-       (       echo "Message-Id: <$(msgid)>"
-               sed -n -e '/^$/q' \
-                   -e 's/^Message-Id:/References:/' \
-                   -e p \
-                   $introduction
+       (       if [ -n "$opt_no_intro" -a $num -eq 1 ]; then
+                       sed -n -e '/^$/q' \
+                           -e p \
+                           $introduction
+               else
+                       echo "Message-Id: <$(msgid)>"
+                       sed -n -e '/^$/q' \
+                           -e 's/^Message-Id:/References:/' \
+                           -e p \
+                           $introduction
+               fi
                echo "Content-Disposition: inline; filename=$patch"
                sed -n -e '/^$/q' \
                    -e '/^Recipient-.*:/d' \

-- 
Ville Syrjälä
address@hidden
http://www.sci.fi/~syrjala/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]