| 1 | #!/bin/sh |
| 2 | |
| 3 | header= |
| 4 | while : |
| 5 | do |
| 6 | case $# in 0) break ;; esac |
| 7 | case "$1" in |
| 8 | -b) header=Bcc ;; |
| 9 | -c) header=Cc ;; |
| 10 | -*) echo >&2 "Unknown option $1" |
| 11 | exit 1 ;; |
| 12 | *) break ;; |
| 13 | esac |
| 14 | shift |
| 15 | done |
| 16 | |
| 17 | case $# in |
| 18 | 0) match='*' ;; |
| 19 | 1) match="*$1*"; shift ;; |
| 20 | esac |
| 21 | for p |
| 22 | do |
| 23 | match="$match|*$p*" |
| 24 | done |
| 25 | |
| 26 | { |
| 27 | iis= |
| 28 | iis2=', |
| 29 | ' |
| 30 | while read address name |
| 31 | do |
| 32 | case "$address" in |
| 33 | '#'*) continue ;; |
| 34 | esac |
| 35 | case "$name" in |
| 36 | $match) ;; |
| 37 | *) continue ;; |
| 38 | esac |
| 39 | item="$name <$address>" |
| 40 | if test -z "$header" |
| 41 | then |
| 42 | echo "$iis$item" |
| 43 | elif test -z "$iis" |
| 44 | then |
| 45 | printf "$header: $item" |
| 46 | iis="$iis2" |
| 47 | else |
| 48 | printf "$iis$item" |
| 49 | fi |
| 50 | done |
| 51 | if test -n "$header" |
| 52 | then |
| 53 | printf '\n' |
| 54 | fi |
| 55 | } <<\EOF |
| 56 | linux-kernel@vger.kernel.org Linux Kernel |
| 57 | ask@perl.org Perl5-porters at perl |
| 58 | EOF |