Thread View: news.software.nn
2 messages
2 total messages
Started by Jozsef Ferincz
Mon, 10 May 1993 15:06
mail-alias-expander for nn
Author: Jozsef Ferincz
Date: Mon, 10 May 1993 15:06
Date: Mon, 10 May 1993 15:06
15 lines
1221 bytes
1221 bytes
Hi, I just wonder if someone already made a sh script for mail-alias-expander. (for users, they have an account on the machine AND if you have defined aliases in your elm, for they also) Please email me! Thanks in advance, Jozsef -- Jozsef Ferincz INTERNET : ferincz@chemie.fu-berlin.de Freie Universitaet Berlin UUCP : ferincz@fub.uucp Institut fuer Organische Chemie Tel.: (+49 30) 838-2677, 838-5363 Takustr. 3, D-1000 Berlin 33 Fax : (+49 30) 838-5163, 838-4248
Re: mail-alias-expander for nn
Author: Jozsef Ferincz
Date: Tue, 11 May 1993 13:55
Date: Tue, 11 May 1993 13:55
126 lines
4482 bytes
4482 bytes
Hi,
Here is a new mail-alias-extender for nn. This is for people, they
don't have ~/.mailrc (like nnalias need it). The aliases - if any -
in elm will be also checked.
Regards,
Jozsef
aliasexp:
>-----------CUT HERE-----------CUT HERE-----------CUT HERE-----------<
#!/bin/sh
#
# aliasexp - alias expander for nn
#
# usage: aliasexp file
#
# Make it executable, when saved!
#
# Put in your $HOME/.nn/init this line (without '# '):
# (if location of aliasexp: ~/bin)
# set mail-alias-expander ~/bin/aliasexp
#
# aliasexp checks as first the users on the local host, as second checks
# ~/.elm/aliases - if exist. If the word(s) in the 'To:' {first} line
# has(have) some of the '@', '%' or '!' characters, then it(they) will
# be not checked for alias, it(they) will be added without any modification
# to the list of addresses. The addresses may separated by ' ' or ','.
#
# Exit codes: 0 - normal
# 1 - parameter false
# 2 - file (arg.) does not exist
# 3 - trap
# 4 - format false
#
# (C) J. Ferincz (ferincz@chemie.fu-berlin.de), 1993
myname=`basename $0`
if [ $# -ne 1 ] ; then
echo "usage: $myname file"
exit 1
fi
if [ ! -f $1 ] ; then
echo "$myname: $1 does not exist"
exit 2
fi
tmpdir=/tmp
# if you don't have LOGNAME, set it before
tmpfile=nn.$LOGNAME.$$
# !!!!!!!!!!!!!!!
# ! CHANGE THIS !
# !!!!!!!!!!!!!!!
# localaddress=`hostname`
# my domain name is a local address for me
localaddress=`domainname`
trap 'rm -f $tmpdir/$tmpfile ; echo "$myname aborted" ; exit 3' 1 2 3 15
eval inputfile=\$1
firstline=`sed 1q $inputfile`
tmpstr=`echo $firstline | awk '{print substr($0,1,3)}'`
if [ "$tmpstr" != "To:" ] ; then
echo "$myname: not mail format"
exit 4
fi
tonamelist="`echo $firstline | sed -e s/To:// | sed -e 's/,/ /g'`"
if [ z"$tonamelist"z = "zz" ] ; then
echo "$myname: not mail format"
exit 4
fi
addresslist=""
for toname in $tonamelist ; do
# if toname has one of the [@,%,!] characters, toname isn't an aliasname
if [ `echo $toname | awk '{print(index($0,"@"))}'` -eq 0 ] &&
[ `echo $toname | awk '{print(index($0,"%"))}'` -eq 0 ] &&
[ `echo $toname | awk '{print(index($0,"!"))}'` -eq 0 ] ; then
# check the users on the local host
tmpstr=`finger -s "$toname" | grep "$toname" | cut -f1 -d" "`
if [ "$tmpstr" != "$toname" ] ; then
# toname is has not account on localhost
# check the elm aliases, if exist
if [ -f $HOME/.elm/aliases ] ; then
# elm is used and some alias is defined
address=`elm -c "$toname" | cut -f3 -d" "`
# was toname an alias?
if [ "$address" = "$toname" ] ; then
# alias for toname was not found
# toname will be leave out from the addresslist
continue
else
# alias found
addresslist="$addresslist $address"
fi
else
# elm is not used or alias not defined
# toname will be leave out from the addresslist
continue
fi
else
# toname is a user on the localhost
addresslist="$addresslist $toname@$localaddress"
fi
else
addresslist="$addresslist $toname"
fi
done
echo "To:$addresslist" > $tmpdir/$tmpfile
tail +2 $inputfile >> $tmpdir/$tmpfile
mv -f $tmpdir/$tmpfile $inputfile
exit 0
>-----------CUT HERE-----------CUT HERE-----------CUT HERE-----------<
--
Jozsef Ferincz INTERNET : ferincz@chemie.fu-berlin.de
Freie Universitaet Berlin UUCP : ferincz@fub.uucp
Institut fuer Organische Chemie Tel.: (+49 30) 838-2677, 838-5363
Takustr. 3, D-1000 Berlin 33 Fax : (+49 30) 838-5163, 838-4248
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads