All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
8 echo "$ME -- resubmit messages to the mail filter"
9 echo "Copyright © martin f. krafft <madduck@madduck.net>"
10 echo "Released under the terms of the Artistic Licence 2.0"
15 echo "Usage: $ME [options] <Maildir> [<Maildir> ...]"
17 echo "Valid options are:"
18 cat <<-_eof | column -s\& -t
19 -V|--version & show version information.
20 -h|--help & show this output.
21 -l|--list & process the argument list (even if empty), never stdin
22 -r|--deliver-read & mark messages read on delivery
27 LONGOPTS=version,help,list,deliver-read
33 for opt in $(getopt -n $ME -o $SHORTOPTS -l $LONGOPTS -u -- "$@"); do
35 -V|--version) about; exit 0;;
36 -h|--help) about; echo; usage; exit 0;;
38 -r|--deliver-read) mark_read=1;;
41 if [ -f "$opt" ] && [ -r "$opt" ]; then
44 echo "E: unknown argument: $opt" >&2
51 PROCMAIL=$HOME/.etc/mailfilter/procmail/procmailrc
53 if [ "$mark_read" -eq 1 ]; then
54 PROCMAIL="$PROCMAIL DELIVER_READ=1"
57 # execute the date -R only during the eval, not immediately
58 FILTER="sed -rne ':b;s/^Received:/&/;tf;p;n;bb' -e ':f;iReceived: by resubmission script; $(date -R)' -e ':e;p;n;be'"
59 FILTER="$FILTER | /usr/bin/formail -I'X-Resubmitted: $(date -R)'"
61 if [ -z "${files:-}" ] && [ $list -eq 0 ]; then
62 eval $FILTER | exec $PROCMAIL
65 eval $FILTER < "$f" | $PROCMAIL && rm -f "$f"