🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nn
1 messages
1 total messages Started by Ajay Shah Mon, 16 Mar 1992 22:57
SUMMARY: how to make nn respect .mailrc when forwarding
#2591
Author: 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
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