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

📄 newgroup

📁 早期freebsd实现
💻
字号:
#! /bin/sh##  $Revision: 1.20 $##  Newgroup control-message handlerPROG=newgroup##  Some shells don't pass in $* unless we explicitly pass it in here.##  =()<. @<_PATH_PARSECTL>@ "$@">()=. /var/spool/news/data/parsecontrol "$@"##  Valid parameters and group name?case "$#" in1|2)    ;;*)    ${WRITELOG} ${LOGFILE} "Unparseable newgroup by ${FROM}" <${ARTICLE}    exit    ;;esaccase "$1" in*[\ \	/:]*)    ${WRITELOG} ${LOGFILE} "Unsafe newgroup by ${FROM}" <${ARTICLE}    exit    ;;esac##  Make sure article is approved.${SED} -e '/^$/q' <${ARTICLE} >${TEMP}grep '^Approved:' <${TEMP} >/dev/null 2>&1 || {    rm -f ${TEMP}    ${WRITELOG} ${LOGFILE} "Unapproved newgroup by ${FROM}" <${ARTICLE}    exit}rm -f ${TEMP}case "$2" in[Mm]*)    set $1 m    ;;*)    set $1 y    ;;esac##  Kill the chefs; from <wesommer@athena.mit.edu>.##  That is, turn "alt.foo.bar.bar.bar" into an "x" group.#case `echo $1 | awk -F. '{#	if (NF > 1 && $NF != "misc") {#	    if (NF > 5 || $NF == $(NF - 1) || $(NF - 1) == $(NF - 2)) {#		print "bozo";#	    }#	}#    }'` in#bozo*)#      set $1 x#      ;;#esac##  Compare group against active file.SUFFIX=""LINE=`grep "^$1 " <${ACTIVE} 2>/dev/null`case "${LINE}" in"")    ##  New group.    WORD=created    ;;"$1 "*" $2")    ##  Exact match; ignore it.    exit    ;;"$1 "*" ="*|"$1 "*" x"|"$1 "*" j")    ${WRITELOG} ${LOGFILE} "Rejected special newsgroup ($1) by ${FROM}" \	    <${ARTICLE}    exit    ;;*)    case "$2" in    m)	WORD="made moderated"	SUFFIX=" (Moderated)"	;;    y)	WORD="made unmoderated"	;;    esac    ;;esaccase ${ACTION} inmail)    P1=$1    P2=$2    export FROM WORD NEWSBIN P1 P2 ARTICLE    (	echo "${FROM} requested that $1 be ${WORD}."	echo 'To do this, type the following:'	echo "	${NEWSBIN}/ctlinnd newgroup ${P1} ${P2} ${FROM}"	echo ''	echo 'The original article was:'	cat ${ARTICLE}    ) | ${WRITELOG} ${LOGFILE} "newgroup $1 $2 ${FROM}"    exit    ;;logit)    ${WRITELOG} ${LOGFILE} "skipping newgroup $1 $2 ${FROM} (would be ${WORD})" \	<${ARTICLE}    exit    ;;esac##  Do the work.ctlinnd -s newgroup $1 $2 "${FROM}"${WRITELOG} ${LOGFILE} "newgroup $1 $2 ${WORD} ${FROM}" <${ARTICLE}##  Get a description of the newsgroup; first from the article, and##  then from the newsgroups file.DESC=`${SED} <${ARTICLE} -n -e ":top/^For your newsgroups file:\$/b scannb top:scann/$1[ 	]/ {pq}b scan"`test -z "${DESC}" && {    DESC=`${EGREP} "^$1	" ${NEWSGROUPS} | ${SED} "s/[ 	]*(Moderated)//"`    test -z "${DESC}" && DESC="$1	?"}DESC="${DESC}${SUFFIX}"##  Lock so we can update newsgroupsLOCK=${LOCKS}/LOCK.newsgroupsPID=$$TRY=0MAXTRY=60export LOCK MAXTRY PID LOGFILE TRYwhile [ ${TRY} -lt ${MAXTRY} ]; do    shlock -p ${PID} -f ${LOCK} && break    sleep 2    TRY=`expr ${TRY} + 1`done##  If we got the lock, update the file; otherwise, give up.test ${TRY} -lt ${MAXTRY} || {    echo "Newgroup cannot update newsgroups.  Locked by" `cat ${LOCK}` 1>&2    exit}${EGREP} -v "^$1[	]" <${NEWSGROUPS} >${TEMP}cat ${TEMP} >${NEWSGROUPS}echo "${DESC}" >>${NEWSGROUPS}rm ${TEMP} ${LOCK}exit

⌨️ 快捷键说明

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