[news.admin] Return of Son of Beneath The Planet Of report_awk updates & bugfix :-)

earle@smeagol.UUCP (03/04/87)

Well, my first two attempts to put this out cost Larry Wall much sleep and
agravated him to the point of issuing Yet Another `Patch' Patch (YAPP)  :-(

My first attempt had a mangled patch in it (sorry, Larry) and the second one
I generated via `diff -l -cb', and vanilla no-options `patch' positively
despises `-b' diffs.  Thus, once more, for the absolute last time (promise),
here is the `diff -l -c' version of my updates and bug fix for the report_awk
script that was posted to mod.sources as part of Erik Fair's Usenet Toolbox
(Volume 7, Issue 36 - article 511@mirror.UUCP; also distributed with 2.11
Netnews as `misc/report.awk').  Sigh ...

-----------------------------  >8 Cut Here 8< ------------------------------
diff -l -c report_awk.dist report_awk
*** report_awk.dist	Wed Jan 28 23:38:01 1987
--- report_awk	Tue Mar  3 23:18:42 1987
***************
*** 2,8 ****
  #  AWK script which eats netnews log files and produces a summary of USENET
  #  traffic and errors over the period of time that the log was collected.
  #
! #  August 31, 1986
  #
  #  Erik E. Fair <dual!fair>
  #  Original Author, May 22, 1984
--- 2,8 ----
  #  AWK script which eats netnews log files and produces a summary of USENET
  #  traffic and errors over the period of time that the log was collected.
  #
! #  January 28, 1987
  #
  #  Erik E. Fair <dual!fair>
  #  Original Author, May 22, 1984
***************
*** 37,42 ****
--- 37,63 ----
  #  Fix up the counting of gatewayed material, add counting of "linecount"
  #  problems. Additional cleanup to make things faster.
  #
+ #  Greg Earle <smeagol!earle>
+ #  Add support for added features of 2.11 that didn't make it into the
+ #  released version.  These include:
+ #  - Field 5 = "Expired" when a control cancel invocation tries to 
+ #    cancel an already expired article.  Added new variable to count
+ #    these, and are displayed in `Control Invocations' area.
+ #    Field 5 = "UNKNOWN" when a control message comes in from the outside
+ #    world that is not one of the valid control messages (e.g., `sendsys').
+ #    Added new variable to count, and display in Control Invocations area.
+ #  - Field 5 = "Aliased", [when aliases for converting old group to new]
+ #    Field 5 = "Unrecognized" [when user tried to post bad control message]
+ #    Field 6 = "mailed",  [when article for moderated group is mailed]
+ #    Field 5 = "queued":  [when SPOOLNEWS is defined, and articles queued]
+ #    These are ignored (added to `Skip some things we won't bother with' area)
+ #  - Field 7 = "Unknown" when a bad newsgroup.  Netnews version 2.10.2 had
+ #    newsgroup name in single quotes, thus bad newsgroup names were
+ #    being stored after stripping first and last characters.  2.11 does not
+ #    use quotes around newsgroup name, so added a check to see if single
+ #    quoted or not.  If not quoted, assumes 2.11.  If quoted assumes 2.10.2.
+ #    Handles both cases.
+ #    All other messages are errors of some type, and are not processed.
  BEGIN{
  #
  #	this is the prefix that your site uses in hostnames to identify your
***************
*** 103,108 ****
--- 124,131 ----
  	lcount  = 0;
  	canfail = 0;
  	candup  = 0;
+ 	canexp	= 0;
+ 	canunk	= 0;
  	insfail = 0;
  	old     = 0;
  }
***************
*** 113,122 ****
--- 136,151 ----
  $5 == "from"			{ next }
  $5 == "make"			{ next }
  $5 == "Cancelling"		{ next }
+ $5 == "Aliased"			{ next }
+ $5 == "queued"			{ next }
+ $5 == "Unrecognized"		{ next }
+ $6 == "mailed"			{ next }
  #
  #	Or that we just count
  #
  $5 == "Inbound"			{ garbled++; next }
+ $5 == "Expired"			{ canexp++; next }
+ $5 == "UNKNOWN"			{ canunk++; next }
  $6 == "cancel"			{ canfail++; next }
  $6 == "Cancelled"		{ candup++; next }
  $6 == "install"			{ insfail++; next }
***************
*** 196,203 ****
  $6 == "valid"		{ junked[sys]++; next }
  $6 == "too"		{ junked[sys]++; old++; next }
  $5 == "Unknown"		{
! 	x = length($7) - 2;
! 	ng = substr($7, 2, x);
  	badng[ng]++;
  	badgrp++;
  	next;
--- 225,239 ----
  $6 == "valid"		{ junked[sys]++; next }
  $6 == "too"		{ junked[sys]++; old++; next }
  $5 == "Unknown"		{
! #
! #	Next line is OK if 2.11.  If 2.10.2 (& 2.10.3 ?) then
! #	we have to strip off the single quotes around the newsgroup name.
! #
! 	ng = $7;
! 	if (index(ng, "'") != 0) {
! 		x = length($7) - 2;
! 		ng = substr($7, 2, x);
! 	}
  	badng[ng]++;
  	badgrp++;
  	next;
***************
*** 354,359 ****
--- 390,397 ----
  				printf("%-12s %6d", i, ctlcnt[i]);
  				if (canfail) printf(", %d failed", canfail);
  				if (candup) printf(", %d duplicate", candup);
+ 				if (canexp) printf(", %d had expired", canexp);
+ 				if (canunk) printf(", %d unknown type", canunk);
  				printf("\n");
  			} else {
  				printf("%-12s %6d\n", i, ctlcnt[i]);
-- 
	Greg Earle	UUCP: sdcrdcf!smeagol!earle; attmail!earle
	JPL		ARPA: elroy!smeagol!earle@csvax.caltech.edu
AT&T: +1 818 354 4034	      earle@jplpub1.jpl.nasa.gov (For the daring)
Is this an out-take from the ``BRADY BUNCH''?