🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nn
Article #2734

Re: Marrying mh with nn---how?

#2734
From: Ray Davis
Date: Sat, 09 May 1992 20:07
256 lines
7143 bytes
>>How does one tell nn to use mh as the mailer?

Here is a shar file with some scripts and nn init file settings
which I use to interface nn and mh.  You'll have to make them
work in your environment, and convert to sh or csh if needed.

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	nnmh
# This archive created: Sat May  9 20:50:38 1992
export PATH; PATH=/bin:/usr/bin:$PATH
if test ! -d 'nnmh'
then
	echo shar: "creating directory 'nnmh'"
	mkdir 'nnmh'
fi
echo shar: "entering directory 'nnmh'"
cd 'nnmh'
echo shar: "extracting 'init'" '(613 characters)'
if test -f 'init'
then
	echo shar: "will not over-write existing file 'init'"
else
sed 's/^	X//' << \SHAR_EOF > 'init'
	X##### variables
	X
	Xset mailer nnsend
	X
	X##### key maps and macros
	X
	X# S - save article in an mh folder
	Xmap show S macro 0
	Xdefine 0
	X:!!>~/.nnmh.tmp
	Xsave-full "~/.nnmh.tmp"
	Xprompt "Enter mh folder: "
	X:!!nnmhsave ~/.nnmh.tmp
	Xend
	X
	X# [ - delete message from an mh folder
	Xmap show [ macro 1
	Xdefine 1
	X:!!>~/.nnmh.tmp
	Xsave-full "~/.nnmh.tmp"
	Xprompt "deleting message..."
	X:!!nnmhdelete ~/.nnmh.tmp
	Xprompt ""
	Xnext-article
	Xend
	X
	X# ] - refile message to a different mh folder
	Xmap show ] macro 2
	Xdefine 2
	X:!!>~/.nnmh.tmp
	Xsave-full "~/.nnmh.tmp"
	Xprompt "Enter mh refile folder: "
	X:!!nnmhrefile ~/.nnmh.tmp
	Xprompt ""
	Xnext-article
	Xend
SHAR_EOF
if test 613 -ne "`wc -c < 'init'`"
then
	echo shar: "error transmitting 'init'" '(should have been 613 characters)'
fi
fi
echo shar: "extracting 'nnm'" '(663 characters)'
if test -f 'nnm'
then
	echo shar: "will not over-write existing file 'nnm'"
else
sed 's/^	X//' << \SHAR_EOF > 'nnm'
	X#!/bin/ksh
	X# nnm - read an mh mail folder with nn
	X#
	X(( $# == 0 )) && echo "usage: nnm folder ..." && exit
	Xmhdir=`grep ^Path: ~/.mh_profile | awk '{ print $2 }'`
	Xtrap '/bin/rm -f $tmp; exit' 0 1 2 3 15
	Xfor folder
	Xdo
	X    cd ~/$mhdir/$folder
	X    tmp=`basename $folder`
	X    if [ ! -s $tmp ]
	X    then
	X    >$tmp
	X    chmod 600 $tmp
	X    echo "Collecting $folder... \c"
	X    show +$folder 1-last 2>&1 |
	X	awk '/^>>> / { foldnum = $2; next }
	X	     /^Subject:/ { print $0; print "Summary:", foldnum; next }
	X	     { print $0 }' |
	X	sed 1d >$tmp
	X    fi
	X    if [ -s $tmp ]
	X    then
	X	echo "done."
	X	nn $tmp
	X    else
	X	echo No $folder is good $folder.
	X    fi
	X    /bin/rm -f $tmp
	Xdone
SHAR_EOF
if test 663 -ne "`wc -c < 'nnm'`"
then
	echo shar: "error transmitting 'nnm'" '(should have been 663 characters)'
fi
chmod +x 'nnm'
fi
echo shar: "extracting 'nnmhsave'" '(1630 characters)'
if test -f 'nnmhsave'
then
	echo shar: "will not over-write existing file 'nnmhsave'"
else
sed 's/^	X//' << \SHAR_EOF > 'nnmhsave'
	X#!/bin/ksh
	X#
	X# ***> link this file to nnmhsave, nnmhdelete and nnmhrefile
	X#
	X# nnmhsave   - save nn article to an mh folder
	X# nnmhdelete - delete a corresponding MH mail message
	X# nnmhrefile - refile a corresponding MH mail message
	X#
	XMHDIR=~/.fo
	Xme=`basename $0`
	Xexport MHCONTEXT=context.$me
	Xfolder=
	Xnumber=
	XTMP=$1
	X
	Xfunction get_fol_num {
	X    export IFS=' :'
	X    exec 3<$TMP
	X    while read -u3 head folder number
	X    do
	X	[ "$head" = "Summary" ] && return
	X    done
	X    print - "\007$me: error - not an nnmh style message\c"
	X    sleep 3
	X    exit 1
	X}
	X
	Xfunction get_folder_name {
	X    read newfolder
	X    if [ ! "$newfolder" ] 
	X    then
	X	print - "\007$me: no folder specified, not saved\c"
	X	exit 1
	X    fi
	X    if [ ! -d $MHDIR/$newfolder ]
	X    then
	X	print - "\007$me: folder does not exist, not saved\c"
	X	exit 1
	X    fi
	X}
	X
	Xtrap "/bin/rm -f $TMP" 0 1 2 3 15
	Xcase "$me" in
	X    nnmhsave)
	X	get_folder_name
	X	inc +$newfolder -file $TMP -truncate >/dev/null
	X	print - "$me: saved in +$newfolder\c"
	X	;;
	X    nnmhdelete)
	X	get_fol_num
	X	rmm +$folder $number >/dev/null 2>&1
	X	if (( $? == 0 ))
	X	then
	X	    print - "\r\n$me: message deleted (+$folder $number)\c"
	X	else
	X	    print - "\r\n$me: message not deleted! (+$folder $number)\007\c"
	X	fi
	X	sleep 1
	X	;;
	X    nnmhrefile)
	X	get_folder_name
	X	get_fol_num
	X	mark -zero -seq cur +$folder $number >/dev/null 2>&1
	X	if (( $? != 0 ))
	X	then
	X	    print - "$me: message does not exist! (+$folder $number)\007\c"
	X	fi
	X	refile +$newfolder >/dev/null 2>&1
	X	if (( $? == 0 ))
	X	then
	X	    print - "$me: message refiled in +$newfolder\c"
	X	else
	X	    print - "$me: message not refiled in +$newfolder!\007\c"
	X	fi
	X	sleep 1
	X	;;
	Xesac
