tChanging more formats to use printf. - rohrpost - A commandline mail client to change the world as we see it.
 (HTM) git clone git://r-36.net/rohrpost
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit e7a3f1cfb83fe1477038016bb6a574f49d62239c
 (DIR) parent bba874fdbfc5e9958ec0ba44d48a7b2493c0b87b
 (HTM) Author: Christoph Lohmann <20h@r-36.net>
       Date:   Thu,  6 Feb 2014 19:20:46 +0100
       
       Changing more formats to use printf.
       
       Diffstat:
         bin/rpcomp                          |       8 +++++++-
         tmpl/compose.sh                     |      16 ++++++++++++----
         tmpl/fwd.sh                         |      18 ++++++++++--------
         tmpl/repl.sh                        |       5 +++++
       
       4 files changed, 34 insertions(+), 13 deletions(-)
       ---
 (DIR) diff --git a/bin/rpcomp b/bin/rpcomp
       t@@ -1,5 +1,11 @@
        #!/bin/sh
        
       +to=""
       +if [ $# -gt 0 ];
       +then
       +        to="$1"
       +fi
       +
        BASE="$(rppath -b)"
        
        if [ ! -x $BASE/tmpl/compose.sh ];
       t@@ -17,7 +23,7 @@ trap 'signalh' 3 6 9 15
        
        dfolder=$(rpcfg -v fold_drafts)
        
       -$BASE/tmpl/compose.sh > $tmpfile
       +$BASE/tmpl/compose.sh "${to}" > $tmpfile
        mid=$(rpadd -m $dfolder -f seen $tmpfile)
        signalh
        
 (DIR) diff --git a/tmpl/compose.sh b/tmpl/compose.sh
       t@@ -1,9 +1,15 @@
        #!/bin/sh
        
       -echo "Date: `LANG=C date "+%a, %d %b %Y %T %z"`
       -From: `rpcfg -v defaultfrom`
       +to=""
       +if [ $# -gt 0 ];
       +then
       +        to="$1"
       +fi
       +
       +printf "Date: %s
       +From: %s
        Subject: Subject
       -To:
       +To: %s
        Cc:
        Bcc:
        User-Agent: rohrpost
       t@@ -11,7 +17,9 @@ MIME-Version: 1.0
        Content-Type: text/plain; charset=\"utf-8\"
        Content-Transfer-Encoding: 8bit
        
       -Text"
       +Text\n" "$(LANG=C date "+%a, %d %b %Y %T %z")" \
       +        "$(rpcfg -v defaultfrom)" \
       +        "${to}"
        
        if [ -e $HOME/.signature ];
        then
 (DIR) diff --git a/tmpl/fwd.sh b/tmpl/fwd.sh
       t@@ -1,7 +1,7 @@
        #!/bin/sh
        
        usage() {
       -        echo "usage: `basename $1` [-h] mailid"
       +        printf "usage: %s [-h] mailid\n" "$(basename "$1")"
        }
        
        while getopts "hal" opt;
       t@@ -32,21 +32,23 @@ then
                exit 1
        fi
        
       -nsubject="Fwd: `rpview -ve Subject -- "$ids"`"
       +nsubject="Fwd: $(rpview -ve Subject -- "$ids")"
        
       -echo "Date: `LANG=C date "+%a, %d %b %Y %T %z"`
       -From: `rpcfg -v defaultfrom`
       -Subject: ${nsubject}
       +printf "Date: %s
       +From: %s
       +Subject: %s
        To:
        Cc:
        Bcc:
        User-Agent: rohrpost
        MIME-Version: 1.0
        Content-Type: text/plain; charset=\"utf-8\"
       -Content-Transfer-Encoding: 8bit
       -"
       +Content-Transfer-Encoding: 8bit\n" \
       +        "$(LANG=C date "+%a, %d %b %Y %T %z")" \
       +        "$(rpcfg -v defaultfrom)" \
       +        "${nsubject}"
        
        # Consider checking for multiple messages and add them as eml or inline.
        rpview -nb -- "$ids" | sed 's/^/> /'
       -echo
       +printf "\n"
        
 (DIR) diff --git a/tmpl/repl.sh b/tmpl/repl.sh
       t@@ -154,3 +154,8 @@ printf "On $(LANG=C date "+%a, %d %b %Y %T %z") ${from} wrote:\n"
        rpview -nb -- "$ids" | sed 's/^/> /' 
        printf "\n"
        
       +if [ -e $HOME/.signature ];
       +then
       +        cat $HOME/.signature
       +fi
       +