This patch against tmda-pending 0.62 allows messages to be specified on
standard input instead of the command line by using `-' instead of a
message ID list.

Sample usage: 

tmda-pending -bT | grep 'foobar' | awk '{print $1}' | \
  tmda-pending -br -

Patch attached.  Enjoy!

-- 
Michael S. Fischer / michael at dynamine.net / +1 650-533-4684
Lead Hacketeer, Dynamine Consulting, Silicon Valley, CA
Index: tmda-pending
===================================================================
RCS file: /cvsroot/tmda/tmda/bin/tmda-pending,v
retrieving revision 1.28
diff -r1.28 tmda-pending
24c24
< Usage:  %(program)s [OPTIONS] [messages ... ]
---
> Usage:  %(program)s [OPTIONS] [messages ... | - ]
119,120c119,122
<     messages
<        If one or more messages are provided, operate just on them.
---
>     messages | -
>        If one or more messages are provided, operate just on them. 
>        If `-' is specified, operate on a list of messages provided by
>          standard input.
133a136,138
>     (immediately release any messages with `foobar' in them)
>     %(program)s -b -T | grep foobar | awk '{print $1}' | %(program)s -b -r -
> 
315c320,332
<     if not msgs:
---
> 
>     # Replace any `-' in the message list with those messages provided via
>     # standard input.  (Since it's pointless to call it twice, it's safe
>     # to remove any subsequent occurrences in the list after processing.)
>     wantedstdin = 0
>     for msg in msgs:
>         if msg == '-':
>             wantedstdin = 1
>             for line in sys.stdin.readlines():
>                 msgs.append(line.strip())
>             msgs.remove('-')
> 
>     if not msgs and not wantedstdin:

Reply via email to