⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pnews.sh

📁 早期freebsd实现
💻 SH
📖 第 1 页 / 共 2 页
字号:
case $CONFIG in    '') . ./config.sh ;;esacecho "Extracting Pnews (with variable substitutions)"$spitshell >Pnews <<!GROK!THIS!$startsh# $Id: Pnews.SH,v 3.0 1992/02/23 21:25:39 davison Trn $# # This software is Copyright 1991 by Stan Barber. ## Permission is hereby granted to copy, reproduce, redistribute or otherwise# use this software as long as: there is no monetary profit gained# specifically from the use or reproduction of this software, it is not# sold, rented, traded or otherwise marketed, and this copyright notice is# included prominently in any copy made. ## The author make no claims as to the fitness or correctness of this software# for any use whatsoever, and it is provided as is. Any use of this software# is at the user's own risk. ## syntax: Pnews -h headerfile			or#	  Pnews -h headerfile oldarticle	or#         Pnews newsgroup title			or just#         Pnewsexport PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)# System dependenciesmailer="${mailer-/bin/mail}"# if you change this to something that does signatures, take out signature codecase $d_portable indefine)    # where recordings, distributions and moderators are kept    lib=\`$filexp $newslib\`    # where important rn things are kept    rnlib=\`$filexp $privlib\`    ;;undef)    # where recordings, distributions and moderators are kept    lib="$newslib"    # where important rn things are kept    rnlib="$privlib"    ;;esac# your organization nameorgname="$orgname"# what pager you use--if you have kernal paging use catpager="\${PAGER-$pager}"# how you derive full names, bsd, usg, or othernametype="$nametype"# default editordefeditor="$defeditor"# how not to echo with newlinen="$n"c="$c"# You should also look at the distribution warnings below marked !DIST!# to make sure any distribution regions you are a member of are included.# The following are some prototypical distribution groups.  If you do not# use them all set the unused ones to a non-null string such as 'none'.loc="$locdist"org="$orgdist"multistate="$multistatedist"city="$citydist"state="$statedist"cntry="$cntrydist"cont="$contdist"test=${test-test}sed=${sed-sed}echo=${echo-echo}cat=${cat-cat}egrep=${egrep-egrep}grep=${grep-grep}tr=${tr-tr}inews=${inewsloc-inews}nidump=${nidump}ypmatch=${ypmatch}!GROK!THIS!case "$ignoreorg" indefine) $spitshell >>Pnews <<'!NO!SUBS!'orgname=${NEWSORG-$orgname}!NO!SUBS!	;;*)	$spitshell >>Pnews <<'!NO!SUBS!'orgname=${NEWSORG-${ORGANIZATION-$orgname}}!NO!SUBS!	;;esac$spitshell >>Pnews <<'!NO!SUBS!'dotdir=${DOTDIR-${HOME-$LOGDIR}}tmpart=$dotdir/.articleartcheck=$rnlib/artcheckspeller=$rnlib/Spellerif $test -f $dotdir/.pnewsexpert; then    expertise=expertelse    $cat <<'EOM'I see you've never used this version of Pnews before.  I will give you extrahelp this first time through, but then you must remember what you learned.If you don't understand any question, type h and a CR (carriage return) forhelp.If you've never posted an article to the net before, it is HIGHLY recommendedthat you read the netiquette document found in news.announce.newusers sothat you'll know to avoid the commonest blunders.  To do that, interruptPnews, get to the top-level prompt of [t]rn, and use the command"g news.announce.newusers" to go to that group.EOM    expertise=beginnerficase $cntry in  can) Stpr=Province ; stpr=province ;;  *)   Stpr=State ; stpr=state ;;esaccase $multistate in  pnw) multistpr="Pacific NorthWest" ;;  *)   multistpr="Multi-State Area" ;;esacheaderfile=""case $# in0) ;;*)  case $1 in    -h)	headerfile="$2"	shift	shift	case $# in	0)	    oldart=""	    ;;	*)	    oldart="$1"	    shift	    ;;	esac	;;    esac    ;;esaccase $headerfile in'')    . $rnlib/Pnews.header    ;;*)    $cat < $headerfile  > $tmpart    ;;esac    rescue="sleep 1; $cat $tmpart >>${HOME-$LOGDIR}/dead.article ; $echo Article appended to ${HOME-$LOGDIR}/dead.article ; exit"    trap "$rescue" 1    trap "$rescue" 2$echo ""# extract the newsgroups list and distributionhdr_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.  Allow erroneous user@site too.flag=0for ng in $hdr_newsgroups ; do    case "$ng" in	poster)	flag=1 ;;	*@*) flag=1 ;;	*)	;;    esacdonecase $flag in1)    $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  # play recorded messageif $test -s ${lib}/recording ; then     for ng in $hdr_newsgroups ; do	_rec1=${lib}/`$sed -n "/^$ng/s/^.*	//p" ${lib}/recording`	_tmp=`$echo $ng |$sed "s/\..*//"`	_rec2=${lib}/`$cat -s ${lib}/recording|$grep ${_tmp}.all|$sed "s/^.*	//"`	if $test -f ${_rec1} ; then	    $cat -s ${_rec1}	fi	if $test -f ${_rec2} ; then	    $cat -s ${_rec2}	fi    donefi# determine the distribution of this messageset X $hdr_distributionshiftif $test $# -gt 0 ; then    dist=$1.whateverelse    set X $hdr_newsgroups    shift    if $test $# -gt 0 ; then	dist=$1.whatever    else	dist=misc.whatever    fificase $dist in*.*)    ;;*)    dist=$dist.whatever    ;;esac# tell them what we think they are doing... !DIST!case $dist inworld.*|comp.*|news.*|sci.*|rec.*|misc.*|soc.*|talk.*|alt.*|'')    $cat <<'EOM'This program posts news to thousands of machines throughout the entirecivilized world.  Your message will cost the net hundreds if not thousands ofdollars to send everywhere.  Please be sure you know what you are doing.EOM    ;;vmsnet.*)    $echo 'This program posts news to many machines.'    ;;bit.*)    $echo 'This program posts news to many machines on BITNET.'    ;;ddn.*)    $echo 'This program posts news to many machines throughout the internet.'    ;;$cont.*)    $echo 'This program posts news to many machines throughout the continent.'    ;;$cntry.*)    $echo 'This program posts news to many machines throughout the country.'    ;;$multistate.*)    $echo "This program posts news to many machines throughout the ${multistpr}."    ;;$state.*)    $echo "This program posts news to many machines throughout the ${stpr}."    ;;$city.*)    $echo 'This program posts news to many machines throughout the city.'    ;;$org.*)    $echo 'This program posts news to machines throughout the organization.'    ;;$loc.*)    $echo 'This program posts news to machines throughout the local organization.'    ;;*.*)    $echo 'This program may post news to many machines.'    ;;to.*)    $echo 'This program may post news to a particular machine.'    ;;*)    $echo 'This program posts news to everyone on the machine.'    ;;esacans=""while $test "$ans" = "" ; do    $echo $n "Are you absolutely sure that you want to do this? [ny] $c"    read ans    case $ans in    y*) ;;    f*) ;;    h*) $cat <<'EOH'Type n or CR to exit, y to post.EOH	ans="" ;;    *) exit ;;    esacdonefile=hwhile $test "$file" = h ; do    $echo ""    $echo $n "Prepared file to include [none]: $c"    read file    case $file in    h)	$cat <<'EOH'If you have already produced the body of your article, type the filenamefor it here.  If you just want to proceed directly to the editor, type aRETURN.  In any event, you will be allowed to edit as many times as youwant before you send off the article.EOH	;;    '')	$echo "" >> $tmpart	state=edit	;;    *)	$cat $file >>$tmpart	state=check	;;    esacdone$echo ""while true ; do    case $state in    edit)	case $expertise in	beginner)	    $cat </dev/null >$dotdir/.pnewsexpert	    $cat <<'EOMessage'A temporary file has been created for you to edit.  Be sure to leave atleast one blank line between the header and the body of your message.(And until a certain bug is fixed all over the net, don't start the body ofyour message with any indentation, or it may get eaten.)Within the header may be fields that you don't understand.  If you don'tunderstand a field (or even if you do), you can simply leave it blank, andit will go away when the article is posted.Type return to get the default editor, or type the name of your favoriteeditor.EOMessage	    ;;	esac	case "${VISUAL-${EDITOR-}}" in	'')	    tmp=h	    ;;	*)	    tmp=''	    ;;	esac	while $test "$tmp" = h ; do	    $echo $n "Editor [${VISUAL-${EDITOR-$defeditor}}]: $c"	    read tmp	    case $tmp in	    h)		$cat <<'EOH'Type a return to get the default editor, or type the name of the editor youprefer.  The default editor depends on the VISUAL and EDITOR environmentvariables.EOH		;;	    '')		;;	    *)		VISUAL=$tmp		export VISUAL		;;	    esac	done	trap : 2	${VISUAL-${EDITOR-$defeditor}} $tmpart $oldart	trap "$rescue" 2	state=check	;;	    check)	# warn about long lines, malformed headers, misspelled newsgroups	$artcheck $tmpart 79 $lib/newsgroups	state=ask

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -