2 # fixscript will replace this line with code to load innshellvars
5 ## Script to execute checkgroups text; results to stdout.
9 cat /dev/null >${T}/$$out
11 ## Copy the article without headers, append local newsgroups.
13 test -f ${LOCALGROUPS} && cat ${LOCALGROUPS} >>${T}/$$msg
15 ## Get the top-level newsgroup names from the message and turn it into
17 PATS=`${SED} <${T}/$$msg \
18 -e 's/[ ].*//' -e 's/\..*//' \
19 -e 's/^!//' -e '/^$/d' \
20 -e 's/^/^/' -e 's/$/[. ]/' \
22 | (tr '\012' '|' ; echo '' )\
25 ${EGREP} "${PATS}" ${ACTIVE} | ${EGREP} "${1:-.}" | ${SED} 's/ .*//' | sort >${T}/$$active
26 ${EGREP} "${PATS}" ${T}/$$msg | ${EGREP} "${1:-.}" | ${SED} 's/[ ].*//' | sort >${T}/$$newsgrps
28 comm -13 ${T}/$$active ${T}/$$newsgrps >${T}/$$missing
29 comm -23 ${T}/$$active ${T}/$$newsgrps >${T}/$$remove
31 ${EGREP} "${PATS}" ${ACTIVE} | ${EGREP} "${1:-.}" | ${SED} -n '/ m$/s/ .*//p' | sort >${T}/$$amod.all
32 ${EGREP} "${PATS}" ${T}/$$msg | ${EGREP} "${1:-.}" | ${SED} 's/\r\?$//' |
33 ${SED} -n '/(Moderated)$/s/[ ].*//p' | sort >${T}/$$ng.mod
35 comm -12 ${T}/$$missing ${T}/$$ng.mod >${T}/$$add.mod
36 comm -23 ${T}/$$missing ${T}/$$ng.mod >${T}/$$add.unmod
37 cat ${T}/$$add.mod ${T}/$$add.unmod >>${T}/$$add
39 comm -23 ${T}/$$amod.all ${T}/$$remove >${T}/$$amod
40 comm -13 ${T}/$$ng.mod ${T}/$$amod >${T}/$$ismod
41 comm -23 ${T}/$$ng.mod ${T}/$$amod >${T}/$$nm.all
42 comm -23 ${T}/$$nm.all ${T}/$$add >${T}/$$notmod
44 ${EGREP} "${PATS}" ${NEWSGROUPS} | ${EGREP} "${1:-.}" | ${SED} 's/[ ]\+/ /' | sort >${T}/$$localdesc
45 ${EGREP} "${PATS}" ${T}/$$msg | ${EGREP} "${1:-.}" | ${SED} 's/\r\?$//' |
46 ${SED} 's/[ ]\+/ /' | sort >${T}/$$newdesc
48 if ! (head -1 ${T}/$$newdesc | egrep " [[:digit:]]+ [[:digit:]]+ " > /dev/null) ; then
49 comm -13 ${T}/$$localdesc ${T}/$$newdesc >${T}/$$missingdesc
50 comm -23 ${T}/$$localdesc ${T}/$$newdesc >${T}/$$removedesc
53 if [ -s ${T}/$$remove ] ; then
55 echo "# The following newsgroups are non-standard."
56 ${SED} "s/^/# /" ${T}/$$remove
57 echo "# You can remove them by executing the commands:"
58 for i in `cat ${T}/$$remove` ; do
59 echo " ${PATHBIN}/ctlinnd rmgroup $i"
60 ${EGREP} "^$i " ${NEWSGROUPS} >>${T}/$$ngdel
66 if [ -s ${T}/$$add ] ; then
68 echo "# The following newsgroups were missing and should be added."
69 ${SED} "s/^/# /" ${T}/$$add
70 echo "# You can do this by executing the command(s):"
71 for i in `cat ${T}/$$add.unmod` ; do
72 echo " ${PATHBIN}/ctlinnd newgroup $i y ${FROM}"
73 ${EGREP} "^$i " ${T}/$$msg >>${T}/$$ngadd
75 for i in `cat ${T}/$$add.mod` ; do
76 echo " ${PATHBIN}/ctlinnd newgroup $i m ${FROM}"
77 ${EGREP} "^$i " ${T}/$$msg >>${T}/$$ngadd
83 if [ -s ${T}/$$ismod ] ; then
85 echo "# The following groups are incorrectly marked as moderated:"
86 ${SED} "s/^/# /" ${T}/$$ismod
87 echo "# You can correct this by executing the following:"
88 for i in `cat ${T}/$$ismod` ; do
89 echo " ${PATHBIN}/ctlinnd changegroup $i y"
90 ${EGREP} "^$i " ${T}/$$msg >>${T}/$$ngchng
96 if [ -s ${T}/$$notmod ] ; then
98 echo "# The following groups are incorrectly marked as unmoderated:"
99 ${SED} "s/^/# /" ${T}/$$notmod
100 echo "# You can correct this by executing the following:"
101 for i in `cat ${T}/$$notmod` ;do
102 echo " ${PATHBIN}/ctlinnd changegroup $i m"
103 ${EGREP} "^$i " ${T}/$$msg >>${T}/$$ngchng
109 if [ -s ${T}/$$removedesc ] ; then
111 echo "# The following newsgroups descriptions are obsolete."
112 ${SED} "s/^/# /" ${T}/$$removedesc
113 echo "# You can remove them by editing ${NEWSGROUPS}."
118 if [ -s ${T}/$$missingdesc ] ; then
120 echo "# The following newsgroups descriptions were missing and should be added."
121 ${SED} "s/^/# /" ${T}/$$missingdesc
122 echo "# You can add them by editing ${NEWSGROUPS}."
128 test -s ${T}/$$out && {
130 echo 'exit # so you can feed this message into the shell'
131 echo "# And remember to update ${NEWSGROUPS}."
132 test -s ${T}/$$ngdel && {
133 echo "# Remove these lines:"
134 ${SED} "s/^/# /" ${T}/$$ngdel
137 test -s ${T}/$$ngadd && {
138 echo "# Add these lines:"
139 ${SED} "s/^/# /" ${T}/$$ngadd
142 test -s ${T}/$$ngchng && {
143 echo "# Change these lines:"
144 ${SED} "s/^/# /" ${T}/$$ngchng