🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nn
Article #6726

Re: (Q) setting mailer -> elm

#6726
From: Dave Wolfe
Date: Thu, 10 Nov 1994 19:45
91 lines
3392 bytes
In <39qpfr$5k2@paperboy.gsfc.nasa.gov> dpf@ganges.gsfc.nasa.gov (David Friedlander) writes:

>THe nn_elm script ... works, but there is one odd bug: If the Subject
>line contains punctuation (I haven't isolated which types), it does
>indeed mail a copy to your intended recipient, but it also tries to
>send it to individual words on your Subject line, which, of course,
>bounce.

[ example deleted ]

The problem is the quotes (") in the subject. It would be much prettier
in Perl, but the following revised nn_elm fixes this problem:

---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 11/10/1994 20:04 UTC by dwolfe@miaow
# Source directory /tmp_mnt/home/dwolfe/News
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#    725 -rwxr-xr-x nn_elm
#
shar: saving /home/dwolfe/nn_elm (Text)
# ============= nn_elm ==============
if test -f 'nn_elm' -a X"$1" != X"-c"; then
	echo 'x - skipping nn_elm (File already exists)'
else
echo 'x - extracting nn_elm (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'nn_elm' &&
X#!/bin/sh
X#
X# nn_elm
X#
X# 07 Aug 91             V1.0
X#
X# Massage a mail message from nn into a form that elm can use
X# (c) 1991 Phil Kernick <phil@ringo.ssn.flinders.edu.au> Wizard Software
X#
X# 10 Nov 94             V1.1	Escape quotes in subject -- Dave Wolfe
X
Xeval `awk '
XBEGIN {
X    
X  FS = ":";
X  dq = sprintf("%c", 34);
X  bs = sprintf("%c", 92);
X
X  headers = 0;
X  to = "";
X  subject = "";
X}
X
X/^.*: / {
X    
X  headers++;
X  if($1 == "To")
X    to = dq substr($0, 5) dq;
X  if($1 == "Subject") {
X    subject = substr($0, 10);
X    gsub(/\"/, bs dq, subject);
X    subject = dq subject dq;
X  }
X}
X
X/^$/ {
X    
X    printf("tail +%d %s | elm -s %s %s > /dev/null\n", headers+2, mail, subject,
X to);
X    exit;
X}' mail=$1 $1`
X
Xexit $?
SHAR_EOF
chmod 0755 nn_elm ||
echo 'restore of nn_elm failed'
Wc_c="`wc -c < 'nn_elm'`"
test 725 -eq "$Wc_c" ||
	echo 'nn_elm: original size 725, current size' "$Wc_c"
fi
exit 0

-- 
 Dave Wolfe    | 6501 William Cannon Dr. W. | (512) 891-3246
 Motorola MMTG | Austin, TX  78735-8598     | dwolfe@pets.sps.mot.com
Technical Details
Message-ID: <dwolfe.784496724@gruntwork>
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!nntp.gmd.de!newsserver.jvnc.net!yale.edu!yale!zip.eecs.umich.edu!newsxfer.itd.umich.edu!gatech!howland.reston.ans.net!cs.utexas.edu!uunet!spstimes.sps.mot.com!mogate!risc.sps.mot.com!gruntwork.sps.mot.com!gruntwork!dwolfe
References: <39e36m$gp8@hamilton.maths.tcd.ie> <brindaCyryEw.E4K@netcom.com> <39qpfr$5k2@paperboy.gsfc.nasa.gov>

Show Full Headers
Complete Article Headers
Message-ID: <dwolfe.784496724@gruntwork>
Subject: Re: (Q) setting mailer -> elm
Date: Thu, 10 Nov 1994 19:45:24 +0000
From: dwolfe@miaow.sps.mot.com (Dave Wolfe)
References: <39e36m$gp8@hamilton.maths.tcd.ie> <brindaCyryEw.E4K@netcom.com> <39qpfr$5k2@paperboy.gsfc.nasa.gov>
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!nntp.gmd.de!newsserver.jvnc.net!yale.edu!yale!zip.eecs.umich.edu!newsxfer.itd.umich.edu!gatech!howland.reston.ans.net!cs.utexas.edu!uunet!spstimes.sps.mot.com!mogate!risc.sps.mot.com!gruntwork.sps.mot.com!gruntwork!dwolfe
Newsgroups: news.software.nn
Organization: Motorola RISC Software, Austin, TX
Lines: 91
NNTP-Posting-Host: miaow.sps.mot.com
Keywords: news mail nn elm