cluther@supernet.haus.com (Clay Luther) (11/06/90)
Here is a script that combines your system elm alias file with your sendmail/
smail aliases file. The output is a sendmail/smail compatible alias file,
which you can then run through newaliases.
The second script is a display of the system elm alias file, written since
elm currently provides *NO MEANS* of easily looking at the system aliases
(what were they thinking of?).
These scripts are both fairly trivial, but I thought someone would profit
from them. Please make sure that you check the system dependent values.
------------ begin aliasfoo
:
# aliasfoo
# Generates a complete alias file from the sendmail and elm alias files.
#
ELMFILE='/usr/local/lib/aliases.text'
SMFILE='/usr/local/lib/smail/aliases'
ALIASFILE='/usr/local/lib/smail/aliases.all'
cat $SMFILE > $ALIASFILE
awk '\
/.*=.*=.*/ { # A line with equals in it
printf("%s","\n")
size = split($0,blah)
printf("%s:",$1)
# Now, find the last "="
flag = 0
word = 2
while ( flag < 2 ) {
if ( blah[word] == "=" ) {
flag++
}
word++
}
for (i=word; i<=size; i++) {
printf("%s",blah[i])
}
next
}
{
printf("%s",$0)
}
END { printf("%s","\n") }' $ELMFILE >> $ALIASFILE
------------- end aliasfoo
------------- begin showalias
:
# showalias, a script file that parses the elm aliases file and shows what
# aliases are available.
ALIASTXT='/usr/local/lib/aliases.text'
MORE='/usr/local/bin/less'
awk '\
/.*=.*=.*/ {
size = split($0,blah)
flag = 0
word = 1
while ( flag < 2 ) {
if ( blah[word] == "=" ) {
flag++
word++
if ( flag < 2 ) {
printf("%s ","=")
}
} else {
printf("%s ",blah[word])
word++
}
}
printf("%s","\n")
}' $ALIASTXT | sort | $MORE
--------------- end showalias
--
Clay Luther, Postmaster cluther@supernet.haus.com
Harris Adacom Corporation postmaster@supernet.haus.com
Voice: 214/386-2356 MS 23, PO Box 809022, Dallas, Tx 75380-9022
Fax: 214/386-2159 Your mileage may vary. Void where prohibited.