SHAR_EOF
if test 1630 -ne "`wc -c < 'nnmhsave'`"
then
	echo shar: "error transmitting 'nnmhsave'" '(should have been 1630 characters)'
fi
chmod +x 'nnmhsave'
fi
echo shar: "extracting 'nnmsgs'" '(248 characters)'
if test -f 'nnmsgs'
then
	echo shar: "will not over-write existing file 'nnmsgs'"
else
sed 's/^	X//' << \SHAR_EOF > 'nnmsgs'
	X# nnmsgs - read msgs with nn
	Xtmp=/tmp/nnmsgs$$
	Xtrap "/bin/rm -f $tmp; exit" 0 1 2 3 15
	Xecho "Collecting msgs... \c"
	X~/bin/msgs | nawk -f ~/lib/nnmsgs.awk >$tmp
	Xecho "done."
	Xif [ -s $tmp ]
	Xthen
	X    nn $tmp
	Xelse
	X    echo No messages is good msgs.
	Xfi
SHAR_EOF
if test 248 -ne "`wc -c < 'nnmsgs'`"
then
	echo shar: "error transmitting 'nnmsgs'" '(should have been 248 characters)'
fi
chmod +x 'nnmsgs'
fi
echo shar: "extracting 'nnmsgs.awk'" '(139 characters)'
if test -f 'nnmsgs.awk'
then
	echo shar: "will not over-write existing file 'nnmsgs.awk'"
else
sed 's/^	X//' << \SHAR_EOF > 'nnmsgs.awk'
	XBEGIN {
	X    notfirsttime = 0;
	X}
	X/^\(Message/ {
	X    if (notfirsttime) {
	X	print "";
	X    } else {
	X	notfirsttime = 1;
	X    }
	X}
	X{
	X    print $0
	X}
SHAR_EOF
if test 139 -ne "`wc -c < 'nnmsgs.awk'`"
then
	echo shar: "error transmitting 'nnmsgs.awk'" '(should have been 139 characters)'
fi
fi
echo shar: "done with directory 'nnmh'"
cd ..
exit 0
#	End of shell archive
Technical Details
Message-ID: <rdavis.705442047@connie.de.convex.com>
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!convex!rdavis
References: <chaw.705210758@Xenon.Stanford.EDU> <1992May08.095536.5664@bas-a.bcc.ac.uk>

Show Full Headers
Complete Article Headers
Message-ID: <rdavis.705442047@connie.de.convex.com>
Subject: Re: Marrying mh with nn---how?
Date: Sat, 9 May 1992 20:07:27 GMT
From: rdavis@convex.com (Ray Davis)
References: <chaw.705210758@Xenon.Stanford.EDU> <1992May08.095536.5664@bas-a.bcc.ac.uk>
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!convex!rdavis
Newsgroups: news.software.nn
Keywords: nn mh
Sender: usenet@convex.com (news access account)
Nntp-Posting-Host: connie.convex.com
Organization: CONVEX Computer Corporation, Richardson, Tx., USA
Distribution: news
X-Disclaimer: This message was written by a user at CONVEX Computer
    Corp. The opinions expressed are those of the user and
    not necessarily those of CONVEX.
Lines: 257