🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nn
Article #5167

Using MH aliases when sending mail from nn (solution)

#5167
From: 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."
Technical Details
Message-ID: <ddkilzer.755644213@pv343f.vincent.iastate.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!gmd.de!newsserver.jvnc.net!yale.edu!xlink.net!howland.reston.ans.net!vixen.cso.uiuc.edu!newsrelay.iastate.edu!news.iastate.edu!pv343f.vincent.iastate.edu!ddkilzer

Show Full Headers
Complete Article Headers
Message-ID: <ddkilzer.755644213@pv343f.vincent.iastate.edu>
Subject: Using MH aliases when sending mail from nn (solution)
Date: Sat, 11 Dec 1993 21:10:13 GMT
From: ddkilzer@iastate.edu (David D Kilzer)
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!gmd.de!newsserver.jvnc.net!yale.edu!xlink.net!howland.reston.ans.net!vixen.cso.uiuc.edu!newsrelay.iastate.edu!news.iastate.edu!pv343f.vincent.iastate.edu!ddkilzer
Newsgroups: news.software.nn
Sender: news@news.iastate.edu (USENET News System)
Organization: Iowa State University, Ames IA
Lines: 59