Article View: news.software.readers
Article #1678Re: Alternate Pnews files?
From: Greg A. Woods
Date: Wed, 03 Jun 1992 04:14
Date: Wed, 03 Jun 1992 04:14
266 lines
8648 bytes
8648 bytes
In article <1992May31.054819.8005@cas.org> lvirden@cas.org (Larry W. Virden) writes:
> Anyone done anything fancy with their Pnews files? For instance, added code
> helping new users specify a followup header in case they cross post, or
> ensuring that the blank is present after empty headers (some editors drop
> trailing blanks of lines...), try to encourange folks to not do followups to
> multiple groups, etc...
Yup -- I've added handling for a "Summary:" header (which only seems
to work when you post an original article, not a follow-up), and I'm
thinking of adding a post-edit confirm prompt that shows the
newsgroups file entries for each group listed in the "Newsroups:"
header.
What Pnews really needs is a post-edit header parser to verify things
are OK, and to prompt for confirmations and fixes if necesary, as
Larry eludes to. (Eg: check newsgroups header for proper names and
syntax; force follow-ups to be set if multiple newsgroups; verify
distributions, etc., etc.)
Here are the changes for the summary stuff, a couple of bug fixes, and
support for C News' inews -A option:
Index: Pnews.SH
*** Standard Input Wed Dec 31 19:00:00 1969
--- Pnews.SH Wed May 20 23:38:25 1992
***************
*** 4,9 ****
--- 4,11 ----
echo "Extracting Pnews (with variable substitutions)"
$spitshell >Pnews <<!GROK!THIS!
$startsh
+ #ident "@(#)rn4.4:Pnews.SH 1.1.1.2 92/05/20 23:38:02 (woods)"
+ #
# $Id: Pnews.SH,v 4.4 1991/09/09 20:18:23 sob Exp sob $
#
# $Log: Pnews.SH,v $
***************
*** 67,73 ****
# your organization name
orgname="$orgname"
! # what pager you use--if you have kernal paging use cat
pager="\${PAGER-$pager}"
# how you derive full names, bsd, usg, or other
nametype="$nametype"
--- 69,75 ----
# your organization name
orgname="$orgname"
! # what pager you use--if you have kernel paging use cat
pager="\${PAGER-$pager}"
# how you derive full names, bsd, usg, or other
nametype="$nametype"
***************
*** 97,102 ****
--- 99,105 ----
rm=${rm-rm}
tr=${tr-tr}
inews=${inews-inews}
+ cnews=${cnews-undef}
nidump=${nidump}
ypmatch=${ypmatch}
***************
*** 105,110 ****
--- 108,119 ----
dotdir=${DOTDIR-${HOME-$LOGDIR}}
tmpart=$dotdir/.article
+ if $test "$cnews" = "define" ; then
+ inewsopts="-A"
+ else
+ inewsopts=""
+ fi
+
if $test -f $dotdir/.pnewsexpert; then
expertise=expert
else
***************
*** 169,175 ****
hdr_newsgroups=`$sed -n -e '/^Newsgroups:/{' -e 's///' -e 's/,/ /g' -e p -e q -e '}' $tmpart`
hdr_distribution=`$sed -n -e '/^Distribution:/{' -e 's///' -e p -e q -e '}' $tmpart`
! # check for "poster" magic cookie
flag=0
for ng in $hdr_newsgroups ; do
case "$ng" in
--- 178,186 ----
hdr_newsgroups=`$sed -n -e '/^Newsgroups:/{' -e 's///' -e 's/,/ /g' -e p -e q -e '}' $tmpart`
hdr_distribution=`$sed -n -e '/^Distribution:/{' -e 's///' -e p -e q -e '}' $tmpart`
! # check for "poster" magic cookie -- there are dozen's of other possibilities,
! # including the Reply-to address, and so we should really check against the
! # active file....
flag=0
for ng in $hdr_newsgroups ; do
case "$ng" in
***************
*** 180,195 ****
case $flag in
1)
$echo " "
! $echo "The original author has requested that messages be sent back via"
! $echo "mail rather than posting to news. Do you want to jump out of this"
! $echo $n "and mail your reply instead? [yn] $c"
! read ans
! case $ans in
! n*) ;;
! *) exit ;;
! esac
$echo " "
! $echo "OK, but you will have to edit the 'Newsgroups:' line in the message."
;;
esac
--- 191,201 ----
case $flag in
1)
$echo " "
! $echo "The original author didn't know what the hell he was doing and put"
! $echo "'poster' in the follow-up list."
$echo " "
! $echo "You will have to edit the 'Newsgroups:' line in the message."
! $echo "(I hope you remember what newsgroup this was in, 'cause I don't!)"
;;
esac
***************
*** 256,262 ****
$echo 'This program posts news to many machines throughout the country.'
;;
$state.*)
! $echo 'This program posts news to many machines throughout the state.'
;;
$city.*)
$echo 'This program posts news to many machines throughout the city.'
--- 262,268 ----
$echo 'This program posts news to many machines throughout the country.'
;;
$state.*)
! $echo "This program posts news to many machines throughout the $stpr."
;;
$city.*)
$echo 'This program posts news to many machines throughout the city.'
***************
*** 475,481 ****
case "$tryinews" in
yes)
if $sed '1,/^[ ]*$/{/^[A-Z][-A-Za-z0-9]*:[ ]*$/d;}' $tmpart |
! $inews -h ; then
: null
else
state=rescue
--- 481,487 ----
case "$tryinews" in
yes)
if $sed '1,/^[ ]*$/{/^[A-Z][-A-Za-z0-9]*:[ ]*$/d;}' $tmpart |
! $inews -h $inewsopts ; then
: null
else
state=rescue
***************
*** 663,668 ****
--- 669,694 ----
;;
esac
+ summary=h
+ while $test "$summary" = h ; do
+ $echo ""
+ $echo $n "Summary: $c"
+ read summary
+ case "$summary" in
+ h)
+ $cat <<'EOH'
+
+ Type the summary for your article. If you are following up to an article,
+ it is better to write an informative summary line than to change the subject
+ line, which will break threaded readers. Please make it as informative as
+ possible (within reason) so that people who aren't interested won't have to
+ read the article to find out they aren't interested. This includes marking
+ movie spoilers as (spoiler), and rotated jokes as (rot 13).
+ EOH
+ ;;
+ esac
+ done
+
# now build a file with a header for them to edit
set X ${USER-${LOGNAME-`who am i`}}
***************
*** 691,700 ****
;;
usg)
if $test "$ypmatch" != ""; then
! fullname=`$ypmatch $logname passwd 2>/dev/null | $sed -e "s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^(:]*\).*"'$'"/\1/" -e "s/^.*-//" -e "q"`
fi
if $test "$fullname" = ""; then
! fullname=`$sed </etc/passwd -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^(:]*\).*"'$'"/\1/" -e "s/^.*-//" -e "q" -e "}" -e "d"`
fi
;;
*)
--- 717,726 ----
;;
usg)
if $test "$ypmatch" != ""; then
! fullname=`$ypmatch $logname passwd 2>/dev/null | $sed -e "s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^(,:;]*\).*"'$'"/\1/" -e "s/^.*-//" -e "q"`
fi
if $test "$fullname" = ""; then
! fullname=`$sed </etc/passwd -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^(,:;]*\).*"'$'"/\1/" -e "s/^.*-//" -e "q" -e "}" -e "d"`
fi
;;
*)
***************
*** 707,716 ****
/*) orgname=`$cat $orgname` ;;
esac
! $sed -e '/^Reply-To: $/d' > $tmpart <<EOHeader
Newsgroups: $ng
Subject: $title
! Summary:
Reply-To: $REPLYTO
Followup-To: $follow
Distribution: $dist
--- 733,743 ----
/*) orgname=`$cat $orgname` ;;
esac
! if $test "$dist" != ""; then
! $sed -e '/^Reply-To: $/d' > $tmpart <<EOHeader
Newsgroups: $ng
Subject: $title
! Summary: $summary
Reply-To: $REPLYTO
Followup-To: $follow
Distribution: $dist
***************
*** 718,723 ****
--- 745,764 ----
Keywords:
EOHeader
+
+ else
+ $sed -e '/^Reply-To: $/d' > $tmpart <<EOHeader
+ Newsgroups: $ng
+ Subject: $title
+ Summary: $summary
+ Reply-To: $REPLYTO
+ Followup-To: $follow
+ Organization: $orgname
+ Keywords:
+
+ EOHeader
+
+ fi
!NO!SUBS!
case "$isrrn" in
--
Greg A. Woods
woods@robohack.UUCP woods@Elegant.COM VE3TCP UniForum Canada & ECI
+1 416 443-1734 [home] +1 416 595-5425 [work] Toronto, Ontario; CANADA
Technical Details
Message-ID:
<1992Jun3.041416.24631@robohack.UUCP>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.sources.bugs.mbox.zip!sparky!uunet!uunet.ca!geac!torag!robohack!woodsReferences:
<1992May31.054819.8005@cas.org>Show Full Headers
Complete Article Headers
Message-ID: <1992Jun3.041416.24631@robohack.UUCP> Subject: Re: Alternate Pnews files? Date: Wed, 03 Jun 1992 04:14:16 +0000 From: woods@robohack.UUCP (Greg A. Woods) References: <1992May31.054819.8005@cas.org> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.sources.bugs.mbox.zip!sparky!uunet!uunet.ca!geac!torag!robohack!woods Newsgroups: news.software.readers,comp.sources.bugs,alt.sources.patches Organization: Elegant Communications Inc. Followup-To: news.software.readers Summary: fixes and support for this "Summary:" header Lines: 265