📄 pnews.sh
字号:
;; ask) $echo "" $echo $n "Check spelling, Send, Abort, Edit, or List? $c" read ans case "$ans" in a*) state=rescue ;; e*) set $ans case $# in 2) VISUAL="$2" ;; esac state=edit ;; l*) $pager $tmpart state=ask ;; s*) state=send ;; c*) $speller $tmpart state=ask ;; h*) $cat <<'EOH'Type c to check the article's spelling, s to send the article, a to abortand append the article to dead.article, e to edit the article again, or lto list the article with your pager.To invoke an alternate editor, type 'e editor'.EOH esac ;; send) set X `$sed < $tmpart -n -e '/^Newsgroups: /{' -e p -e q -e '}'` shift case $# in 2) state=cleanup if $test -f $lib/moderators; then tryinews=no shift case "$1" in *,*) set `$echo $1 | tr ',' ' '`;; esac for newsgroup in $*; do# the following screwy sed should prevent Eunice from hanging on no match moderator=`$sed <$lib/moderators \ -e "/^$newsgroup[ ]/!s/.*//" \ -e "s/^$newsgroup[ ]//"` case ${moderator}X in X) tryinews=yes ;; *) $echo Mailing to moderator $moderator case "$sign" in n*) ;; *) if $test -f $dotdir/.signature; then $echo $n "Append .signature file? [y] $c" read ans case $ans in ''|y*) $echo "-- " >> $tmpart $cat $dotdir/.signature >> $tmpart ;; esac fi sign=no ;; esac case "$mailer" in *recmail) $echo To: $moderator | $cat - $tmpart | $mailer ;; *) $mailer $moderator < $tmpart ;; esac case $? in 0) ;; *) $echo Unable to mail to moderator $moderator state=rescue ;; esac ;; esac done else tryinews=yes fi case "$tryinews" in yes) if $sed '1,/^[ ]*$/{/^[A-Z][-A-Za-z0-9]*:[ ]*$/d; /^X-ORIGINAL-NEWSGROUPS:.*$/d; /^[Cc][Cc]:/d;}' $tmpart | $inews -h ; then : null else state=rescue fi cc=`$sed -n '1,/^[ ]*$/{/^[Cc][Cc]:[ ][^ ]/p;}' $tmpart| $sed 's/^[Cc][Cc]:[ ][ ]*//'` if $test "$cc " != " " ; then set -- $cc case "$mailer" in *recmail) $echo To: $cc | $cat - $tmpart | $mailer ;; *) set -- `echo $cc | sed 's/,/ /g'` $mailer $@ < $tmpart ;; esac fi ;; esac ;; *) $echo "" $echo "Malformed Newsgroups line." $echo "" sleep 1 state=edit ;; esac ;; rescue) if $test -s $tmpart; then $cat $tmpart >> ${HOME-$LOGDIR}/dead.article $echo "Article appended to ${HOME-$LOGDIR}/dead.article" $echo "A copy may be temporarily found in $tmpart" else $echo "Null article discarded." fi exit ;; cleanup) case "${AUTHORCOPY-none}" in none) ;; *) set X ${USER-${LOGNAME-`who am i`}} unknown shift $rnlib/mbox.saver $tmpart "." "." 0 0 Pnews $AUTHORCOPY "From $1 `LANG= date`" if $test $? -eq 0 ; then $echo "Article appended to $AUTHORCOPY" else $echo "Cannot append to $AUTHORCOPY" fi ;; esac exit ;; esacdone!NO!SUBS!$eunicefix Pnewschmod 755 Pnews$spitshell >Pnews.header <<'!NO!SUBS!'case $# in0) ng=h while $test "$ng" = h ; do $echo "" $echo $n "Newsgroup(s): $c" read ng case $ng in h) $cat <<'EOH'Type the name of one or more newsgroups to which you wish to post an article.If you want to post to multiple newsgroups, it is better to do them all atonce than to post to each newsgroup individually, which defeats the newsreading programs' strategies of eliminating duplicates.Separate multiple newsgroup names with commas.EOH ;; esac done ;;*) ng=$1 shift ;;esaccase $ng in*\ *) ng=`$echo "$ng" | $sed 's/[, ] */,/g'` ;;esaccase $ng inddn.*) defdist=inet dist=h ;;*.*) defdist='' dist=h ;;*) defdist='' dist='' ;;esacwhile $test "$dist" = h ; do if $test -f $lib/distributions; then $echo " " $echo "Your local distribution prefixes are:" $cat $lib/distributions $echo " " else $egrep -v '[ ]none$' <<EOMYour local distribution prefixes are: Local organization: $loc Organization: $org City: $city $Stpr: $state $multistpr: $multistate Country: $cntry Continent: $cont Everywhere: <null> (not "world")EOM fi $echo $n "Distribution ($defdist): $c" read dist case $dist in '') dist="$defdist" ;; esac case "$dist" in h) $cat <<'EOH'The Distribution line may be used to limit the distribution of an articleto some subset of the systems that would receive the article based only onthe Newsgroups line. For example, if you want to sell your car in talk.auto,and you live in New Jersey, you might want to put "nj" on the Distributionline to avoid advertising in California, which has enough problems of its own.The actual area designators to use depend on where you are, of course.EOH ;; world*|comp*|news*|sci*|rec*|misc*|soc*|talk*|alt*) dist='' ;; ''|$loc|$org|$city|$state|$multistate|$cntry|$cont|$defdist) ;; *) if $test -f $lib/distributions && \ $egrep "^$dist[ ]" $lib/distributions >$tmpart && \ $test -s $tmpart; then : null else $echo "Unrecognized distribution prefix--type h for help, CR to use anyway." defdist=$dist dist=h fi ;; esacdonefollow=""# LCP 16-Oct-91 Subject line is required. Make it a little more# difficult to omit. Added "while : ; do", ... "done", and "if"# at end of while loop.while :do case $# in 0) title=h while $test "$title" = h ; do $echo "" $echo $n "Title/Subject: $c" read title case $title in h) $cat <<'EOH'Type the title for your article. Please make it as informative as possible(within reason) so that people who aren't interested won't have to read thearticle to find out they aren't interested. This includes marking moviespoilers as (spoiler), and rotated jokes as (rot 13).EOH ;; esac done ;; *) title="$*" # LCP 16-Oct-91 Added "set" and "shift". Must insure $# is 0 # in case the title is all white space and we make another # pass thru this loop. set X shift ;; esac if expr "X$title" : "^X[ ]*$" > /dev/null 2>&1 then $cat <<'EOH'Articles without a "Subject:" line will not be accepted by the Newssystem. Please give a Title/Subject line for your article.EOH else break fidone# now build a file with a header for them to editset X ${USER-${LOGNAME-`who am i`}}shiftlogname=$1case $logname in*!*) logname=`expr "$logname" : '!\(.*\)$'` ;;esaccase ${NAME-$nametype} inbsd) if $test "$ypmatch" != ""; then fullname=`$ypmatch $logname passwd 2>/dev/null | $sed -e "s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^,:;]*\).*"'$'"/\1/"` elif $test "$nidump" != ""; then fullname=`$nidump passwd / | $sed -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^,:;]*\).*"'$'"/\1/" -e "q" -e "}" -e "d"` fi if $test "$fullname" = ""; then fullname=`$sed </etc/passwd -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^,:;]*\).*"'$'"/\1/" -e "q" -e "}" -e "d"` fi case $fullname in *'&'*) : GACK lname=`$echo $logname | $tr 'a-z' 'A-Z'` lname=`$echo $lname $logname | $sed 's/^\(.\)[^ ]* ./\1/'` fullname=`$echo "$fullname" | $sed "s/&/${lname}/"` ;; esac ;;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 ;;*) fullname=${NAME-`$cat $dotdir/.fullname`} ;;esaccase $orgname in/*) orgname=`$cat $orgname` ;;esac$sed -e '/^Reply-To: $/d' > $tmpart <<EOHeaderNewsgroups: $ngSubject: $titleSummary: Reply-To: $REPLYTOFollowup-To: $followDistribution: $distOrganization: $orgnameKeywords: Cc: EOHeader!NO!SUBS!case "$d_nntp" indefine) sed < Pnews.header -e '/^#NORMAL/d' > Pnews.h.new ;;*) sed < Pnews.header -e '/^#NORMAL/s/^#NORMAL//' > Pnews.h.new ;;esacmv Pnews.h.new Pnews.header$eunicefix Pnews.header
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -