🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nn
1 messages
1 total messages Started by David D Kilzer Sat, 11 Dec 1993 21:10
Using MH aliases when sending mail from nn (solution)
#5167
Author: David D Kilzer
Date: Sat, 11 Dec 1993 21:10
59 lines
3570 bytes
I ran into a problem when sending mail from nn: It wouldn't use the
aliases I had set up in my MH aliases file, ~/.mh_aliases.  I found the
FAQ for this newsgroup at rtfm.mit.edu and copied the nnalias shell
script from it.

To my chagrin, it used the .mailrc file which the standard UNIX ``mail''
command uses, so I created a couple of solutions to this problem.

The first solution is to update the .mailrc file with aliases from the
.mh_aliases file upon each login.  The following segment of C-shell
script code (which was NOT written by me) will do the trick:

------------------------------------------------------------------------
#/bin/csh
# updates aliases in .mailrc file using .mh_aliases
#   we assume that ".mailrc" and ".mh_aliases" exist
tr ':' ' ' < ~/.mh_aliases | awk '{ printf("mh_alias %s\n", $0) }' | \
  cat ~/.mailrc - | grep -v "^alias" | sed -e "s/^mh_alias/alias/" >! \
  ~/.mailrc_tmp$$
mv -f ~/.mailrc_tmp$$ ~/.mailrc
------------------------------------------------------------------------

I would suggest putting this in your .login file so it's only executed
once each time you log in.  If you put it in your .cshrc or .cshrc.mine
file, it will be executed every time a new C-shell is started (i.e.
each time you execute a shell script).  For those who want to use the
above script with /bin/sh, replace all of the tilde characters ( ~ )
with $HOME.

(I use this script code in conjunction with the modified nnalias that
uses the MH aliases file [see second solution below] so I can use my MH
aliases with the standard UNIX mail command.)

The second solution is to replace these three lines in the nnalias file:

------------------------------------------------------------------------
       ADDRESS=`grep '^[ 	]*alias[ 	][ 	]*'"$ALIAS"'[ 	]' ${HOME}/.mailrc |\
       sed      -e s/'^[ 	]*alias[ 	][ 	]*'"$ALIAS"'[ 	][ 	]*'// |\
       sed -e s/'"'//g`
------------------------------------------------------------------------

with this one line:

------------------------------------------------------------------------
       ADDRESS=`grep '^[ 	]*'"$ALIAS"'[ 	]*:[ 	]*' ${HOME}/.mh_aliases | sed          -e s/'^[ 	]*'"$ALIAS"'[ 	]*:[ 	]*'//`
------------------------------------------------------------------------

This will cause the nnalias program to use .mh_aliases instead of
.mailrc.  Make sure to follow the directions in the nn FAQ as usual.

To the FAQ keeper:  if you wish to add any of this information to the
FAQ, please feel free!

Dave
-- 
David D. Kilzer               \                ST:TNG _Relics_
Computer Engineer 3           /       Capt. Montgomery Scott ("Scotty")
ddkilzer@iastate.edu          \   "I may be a captain by rank, but I never
Iowa State University, Ames   /    wanted to be anything but an engineer."
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