nestor patch #01 (medium priority) Part 01/01

Edwin Kremer edwin at cs.ruu.nl
Tue Jun 4 00:05:31 AEST 1991


Here is a SHARred medium-priority patch for the ``nestor'' program.   It
fixes a couple of bugs and adds the file "Changes" that will help you to
keep track of the changes I make.

	*** Please read the note on archiving in the README file ***

  If you are currently using nestor 1.0PL0 (`nestor -V' will tell  you),
please  apply  this  patch  to  upgrade to the 1.0PL1 version. If you're
unfamiliar with nestor, I encourage you to read  the  announcement  that
appeared  in  newsgroup  "comp.archives"  on  May  25, 1991 (Message-Id:
<1991May25.011650.4139 at ox.com>) and to pickup a complete 1.0PL1  release
from our archive -- see details below.

		hope you like it,
						--[ Edwin ]--


  We, Computer Science department, Utrecht University,  are  running  an
anonymous  FTP  server  on  one  of  our systems. In addition to the FTP
service we're also running a mail server, because we *know* how you feel
when  there's  plenty of beautiful software around that you can't reach.
We've been in that situation for a long long time...


--> How to get 'nestor' via anonymous FTP:

	Site:		archive.cs.ruu.nl  [131.211.80.5]
	Login:		"anonymous" or "ftp"
	Password:	your own email address (you at your_domain)
	File:		UNIX/nestor.tar.Z


--> How to get 'nestor' via e-mail from our mail-server:

    NOTE: In the following I have assumed that your mail address is
	  "fred_flintstone at stone.age.edu"; of course you must substitute
	  your own address for this.
	  ** PLEASE USE VALID DOMAIN ADDRESSES. DO NOT USE ADDRESSES **
	  ** WITH ! and @ MIXED !!!! BITNETTERS USE USER at HOST.BITNET **


    Send the following message to
		mail-server at cs.ruu.nl
    or the old-fashioned path alternative
		uunet!mcsun!hp4nl!ruuinf!mail-server


      begin
      path fred_flintstone at stone.age.edu (SUBSTITUTE *YOUR* ADDRESS)
      send UNIX/nestor.tar.Z
      end


The path command can be deleted if we receive a valid from address in your
message. If this is the first time you use our mail server, we suggest you
first issue the request:

      send HELP


  A complete "ls-lR" listing of the archive is  kept  in  the  top-level
directory, it will be updated every night. To get it, issue the command:

     send ls-lR.Z



  That's all for now. If you encounter problems using  the  FTP  service
and/or the mail-server, feel free to drop me a line (by e-mail, please).


=================================CUT===HERE===================================
#!/bin/sh
# This is a shell archive (shar 3.32)
# made 06/03/1991 13:50 UTC by edwin at cs.ruu.nl
#
# existing files WILL be overwritten
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#  12434 -rw-r----- Patch01
#
if touch 2>&1 | fgrep 'amc' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= Patch01 ==============
echo "x - extracting Patch01 (Text)"
sed 's/^X//' << 'SHAR_EOF' > Patch01 &&
X*** /dev/null	Mon Jun  3 09:51:14 1991
X--- Changes	Mon Jun  3 15:00:00 1991
X***************
X*** 0 ****
X--- 1,62 ----
X+ Nestor -- 1.0 PL0
X+ =================
X+ This version was announced in the  newsgroups  "news.software.nntp"  and
X+ "news.software.b"  and released to the Usenet community by anonymous FTP
X+ and  mail-server  on   May   23,   1991.    Announcement   appeared   in
X+ "comp.archives" on May 25, 1991.
X+ 
X+ 
X+ Nestor -- 1.0 PL1
X+ =================
X+ Patch #1 was posted in "news.software.nntp" and  "comp.sources.bugs"  on
X+ June 3, 1991.
X+ 
X+ Topic:	added the ``Changes'' file. You looking at it now...
X+ From:	EHK
X+ Added:	Patch #1 [Changes Makefile]
X+ 
X+ Topic:	New sections in the README file about bug-reports and archiving
X+ From:	EHK
X+ Added:	Patch #1 [README nestor.1]
X+ 
X+ Topic:	Documented ``LOG_LOCAL7'' is somewhat surprising for 4.3BSD users
X+ From:	Gordon Moffett <netnews at netcomsv.netcom.COM>
X+ Added:	Patch #1 [README]
X+ 
X+ Topic:	SunOS 4.1.1 warned about `illegal combination of pointer and integer'
X+ From:	Gordon Moffett <netnews at netcomsv.netcom.COM>
X+ Added:	Patch #1 [nestor.c]
X+ 
X+ Topic:	Use <stdin> as input if the filename argument is a "-"
X+ From:	Ian Dickinson <vato at warwick.ac.uk>
X+ Added:	Patch #1 [nestor.c nestor.1]
X+ 
X+ Topic:	Gets confused about some not-covered entries in the syslog
X+ From:	Ian Dickinson <vato at warwick.ac.uk>
X+ 	Gordon Moffett <netnews at netcomsv.netcom.COM>
X+ 	Emmett Hogan <hogan at csl.sri.com>
X+ Added:	Patch #1 [scan.c]
X+ 
X+ 	Nestor gets confused about some messages in the syslog that were
X+ 	redirected from stderr i.e.:
X+ 	   nntpd[82]: /usr/lib/newsbin/inject/inews: defhdrs.awk: no Subject
X+ 	and also mis-interpreted other syslog info i.e.:
X+ 	   nntpd[82]: loadav at 6, exiting
X+ 
X+ 	Fixed this to change the algorithm in ScanLine(). After retrieving
X+ 	the hostname and the keyword, *first* lookup the keyword; if that
X+ 	is successful, the info in front of it is most likely a hostname,
X+ 	so it is it reasonable to proceed.
X+ 
X+ Topic:	Also report remote-postings if there a no remote-readings
X+ From:	Ian Dickinson <vato at warwick.ac.uk>
X+ Added:	Patch #1 [report.c]
X+ 
X+ 	If you have a couple of news clients posting via the nntp mini-inews
X+ 	program, but reading articles over NFS, the remote posting statistics
X+ 	were not shown.
X+ 
X+ Topic:	Now report the number of logfile lines successfully parsed
X+ From:	EHK
X+ Added:	Patch #1 [nestor.c scan.c]
X+ 
X
X*** ../1.0PL0/Makefile	Thu May 23 17:30:00 1991
X--- Makefile	Mon Jun  3 15:00:00 1991
X***************
X*** 10,18 ****
X  
X  OBJFILES	= nestor.o support.o report.o scan.o
X  SRCFILES	= defs.h nestor.h nestor.c support.c report.c scan.c
X! DISTFILES	= README COPYING nestor.1 Makefile defs.h.dist patchlevel.h \
X! 		  nestor.h nestor.c report.c scan.c support.c
X! 
X  
X  nestor		: $(OBJFILES)
X  		$(CC) $(OBJFILES) -o $@ $(LDFLAGS)
X--- 10,17 ----
X  
X  OBJFILES	= nestor.o support.o report.o scan.o
X  SRCFILES	= defs.h nestor.h nestor.c support.c report.c scan.c
X! DISTFILES	= README Changes COPYING nestor.1 Makefile defs.h.dist \
X! 		  patchlevel.h nestor.h nestor.c report.c scan.c support.c
X  
X  nestor		: $(OBJFILES)
X  		$(CC) $(OBJFILES) -o $@ $(LDFLAGS)
X
X*** ../1.0PL0/README	Thu May 23 17:30:00 1991
X--- README	Mon Jun  3 15:00:00 1991
X***************
X*** 24,30 ****
X  
X  INTRODUCTION
X  ============
X- 
X    This is  ``nestor'',  a  program  to  summarize  the  copious  logging
X  information  from the NNTP Usenet News transport agent (for the curious:
X  "Nestor" is short for "NEws STatistics ORganizer").
X--- 24,29 ----
X***************
X*** 48,54 ****
X    This excerpt from the file "where_your_nntp_sources_are/common/conf.h"
X  shows a possible configuration:
X  
X! 	#define	SYSLOG	LOG_LOCAL7
X  
X  	#ifdef SYSLOG	/* Define LOG if you want copious logging info	*/
X  	#define	 LOG	/* undef it if you don't			*/
X--- 47,53 ----
X    This excerpt from the file "where_your_nntp_sources_are/common/conf.h"
X  shows a possible configuration:
X  
X! 	#define	SYSLOG	LOG_LOCAL7	/* or LOG_NEWS if you have it	*/
X  
X  	#ifdef SYSLOG	/* Define LOG if you want copious logging info	*/
X  	#define	 LOG	/* undef it if you don't			*/
X***************
X*** 57,63 ****
X  
X  HOW TO INSTALL
X  ==============
X- 
X  1) Take a quick look at the "Makefile". You might want to change the
X     value of "BINDIR". (you might even be unhappy with CFLAGS and/or
X     LDFLAGS -- change them at will).
X--- 56,61 ----
X***************
X*** 108,116 ****
X  7) Congratulations! You're done. Hope you enjoy this pogram.
X  
X  
X  
X! NOTE THAT:
X! ==========
X  	this software is distributed under the terms of the
X  	GNU General Public License. See the file "COPYING"
X  	for details.
X--- 106,130 ----
X  7) Congratulations! You're done. Hope you enjoy this pogram.
X  
X  
X+ BUG REPORTS
X+ ===========
X+   I'd be very interested to hear what problems you had with  nestor.  If
X+ you think you've encountered a bug, please submit a bug report by e-mail
X+ to  <edwin at cs.ruu.nl>.  PLEASE,  PLEASE  include  version   number   and
X+ patchlevel in the bug report (``nestor -V'' will tell you).
X  
X! 
X! ARCHIVING NESTOR
X! ================
X!   If you are archiving the nestor package on your FTP site  and/or  your
X! mail-server  archive,  please  let me know so I can inform you of future
X! enhancements (often called 'bug fixes').
X!   The latest version of nestor is always available by anonymous FTP from
X! "archive.cs.ruu.nl" [131.211.80.5]
X! 
X! 
X! NOTE THAT
X! =========
X  	this software is distributed under the terms of the
X  	GNU General Public License. See the file "COPYING"
X  	for details.
X
X*** ../1.0PL0/nestor.1	Thu May 23 17:30:00 1991
X--- nestor.1	Mon Jun  3 15:00:00 1991
X***************
X*** 15,21 ****
X  .PP
X  Usually, \fBnestor\fP scans through the pre-defined logfile (as defined by
X  the News Administrator at compile time), but this may be overruled by
X! supplying an alternate \fIfilename\fP.
X  .PP
X  Remote-reading/posting-only clients, defined as systems that do make
X  connections to the NNTP daemon but have never offered us a single
X--- 15,22 ----
X  .PP
X  Usually, \fBnestor\fP scans through the pre-defined logfile (as defined by
X  the News Administrator at compile time), but this may be overruled by
X! supplying an alternate \fIfilename\fP (if the filename is a single "-",
X! stdin will be used).
X  .PP
X  Remote-reading/posting-only clients, defined as systems that do make
X  connections to the NNTP daemon but have never offered us a single
X***************
X*** 74,77 ****
X  .br
X  Utrecht University, Dept. of Computer Science, the Netherlands.
X  .SH BUGS
X! None known yet. Please report to the author.
X--- 75,78 ----
X  .br
X  Utrecht University, Dept. of Computer Science, the Netherlands.
X  .SH BUGS
X! Please report to the author; for details see the file README.
X
X*** ../1.0PL0/nestor.c	Thu May 23 17:30:00 1991
X--- nestor.c	Mon Jun  3 15:00:00 1991
X***************
X*** 147,164 ****
X  	else
X  		logfile = NNTP_SYSLOG;
X  
X! 	if ( (logfp = fopen(logfile, "r")) == NULL )
X! 		perror("fopen_logfile"), exit(-1);
X  
X  	while ( fgets(logbuff, BUFSIZ, logfp) != NULL )
X  	{
X! 		if ( (service_match = strstr(logbuff, " nntp")) != NIL_CHAR )
X  		{
X- 
X  			if ( n_input_lines == 0 )
X  				start_date = (char *) StrSave(logbuff);
X! 			ScanLine(logbuff, service_match);
X! 			++n_input_lines;
X  		}
X  	}
X  
X--- 147,167 ----
X  	else
X  		logfile = NNTP_SYSLOG;
X  
X! 	if ( !strcmp(logfile, "-") )
X! 		logfp = stdin;
X! 	else
X! 		if ( (logfp = fopen(logfile, "r")) == NULL )
X! 			perror("fopen_logfile"), exit(-1);
X  
X  	while ( fgets(logbuff, BUFSIZ, logfp) != NULL )
X  	{
X! 		service_match = (char *) strstr(logbuff, " nntp");
X! 		if ( service_match != NIL_CHAR )
X  		{
X  			if ( n_input_lines == 0 )
X  				start_date = (char *) StrSave(logbuff);
X! 			if ( ScanLine(logbuff, service_match) != -1 )
X! 				++n_input_lines;
X  		}
X  	}
X  
X
X*** ../1.0PL0/patchlevel.h	Thu May 23 17:30:00 1991
X--- patchlevel.h	Mon Jun  3 15:00:00 1991
X***************
X*** 12,19 ****
X   *	17-Apr-91 EHK	Few additions per beta-testers request	0.4-beta PL0
X   *	23-May-91 EHK	Fixed stupid bug in supplied 'strstr'	0.5-beta PL0
X   *	23-May-91 EHK	Prepared UseNet community release	1.0 PL0
X   *
X   *---------------------------------------------------------------------------
X   */
X  
X! #define PATCHLEVEL	0
X--- 12,20 ----
X   *	17-Apr-91 EHK	Few additions per beta-testers request	0.4-beta PL0
X   *	23-May-91 EHK	Fixed stupid bug in supplied 'strstr'	0.5-beta PL0
X   *	23-May-91 EHK	Prepared UseNet community release	1.0 PL0
X+  *	03-Jun-91 EHK	Various problem fixes; better parsing	1.0 PL1
X   *
X   *---------------------------------------------------------------------------
X   */
X  
X! #define PATCHLEVEL	1
X
X*** ../1.0PL0/report.c	Thu May 23 17:30:00 1991
X--- report.c	Mon Jun  3 15:00:00 1991
X***************
X*** 133,139 ****
X  
X  	for ( np = nntps ; np < nntps + num_nntp_hosts ; np++ )
X  	{
X! 		if ( np->recv_rr_grp || np->recv_rr_art )
X  			printf("%-17.17s %8d %8d     %10d %10d %10d\n",
X  				np->nntp_host,
X  				np->recv_rr_grp, np->recv_rr_art,
X--- 133,140 ----
X  
X  	for ( np = nntps ; np < nntps + num_nntp_hosts ; np++ )
X  	{
X! 		if ( np->recv_rr_grp || np->recv_rr_art ||
X! 		     np->recv_p_acc  || np->recv_p_rej  || np->recv_p_fai )
X  			printf("%-17.17s %8d %8d     %10d %10d %10d\n",
X  				np->nntp_host,
X  				np->recv_rr_grp, np->recv_rr_art,
X
X*** ../1.0PL0/scan.c	Thu May 23 17:30:00 1991
X--- scan.c	Mon Jun  3 15:00:00 1991
X***************
X*** 1,6 ****
X--- 1,7 ----
X  /*
X   *	scan.c	1.0	18-Mar-91 EHK
X   *	scan.c	1.01	09-Apr-91 EHK	Grrmmbbll, Ultrix syslog format
X+  *	scan.c	1.02	03-Jun-91 EHK	mod. algorithm to filter garbage better
X   */
X  
X  #include "nestor.h"
X***************
X*** 19,28 ****
X   *
X   * Okay, the algorithm will be
X   *	1) skip to ``.... service[pid]: '' or ``.... pid service: ''
X!  *	2) skip to first field (= hostname) after the syslog overhead
X!  *	3) read hostname and keyword; skip in input buffer
X!  *	4) lookup hostname statistics entry; insert if not present
X!  *	5) lookup the keyword and handle the corresponding information
X   *---------------------------------------------------------------------------
X   */
X  int
X--- 20,34 ----
X   *
X   * Okay, the algorithm will be
X   *	1) skip to ``.... service[pid]: '' or ``.... pid service: ''
X!  *	2) skip to first field (expected to be a hostname) after the syslog
X!  *	   overhead
X!  *	3) read hostname and keyword; skip past both in input buffer
X!  *	4) lookup the keyword -- if we find it, the info in front of it
X!  *	   is most likely a hostname. This is how we filter garbage...
X!  *	5) lookup hostname statistics entry; insert if not present
X!  *	6) handle the keyword-corresponding information
X!  *
X!  * Return value: -1 if failure (not a valid syslog entry); 0 if ok.
X   *---------------------------------------------------------------------------
X   */
X  int
X***************
X*** 32,52 ****
X  {
X  	register char	*cp;
X  	register nntp_t	*np;
X  	char		hostname[HOSTLEN],
X  			keyword[KEYWLEN];
X  
X  	if ( (cp = index(service_match, ':')) == NIL_CHAR )	/* -1-	*/
X! 		return;
X  
X  	cp += 2;						/* -2-	*/
X  
X  	sscanf(cp, "%s %s", hostname, keyword);			/* -3-	*/
X  	cp += strlen(hostname) + strlen(keyword) + 2;
X  
X! 	if ( (np = (nntp_t *) LookUp(hostname)) == NIL_NNTP )	/* -4-	*/
X  		np = (nntp_t *) Insert(hostname);
X  
X! 	switch ( FindKey(keyword) )				/* -5-	*/
X  	{
X  	   case KEY_CONNECT:
X  		++np->recv_n_connect;
X--- 38,66 ----
X  {
X  	register char	*cp;
X  	register nntp_t	*np;
X+ 	register int	key_lookup_result;
X  	char		hostname[HOSTLEN],
X  			keyword[KEYWLEN];
X  
X  	if ( (cp = index(service_match, ':')) == NIL_CHAR )	/* -1-	*/
X! 		return( -1 );
X  
X  	cp += 2;						/* -2-	*/
X  
X  	sscanf(cp, "%s %s", hostname, keyword);			/* -3-	*/
X  	cp += strlen(hostname) + strlen(keyword) + 2;
X  
X! 	if ( (key_lookup_result = FindKey(keyword)) == -1 )	/* -4-	*/
X! 	{
X! 		if ( verbose )
X! 			fprintf(stderr, "Huh?!?!? --> %s", line);
X! 		return( -1 );
X! 	}
X! 
X! 	if ( (np = (nntp_t *) LookUp(hostname)) == NIL_NNTP )	/* -5-	*/
X  		np = (nntp_t *) Insert(hostname);
X  
X! 	switch ( key_lookup_result )				/* -6-	*/
X  	{
X  	   case KEY_CONNECT:
X  		++np->recv_n_connect;
X***************
X*** 125,133 ****
X  	   case KEY_E_XNET	:
X  		++np->xmit_n_netfail;
X  		break;
X- 	default		:
X- 		if ( verbose )
X- 			fprintf(stderr, "HUH?!?!? --> %s", line);
X- 		break;
X  	}
X  }
X--- 139,145 ----
X  	   case KEY_E_XNET	:
X  		++np->xmit_n_netfail;
X  		break;
X  	}
X+ 
X+ 	return( 0 );
X  }
X
SHAR_EOF
$TOUCH -am 0603155091 Patch01 &&
chmod 0640 Patch01 ||
echo "restore of Patch01 failed"
set `wc -c Patch01`;Wc_c=$1
if test "$Wc_c" != "12434"; then
	echo original size 12434, current size $Wc_c
fi
exit 0


-- 
Edwin Kremer (SysAdm), Dept. of Computer Science, Utrecht University
Padualaan 14,   P.O. Box 80.089,  3508 TB  Utrecht,  The Netherlands
Telephone: +31-30-534104  | UUCP: ...!uunet!mcsun!hp4nl!ruuinf!edwin
Telefax  : +31-30-513791  | Email: edwin at cs.ruu.nl    [131.211.80.5]



More information about the Comp.sources.bugs mailing list