Add ProjectContact script

todo
Junio C Hamano 2009-02-16 23:52:02 -08:00
parent c1b07915ae
commit 735f9d11ed
1 changed files with 56 additions and 0 deletions

56
ProjectContact Executable file
View File

@ -0,0 +1,56 @@
#!/bin/sh

header=
while :
do
case $# in 0) break ;; esac
case "$1" in
-b) header=Bcc ;;
-c) header=Cc ;;
-*) echo >&2 "Unknown option $1"
exit 1 ;;
*) break ;;
esac
shift
done

case $# in
0) match='*' ;;
1) match="*$1*"; shift ;;
esac
for p
do
match="$match|*$p*"
done

{
iis=
iis2=',
'
while read address name
do
case "$name" in
$match) ;;
*) continue ;;
esac
item="$name <$address>"
if test -z "$header"
then
echo "$iis$item"
elif test -z "$iis"
then
printf "$header: $item"
iis="$iis2"
else
printf "$iis$item"
fi
done
if test -n "$header"
then
printf '\n'
fi
} <<\EOF
linux-kernel@vger.kernel.org Linux Kernel
info@lwn.net LWN.NET
emacs-orgmode@gnu.org Emacs Org Mode
EOF