🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nn
Article #2591

SUMMARY: how to make nn respect .mailrc when forwarding

#2591
From: Ajay Shah
Date: Mon, 16 Mar 1992 22:57
74 lines
2709 bytes
This IS in the FAQ but I got so much email that I decided to
post about it.  It takes "Two Simple Steps":

1. You need this line in .nn/init:

set mail-alias-expander nn-expand-mail-alias

2. and you need a script named "nn-expand-mail-alias" on your PATH.
Here is it's source code:

#!/bin/sh
#
# nn-expand-mail-alias -- expands aliases from ~/.mailrc file for nn.
#
# To use, put the following in your ~/.nn/init file:
#
#	set mail-alias-expander nn-expand-mail-alias
#
# Written by Scott Hannahs, Bitter National Magnet Lab, MIT, August 1991
# Complaints, comments, ideas to sth@slipknot.mit.edu
# Tested on Silicon Graphics, IRIX 3.3.1
#
# Minor banging by <rreiner@nexus.yorku.ca> to handle alias value fields
# which contain doublequote characters, e.g.
#
#	alias Foo "Foobar the Great <foo@bar.com>"
#
# (the doublequotes are stripped in the expansion), and to handle multiple
# spaces after the token "alias".
#
# Also added some error detection and signal traps; tested on SunOS 4.1.1.
#
#	Exit codes: 	0 -- normal termination
#			1 -- parm error
#			2 -- file does not exist
#			3 -- trap
#

if [ z$1 = z ]; then
        myname=`basename $0`
        echo "$myname: usage is  $myname workfile"
        exit 1
fi

if [ ! -f $1 ]; then
        myname=`basename $0`
        echo "$myname: $1 does not exist or is a directory"
        exit 2
fi

TMP_DIR=/usr/tmp
ADDRESS_LIST=""

trap "rm -f ${TMP_DIR}/nn.alias.$$ ; exit 3" 0 1 2 3 15

ALIAS_LIST=`head -1 $1 | sed -e s/To://`
for ALIAS in $ALIAS_LIST ; do
        ADDRESS=`grep '^[ 	]*alias[ 	]'"$ALIAS"'[ 	]' ${HOME}/.mailrc |\
        sed -e s/'^[ 	]*alias[ 	]'"$ALIAS"'[ 	]*'// |\
        sed -e s/'"'//g`
        if [ "$ADDRESS" ] ; then
                ADDRESS_LIST="$ADDRESS_LIST $ADDRESS"
        else
                ADDRESS_LIST="$ADDRESS_LIST $ALIAS"
        fi
done
echo "To:${ADDRESS_LIST}" > ${TMP_DIR}/nn.alias.$$
tail +2 $1 >> ${TMP_DIR}/nn.alias.$$
mv -f ${TMP_DIR}/nn.alias.$$ $1
  
exit 0
-- 

Ajay Shah, (213)749-8133, ajayshah@usc.edu
Technical Details
Message-ID: <ksa9u0INN8m8@alhena.usc.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!sparky!uunet!usc!news

Show Full Headers
Complete Article Headers
Message-ID: <ksa9u0INN8m8@alhena.usc.edu>
Subject: SUMMARY: how to make nn respect .mailrc when forwarding
Date: Mon, 16 Mar 1992 22:57:04 +0000
From: ajayshah@alhena.usc.edu (Ajay Shah)
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!sparky!uunet!usc!news
Newsgroups: news.software.nn
Organization: University of Southern California, Los Angeles, CA
Lines: 74
Sender: ajayshah@alhena.usc.edu (Ajay Shah)
NNTP-Posting-Host: alhena.usc.edu