[comp.sources.bugs] nestor patch #02

edwin@cs.ruu.nl (Edwin Kremer) (06/12/91)

Here is a SHARred high-priority patch for the  ``nestor''  program.   It
fixes a couple of bugs (one serious) and has some cosmetic improvements.
  If  you  are  currently using nestor 1.0PL1 please apply this patch to
upgrade from 1.0PL1 to 1.0PL2.  If  you're  unfamiliar  with  nestor  or
running  a  pre-1.0PL1  version  of  nestor, I encourage you to pickup a
complete new release from our archive -- see details below.


  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,  for  those  of  you  without
direct Internet access.


--> 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@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@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@HOST.BITNET **


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


      begin
      path fred_flintstone@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/12/1991 09:44 UTC by edwin@cs.ruu.nl
#
# existing files WILL be overwritten
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#  11667 -rw-r----- Patch02
#
if touch 2>&1 | fgrep 'amc' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= Patch02 ==============
echo "x - extracting Patch02 (Text)"
sed 's/^X//' << 'SHAR_EOF' > Patch02 &&
X*** ../1.0PL1/Changes	Mon Jun  3 15:00:00 1991
X--- Changes	Wed Jun 12 11:30:14 1991
X***************
X*** 60,62 ****
X--- 60,106 ----
X  From:	EHK
X  Added:	Patch #1 [nestor.c scan.c]
X  
X+ 
X+ Nestor -- 1.0 PL2
X+ =================
X+ Patch #2 was posted in "news.software.nntp" and  "comp.sources.bugs"  on
X+ June 12, 1991.
X+ 
X+ Topic:	Typo in the manual page and change in presentation of usage information
X+ From:	Bart Muyzer <bartm@cv.ruu.nl>
X+ Added:	Patch #2 [nestor.1 nestor.c]
X+ 
X+ Topic:	Also install the manual page during a `make install'
X+ From:	Bart Muyzer <bartm@cv.ruu.nl>
X+ Added:	Patch #2 [Makefile README]
X+ 
X+ Topic:	nestor memory/segmentation faults on certain input lines
X+ From:	Nike Horton <horton@cse.ogi.edu>
X+ Added:	Patch #2 [nestor.h scan.c]
X+ 
X+ Topic:	current time was always reported as 'statistics end date'
X+ From:	EHK   [on request from Ian Dickinson <vato@warwick.ac.uk>]
X+ Added:	Patch #2 [nestor.h nestor.c]
X+ 
X+ 	Even on old logfiles, the current time was reported as  end  time
X+ 	of  the  statistics  --  this is not what you want. So, at EOF we
X+ 	want to remember the last nntp/nntpxmit syslog  entry.   Since  I
X+ 	don't  want  to  strcpy()  every  entry,  I  decided  to  use two
X+ 	alternating buffers while reading the syslog  file.   This  makes
X+ 	sure that we always still have the last entry of interest at EOF.
X+ 
X+ Topic:	'nntplink' not fully supported -- now documented
X+ From:	EHK   [on report by John Palkovic <palkovic@linac.fnal.gov>]
X+ Added:	Patch #2 [nestor.1]
X+ 
X+ 	Besides 'nntpxmit', there's  another  program  to  take  care  of
X+ 	Usenet  news  transmissions: NNTPLINK.  Although nestor correctly
X+ 	picks up the statistics that are logged  by  'nntplink',  verbose
X+ 	mode ('-v') will show that it doesn't like many of the additional
X+ 	'nntplink' log entries. This is now documented in the manual page
X+ 	in the "CAVEATS" section.
X+ 	  I  hope  to better support 'nntplink' in future versions, but I
X+ 	have to dig into 'nntplink'  first  in  order  to  find  out  its
X+ 	perculiarities.
X+ 
X+ 
X
X*** ../1.0PL1/Makefile	Mon Jun  3 15:00:00 1991
X--- Makefile	Wed Jun 12 10:39:09 1991
X***************
X*** 1,8 ****
X  #
X  #	Makefile	1.1	04-Apr-91	EHK
X  #
X  
X! BINDIR	=  /usr/local/bin
X  CC	= cc
X  CFLAGS	= -O
X  LDFLAGS	= -s
X--- 1,10 ----
X  #
X  #	Makefile	1.1	04-Apr-91	EHK
X+ #	Makefile	1.2	12-Jun-91	EHK	Also install man page
X  #
X  
X! BINDIR	= /usr/local/bin
X! MANDIR	= /usr/local/man/man1
X  CC	= cc
X  CFLAGS	= -O
X  LDFLAGS	= -s
X***************
X*** 18,26 ****
X  
X  $(OBJFILES)	: defs.h nestor.h
X  
X! install		: nestor
X  		cp $? $(BINDIR)
X! 		chmod 711 $(BINDIR)/$?
X  
X  tags		:
X  		ctags -t -w $(SRCFILES)
X--- 20,34 ----
X  
X  $(OBJFILES)	: defs.h nestor.h
X  
X! install		: inst_prg inst_man
X! 
X! inst_prg	: nestor
X  		cp $? $(BINDIR)
X! 		-chmod 711 $(BINDIR)/$?
X! 
X! inst_man	: nestor.1
X! 		cp $? $(MANDIR)
X! 		-chmod 644 $(MANDIR)/$?
X  
X  tags		:
X  		ctags -t -w $(SRCFILES)
X
X*** ../1.0PL1/README	Mon Jun  3 15:00:00 1991
X--- README	Wed Jun 12 10:41:29 1991
X***************
X*** 57,64 ****
X  HOW TO INSTALL
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  
X  2) Make a site specific copy of the "defs.h.dist" file by doing:
X  
X--- 57,64 ----
X  HOW TO INSTALL
X  ==============
X  1) Take a quick look at the "Makefile". You might want to change the
X!    values of "BINDIR" and "MANDIR".  (you might even be unhappy with
X!    CFLAGS and/or LDFLAGS -- change them at will).
X  
X  2) Make a site specific copy of the "defs.h.dist" file by doing:
X  
X
X*** ../1.0PL1/nestor.1	Mon Jun  3 15:00:00 1991
X--- nestor.1	Wed Jun 12 10:40:22 1991
X***************
X*** 1,15 ****
X! .TH NESTOR 1L "RUU-CS"
X  .SH NAME
X  nestor \- NEws STatistics ORganizer
X  .SH SYNOPSIS
X! \fBnestor\fP  [ \fI-ainorvxV\fP ]  [ filename ]
X  .SH DESCRIPTION
X  \fBNestor\fP parses and analyses the statistics as produced by the
X  \fINNTP\fP Usenet News Transfer Agent. Statistics from both sides of
X  the NNTP protocol, receiver (nntpd) and transmitter (nntpxmit), are
X  examined.
X  .PP
X! After scanning through the logfiles, \fBnestor\fP will generete some nice
X  reports on what it found. The reports are printed on \fIstdout\fP; diagnostic
X  error messages are printed on \fIstderr\fP.
X  .PP
X--- 1,15 ----
X! .TH NESTOR 1L "RUU-CS Version 1.0PL2"
X  .SH NAME
X  nestor \- NEws STatistics ORganizer
X  .SH SYNOPSIS
X! \fBnestor\fP  \fI-ainorvxV\fP  [ filename ]
X  .SH DESCRIPTION
X  \fBNestor\fP parses and analyses the statistics as produced by the
X  \fINNTP\fP Usenet News Transfer Agent. Statistics from both sides of
X  the NNTP protocol, receiver (nntpd) and transmitter (nntpxmit), are
X  examined.
X  .PP
X! After scanning through the logfiles, \fBnestor\fP will generate some nice
X  reports on what it found. The reports are printed on \fIstdout\fP; diagnostic
X  error messages are printed on \fIstderr\fP.
X  .PP
X***************
X*** 66,71 ****
X--- 66,81 ----
X  .SH CAVEATS
X  This program is based on the statistics produced by the NNTP
X  version 1.5.11 package; note that this may change in the future.
X+ .sp
X+ Besides 'nntpxmit', there's another program to handle Usenet news
X+ transmissions: \fInntplink\fP. Although nestor correctly picks up the
X+ statistics that are logged by \fInntplink\fP, verbose mode ('-v') will
X+ show that it doesn't like many of the additional \fInntplink\fP log entries.
X+ .br
X+ Also, with \fInntplink\fP, the extreme values in the 'elapsed time' column
X+ in the the 'Outgoing Articles' report section ('-o') might cause some
X+ confusion: this is because \fInntplink\fP keeps the connection open even
X+ after a short period (a couple of minutes) of idle time.
X  .SH "SEE ALSO"
X  nntpd(8), nntpxmit(8), syslog(3)
X  .br
X
X*** ../1.0PL1/nestor.c	Mon Jun  3 15:00:00 1991
X--- nestor.c	Tue Jun 11 21:18:44 1991
X***************
X*** 73,79 ****
X  Usage(prog)
X  	char	*prog;
X  {
X!    fprintf(stderr, "Usage: %s   [ -ainorvxV ]   [ filename ]\n", prog);
X     fprintf(stderr, "\
X        -i  report Incoming statistics\n\
X        -o  report Outgoing statistics only\n\
X--- 73,79 ----
X  Usage(prog)
X  	char	*prog;
X  {
X!    fprintf(stderr, "Usage: %s   -ainorvxV   [ filename ]\n", prog);
X     fprintf(stderr, "\
X        -i  report Incoming statistics\n\
X        -o  report Outgoing statistics only\n\
X***************
X*** 99,110 ****
X  	extern int	optind;		/* for getopt() support		*/
X  	register FILE	*logfp;		/* open logfile filepointer	*/
X  	register char	*service_match;	/* service name  in logentry	*/	
X  	register int	ch,		/* options parsing character	*/
X  			n_input_lines;	/* number of lines read in log	*/
X  	char		*logfile;	/* logfile we're parsing	*/
X- 	long		now;		/* the current time		*/
X  
X! 	opts = num_nntp_hosts = n_input_lines = 0;
X  	service_match = start_date = NIL_CHAR;
X  
X  	while ( (ch = getopt(argc, argv, "ainorvxV")) != EOF )
X--- 99,110 ----
X  	extern int	optind;		/* for getopt() support		*/
X  	register FILE	*logfp;		/* open logfile filepointer	*/
X  	register char	*service_match;	/* service name  in logentry	*/	
X+ 	register short	buf_idx;	/* buffer index; only be 0 or 1	*/
X  	register int	ch,		/* options parsing character	*/
X  			n_input_lines;	/* number of lines read in log	*/
X  	char		*logfile;	/* logfile we're parsing	*/
X  
X! 	opts = num_nntp_hosts = n_input_lines = buf_idx = 0;
X  	service_match = start_date = NIL_CHAR;
X  
X  	while ( (ch = getopt(argc, argv, "ainorvxV")) != EOF )
X***************
X*** 153,167 ****
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--- 153,169 ----
X  		if ( (logfp = fopen(logfile, "r")) == NULL )
X  			perror("fopen_logfile"), exit(-1);
X  
X! 	while ( fgets(logbuff[buf_idx], BUFSIZ, logfp) != NULL )
X  	{
X! 		service_match = (char *) strstr(logbuff[buf_idx], " nntp");
X  		if ( service_match != NIL_CHAR )
X  		{
X  			if ( n_input_lines == 0 )
X! 				start_date = (char *) StrSave(logbuff[buf_idx]);
X! 			if ( ScanLine(logbuff[buf_idx], service_match) != -1 )
X  				++n_input_lines;
X+ 
X+ 			buf_idx ^= 0x01;
X  		}
X  	}
X  
X***************
X*** 174,185 ****
X  
X  	if ( start_date )
X  	{
X- 		time(&now);
X  		printf("\n\
X     -- Statistics (%d lines) from %15.15s till %15.15s --\n",
X  			n_input_lines,
X  			start_date,
X! 			ctime(&now) + 4);
X  	}
X  
X  	if ( opts & OPT_INCOMING )
X--- 176,186 ----
X  
X  	if ( start_date )
X  	{
X  		printf("\n\
X     -- Statistics (%d lines) from %15.15s till %15.15s --\n",
X  			n_input_lines,
X  			start_date,
X! 			logbuff[buf_idx]);
X  	}
X  
X  	if ( opts & OPT_INCOMING )
X
X*** ../1.0PL1/nestor.h	Mon Jun  3 15:00:00 1991
X--- nestor.h	Tue Jun 11 21:17:46 1991
X***************
X*** 2,7 ****
X--- 2,9 ----
X   *	nestor.h	1.0	18-Mar-91	EHK
X   *	nestor.h	1.1	26-Mar-91	EHK	Changed data structure
X   *	nestor.h	1.2	29-Mar-91	EHK	Added program options
X+  *	nestor.h	1.3	10-Jun-91	EHK	BUFSIZ must be defined
X+  *	nestor.h	1.4	11-Jun-91	EHK	Use two buffers now
X   */
X  
X  #include <stdio.h>
X***************
X*** 25,30 ****
X--- 27,36 ----
X  #	include <strings.h>
X  #endif	/* SYSV || hpux	*/
X  
X+ #ifndef BUFSIZ
X+ #	define BUFSIZ	1024
X+ #endif /* BUFSIZ */
X+ 
X  /*
X   *	Commonly used macro definitions
X   */
X***************
X*** 124,129 ****
X  
X  EXTERN nntp_t	nntps[NUM_NNTP_HOSTS];	/* hosts statistics array	*/
X  
X! EXTERN char	*logbuff[BUFSIZ],	/* buffer for a syslog entry	*/
X  		*start_date;		/* date/time of logging start	*/
X  
X--- 130,135 ----
X  
X  EXTERN nntp_t	nntps[NUM_NNTP_HOSTS];	/* hosts statistics array	*/
X  
X! EXTERN char	*logbuff[2][BUFSIZ],	/* buffers for syslog entries	*/
X  		*start_date;		/* date/time of logging start	*/
X  
X
X*** ../1.0PL1/patchlevel.h	Mon Jun  3 15:00:00 1991
X--- patchlevel.h	Tue Jun 11 21:37:50 1991
X***************
X*** 13,20 ****
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--- 13,21 ----
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+  *	11-Jun-91 EHK	Safer mem alloc; real-logging period 	1.0 PL2
X   *
X   *---------------------------------------------------------------------------
X   */
X  
X! #define PATCHLEVEL	2
X
X*** ../1.0PL1/scan.c	Mon Jun  3 15:00:00 1991
X--- scan.c	Mon Jun 10 08:50:52 1991
X***************
X*** 2,7 ****
X--- 2,8 ----
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+  *	scan.c	1.03	10-Jun-91 EHK	memory faults; increase some buffers
X   */
X  
X  #include "nestor.h"
X***************
X*** 39,46 ****
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--- 40,47 ----
X  	register char	*cp;
X  	register nntp_t	*np;
X  	register int	key_lookup_result;
X! 	char		hostname[BUFSIZ],
X! 			keyword[BUFSIZ];
X  
X  	if ( (cp = index(service_match, ':')) == NIL_CHAR )	/* -1-	*/
X  		return( -1 );
X
SHAR_EOF
$TOUCH -am 0612113291 Patch02 &&
chmod 0640 Patch02 ||
echo "restore of Patch02 failed"
set `wc -c Patch02`;Wc_c=$1
if test "$Wc_c" != "11667"; then
	echo original size 11667, current size $Wc_c
fi
exit 0


-- 
Edwin Kremer, systems and network administrator.  [NIC-Whois handle: EHK3]
     Department of Computer Science,  Utrecht University,  The Netherlands
     Email: edwin@cs.ruu.nl  | UUCP to: ...!uunet!mcsun!hp4nl!ruuinf!edwin

me@anywhere.EBay.Sun.COM (Wayne Thompson) (06/15/91)

I should get the entire release to find out what it is?
Couldn't you give us a hint?

Wayne

In article <1991Jun12.100836.25551@cs.ruu.nl>, edwin@cs.ruu.nl (Edwin Kremer) writes:
|> 
|> Here is a SHARred high-priority patch for the  ``nestor''  program.   It
|> fixes a couple of bugs (one serious) and has some cosmetic improvements.
|>   If  you  are  currently using nestor 1.0PL1 please apply this patch to
|> upgrade from 1.0PL1 to 1.0PL2.  If  you're  unfamiliar  with  nestor  or
|> running  a  pre-1.0PL1  version  of  nestor, I encourage you to pickup a
|> complete new release from our archive -- see details below.
|> -- 
|> Edwin Kremer, systems and network administrator.  [NIC-Whois handle: EHK3]
|>      Department of Computer Science,  Utrecht University,  The Netherlands
|>      Email: edwin@cs.ruu.nl  | UUCP to: ...!uunet!mcsun!hp4nl!ruuinf!edwin

edwin@cs.ruu.nl (Edwin Kremer) (06/17/91)

In <7152@male.EBay.Sun.COM> me@anywhere.EBay.Sun.COM (Wayne Thompson) writes:

   | I should get the entire release to find out what it is?
   | Couldn't you give us a hint?
   | 
   | Wayne

Oh yes, with pleasure ;-) It's quite easy to repeat  part  of  my  first
announcement of nestor that appeared in "comp.archives" on May 25, 1991.
The Message-ID was <1991May25.011650.4139@ox.com>. Here it is...

------------------------------------------------------------------------
Some weeks ago I started to write a small program to nicely process  the
NNTP  news  statistics  --  just  because I needed it. But you know what
sometimes happens if someone else catches a glimpse of it...  they  want
it  too!  Well, after cleaning it up a bit and having a few beta-testers
(thanks guys!) testing it, I decided to make it available to anyone  who
wants to use it. Here it is, hope you like it...


------------------------------------------------------------------------
***************************  INTRODUCTION  *****************************
------------------------------------------------------------------------
  This is  ``nestor'',  a  program  to  summarize  the  copious  logging
information  from the NNTP Usenet News transport agent (for the curious:
"Nestor" is  short  for  "NEws  STatistics  ORganizer").  ``nestor''  is
distributed under the terms of the GNU General Public License.

  I got inspired to write this program after I tried out the  "nntp_awk"
script written back in 1986 by Erik E. Fair <fair@ucbarpa.berkeley.edu>,
that comes with the NNTP-1.5 software package. This big awk script  runs
sloooooooooowwwwww.  Lots  of  people  must  have  rewritten that script
since, probably in Perl, Tcl, Gawk, Python or even Cobol :-). Anyway,  I
decided to spend some spare time to do the silly thing in C.

  Some effort has been taken  to  keep  this  program  portable  amongst
various systems. I've tried it on many architectures like HP9000, Sun-3,
DEC5500, Silicon Graphics IRIS, Harris HCX-9 and Amiga-3000UX.
  In order to use this package, you should configure the NNTP daemon  as
well as NNTPXMIT to use syslog __and__ to do statistics logging.
------------------------------------------------------------------------

			best regards,
						--[ Edwin ]--
-- 
Edwin Kremer, systems and network administrator.  [NIC-Whois handle: EHK3]
     Department of Computer Science,  Utrecht University,  The Netherlands
     Email: edwin@cs.ruu.nl  | UUCP to: ...!uunet!mcsun!hp4nl!ruuinf!edwin