🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nn
5 messages
5 total messages Started by Paul Pomes Wed, 28 Dec 1994 05:03
NN is dying, right?
#6936
Author: Paul Pomes
Date: Wed, 28 Dec 1994 05:03
26 lines
2157 bytes
First of all I love nn.  It has its warts but it's the best thing since
sliced bread.  The times are a changing however.  To move with them, nn
has got to get moving again.  It needs solid NOV support and it needs to
handle threads so messages are ordered correctly.  Has anything further
been done since 6.5.0b3?  If not, then perhaps the current keeper of the
flame (and this is not meant as a flame by any means) should evaluate
whether they'll have the time/interest to work on nn.  If not, then
another worthy should be sought.

I have had to make this decision a few times myself and know it's not an
easy one.  The responsibility is taken on in the first place because of a
desire to have the right things happen with a program.  Then "Real Job"
with its demands raises its ugly head.  6 months, a year later the 
realization hits that you're not going to have time for it.  It's at that
point you cut your losses and let it move on to someone else.

If, on the other hand a new release is just a bug or two away from release,
then I can wait a little longer.  What is needed, however, is some kind
of news one way or the other.

/pbp
-- 
The Net is a dangerous place to send naive students.  You may as well send
them to the nearest laundromat to learn about quantum mechanics.  They might
get lucky, but they're more likely to return as members of a new church.
	-- Vernon Schryver <vjs@calcite.rhyolite.com>
Re: NN is dying, right?
#6937
Author: Henrik Storner
Date: Wed, 28 Dec 1994 19:39
28 lines
1886 bytes
My initial reaction to the subject line - read from an nn overview screen,
of course - was: I hope not!

In <3dqrj9$o6m@vixen.cso.uiuc.edu> p-pomes@vixen.cso.uiuc.edu (Paul Pomes) writes:

>Has anything further
>been done since 6.5.0b3?  If not, then perhaps the current keeper of the
>flame (and this is not meant as a flame by any means) should evaluate
>whether they'll have the time/interest to work on nn.  If not, then
>another worthy should be sought.

Hear, hear!

nn 6.5.0.beta3 is almost a year old. It has some quirks, but none that
I have been hit by look like real "show-stoppers" - they should have been
ironed out by now.

So why is it still in beta? Let's get on with the job of keeping nn up
to the ever evolving state-of-the-art of newsreaders.

There are plenty of crummy newsreaders out there. We cannot afford to let
nn die - if the present official maintainer cannot put in the effort needed,
it is time to pass the responsibility to someone else.

-- 
Henrik Storner          |  "We don't see things as they are,
storner@osiris.ping.dk  |   we see them as we are."
                        |                            Anais Nin 
Re: NN is dying, right?
#6938
Author: Michael T Pins
Date: Thu, 29 Dec 1994 00:03
39 lines
2960 bytes
p-pomes@vixen.cso.uiuc.edu (Paul Pomes) writes:

>First of all I love nn.  It has its warts but it's the best thing since
>sliced bread.  The times are a changing however.  To move with them, nn
>has got to get moving again.  It needs solid NOV support and it needs to
>handle threads so messages are ordered correctly.  Has anything further
>been done since 6.5.0b3?  If not, then perhaps the current keeper of the
>flame (and this is not meant as a flame by any means) should evaluate
>whether they'll have the time/interest to work on nn.  If not, then
>another worthy should be sought.

>I have had to make this decision a few times myself and know it's not an
>easy one.  The responsibility is taken on in the first place because of a
>desire to have the right things happen with a program.  Then "Real Job"
>with its demands raises its ugly head.  6 months, a year later the 
>realization hits that you're not going to have time for it.  It's at that
>point you cut your losses and let it move on to someone else.

>If, on the other hand a new release is just a bug or two away from release,
>then I can wait a little longer.  What is needed, however, is some kind
>of news one way or the other.

Peter Wemm is officially the keeper of nn at the moment, but hasn't
actually "released" anything since he took over.  (We had a string of
patch 19betas, each buggier than the one before, followed by a string of
6.5.0 betas, but nothing ever actually released.)  I'm currently rewriting
NN from the ground up.  The new version will have true threading, real NOV
support (in fact, the nnmaster database is going away, an overview database
will be required), and a *lot* of long overdue bug fixes and general
speed-ups.  As much as I'd like to have this out next month, the way life has
been recently April or May would be a better bet.  Progress is being made,
but the going is slow....

then 
-- 
*****************************************************************************
* Michael Pins                     |    Internet: mtpins@icaen.uiowa.edu    *
* ISCA's Amiga & Unix Librarian    |        #include <std.disclaimer>       *
*****************************************************************************
Re: NN is dying, right?
#6942
Author: Peter Wemm
Date: Thu, 29 Dec 1994 01:56
67 lines
3948 bytes
p-pomes@vixen.cso.uiuc.edu (Paul Pomes) writes:

>First of all I love nn.  It has its warts but it's the best thing since
>sliced bread.  The times are a changing however.  To move with them, nn
>has got to get moving again.  It needs solid NOV support and it needs to
>handle threads so messages are ordered correctly.  Has anything further
>been done since 6.5.0b3?  If not, then perhaps the current keeper of the
>flame (and this is not meant as a flame by any means) should evaluate
>whether they'll have the time/interest to work on nn.  If not, then
>another worthy should be sought.

>I have had to make this decision a few times myself and know it's not an
>easy one.  The responsibility is taken on in the first place because of a
>desire to have the right things happen with a program.  Then "Real Job"
>with its demands raises its ugly head.  6 months, a year later the 
>realization hits that you're not going to have time for it.  It's at that
>point you cut your losses and let it move on to someone else.

>If, on the other hand a new release is just a bug or two away from release,
>then I can wait a little longer.  What is needed, however, is some kind
>of news one way or the other.

>/pbp

Hi all..

I wish I could say that "no news is good news", but in this case, it
isn't really.

I've been quite heavily involved in "real work" for some time now, and
I've not even had the NN source on my current machine (which is bad,
because I've not been tinkering away as I'd like to have been doing.)
My time is severely limited, and is just about to get worse again (My
baby Son is about to arrive home from hospital (first child, born 9
weeks premature, but is doing well now).

I origianlly agreed with Kim to take on NN as a maintainer only, and
kinda got hooked with doing some programming work on it.

I find that unless I restrict my activities to patch collection and
maintainence, I run out of time and end up doing nothing at all.

I recently spoke with somebody about this about a week ago, and this
guy was doing some real nice work on the NOV code, memory usage,
startup speed, etc.  I promised him that if he finished the thread of
patches that he had started, that I'd pull my finger out and get it
"out there".

I've got a large collection of patches sitting in my "todo" folder,
which I'll dig out and have a go at.

What I'll also do, is keep a mirror of my current source tree so that
people can see for themselves what is happening and make patches
against current code for current problems, which will make my life a
lot easier and therefore I'll be much more likely to do the job right.

I think I'd like to find somebody who I could delegate the questions I
get in nn-bugs so that they have a chance of getting a proper answer.

I've had an offer or two for people to take over NN's development, and
I assured them then that "it's all under control" - and 3 months later
still nothing.  I think Michael T. Pins (sp??) has done a lot of work
on his own version already.

More on this shortly.. I'm doing some organizing now...

-Peter
NN hacks for NOV
#6959
Author: Romain Kang
Date: Thu, 05 Jan 1995 04:01
1974 lines
46074 bytes
Here are the changes that I've made to NN, which Peter Wemm alluded to
in his message under the "NN is dying, right?" discussion.  Basically,
I got fed up with the long startup times I was seeing, so I started
iteratively profiling and hacking.  I've mailed Peter these diffs, but
I figured I'd share the rest with the net and see what bugs got shaken
out, and also with the thought they might be useful to Toivo in his
TK/TCL version.

My news server carries over 10000 lines in its active file and over
6000 lines in the newsgroups file.  I suspect that more sane sites may
not benefit as much as I have from this changes.  However, startup time
(with NOV-based nn) has gone from about a minute to less than half a
minute.  The big bottleneck is back to get_group_search(), which I have
no intention of tackling after the other time I've spent.

acttbl and grouptbl had been needlessly coded as hash tables.  I
changed db.c to use actlist and grplist instead, which are string
arrays indexed by the group number.  timtbl remains a hash table,
active.times entries have to be matched with active by groupname.
The hash table is sized according to the number of groups in the active
list.

The hdbmdef() hash function has been replaced with a faster routine
with better distribution characteristics.

db.c's active, group, and time tables are returned to malloc()'s
heap once initialization is complete.  This saves about 800KB of
core on my system.  The storage is managed with pmalloc()/pfree(),
which is conceptually similar to the mark_str()/alloc_str()/release_str()
family, but is easier to use (to me, anyhow).

alloc_str() now returns word aligned memory chunks (a micro
optimization that seems to help bcopy() and the str*() routines on
my system).

To improve group-to-group time, the local .overview interface has
been changed to use a binary search function, novseek(), to avoid
parsing articles which have already been read (similar to the XOVER
change in b3).  The NOV hash table is now sized according to the
estimated number of unread articles.

Jumping back to unread articles with the NOV interface didn't go beyond
the current newsrc anymore because gh_db_article now reflected only the
article range requested, rather than the nnmaster style data.  I hacked
access_group() to quietly change its first_article in this case, though
I suspect there's a prettier way to handle this problem.

nntp_get_overview()'s prototype in global.h was changed because
the compiler on my SVR4 system otherwise would puke on nntp.c.

I usually have show-purpose-mode set to 2, and the linear search
for every group contributed to group-to-group sluggishness.  I
added a configurable CACHE_PURPOSE feature.  When it is enabled
(from global.h) the newsgroups data is sorted by group name into
memory, to allow fast binary search.

My digest reading speedup to news.c is included.  Previously,
reading a large folder with NN could get painful because the line
counting code always went to the end of the folder.  (It was
difficult not to notice with 3.3MB of accumulated digests...)  I
inserted a limit, though I'm not sure it's precise.  Take note,
tommy@big.att.com.

Another enhancement for reading folders is "nnview" mode.  When
invoked as "nnview", NN will now skip reading the "master" data
and newsrc files.

Romain Kang					Pyramid Technology Corp.
romain@pyramid.com				San Jose, California, USA

diff -c2 nn-6.5.0.b3/articles.c nn-6.5.0.b3+/articles.c
*** nn-6.5.0.b3/articles.c	Thu Feb 17 18:15:47 1994
--- nn-6.5.0.b3+/articles.c	Fri Dec 30 15:35:23 1994
***************
*** 111,114
  int len;
  {
      char *ret;
  

--- 111,116 -----
  int len;
  {
+     /* allow space for '\0', and align on word boundary */
+     int size  = (len + sizeof(int)) & ~(sizeof(int) - 1);
      char *ret;
  
***************
*** 113,117
      char *ret;
  
!     if (cur_str_size <= len) {	/* must be room for len+1 bytes */
  	if (current_str_t->next_thunk == NULL)
  	    new_thunk(current_str_t,

--- 115,119 -----
      char *ret;
  
!     if (cur_str_size < size) {
  	if (current_str_t->next_thunk == NULL)
  	    new_thunk(current_str_t,
***************
*** 122,125
  	cur_str_size = current_str_t->thunk_size;
      }
  
      ret = next_str;

--- 124,128 -----
  	cur_str_size = current_str_t->thunk_size;
      }
+     /* XXX else should do something reasonable */
  
      ret = next_str;
***************
*** 124,130
  
      ret = next_str;
!     cur_str_size -= len + 1;
!     next_str += len;
!     *next_str++ = NUL;	/* string is null terminated */
  
      return ret;

--- 127,132 -----
  
      ret = next_str;
!     cur_str_size -= size;
!     next_str += size;
  
      ret[len] = NUL;	/* ensure string is null terminated */
***************
*** 128,131
      *next_str++ = NUL;	/* string is null terminated */
  
      return ret;
  }

--- 130,134 -----
      next_str += size;
  
+     ret[len] = NUL;	/* ensure string is null terminated */
      return ret;
  }
***************
*** 277,280
  
  #ifdef NOV
      db_read_group(gh, first_article, last_article);
  #else

--- 280,289 -----
  
  #ifdef NOV
+     /*
+      * Some trickery, since we normally avoid reading all of the
+      * XOVER or .overview data:
+      */
+     if (flags & ACC_ALSO_READ_ARTICLES)
+ 	first_article = gh->first_a_article;
      db_read_group(gh, first_article, last_article);
  #else
diff -c2 nn-6.5.0.b3/config.h-dist nn-6.5.0.b3+/config.h-dist
*** nn-6.5.0.b3/config.h-dist	Thu Feb 17 18:15:47 1994
--- nn-6.5.0.b3+/config.h-dist	Thu Dec 29 16:09:09 1994
***************
*** 495,498
  #define ART_GREP
  
  /************************ CONFIGURATION COMPLETED ************************/
  

--- 495,508 -----
  #define ART_GREP
  
+ /*
+  *	CACHE_PURPOSE
+  *	Defining this makes NN cache the newsgroup/purpose list, sorted
+  *	in memory and use binary search to locate a group's purpose.
+  *	This can be a winner on systems with *everything* in their
+  *	newsgroups list.
+  */
+ 
+ #define	CACHE_PURPOSE
+ 
  /************************ CONFIGURATION COMPLETED ************************/
  
diff -c2 nn-6.5.0.b3/db.c nn-6.5.0.b3+/db.c
*** nn-6.5.0.b3/db.c	Thu Nov 25 01:39:33 1993
--- nn-6.5.0.b3+/db.c	Mon Jan  2 13:38:56 1995
***************
*** 31,35
  static struct novgroup *ngovp;
  static struct novart *allarts;
! static HASHTABLE *grouptbl, *acttbl, *timtbl;
  
  extern long	atol();

--- 31,36 -----
  static struct novgroup *ngovp;
  static struct novart *allarts;
! static char **actlist, **grplist;
! static HASHTABLE *timtbl;
  
  extern long	atol();
***************
*** 34,38
  
  extern long	atol();
- extern char	*strsave();
  extern void novclose();		/* trash last group's data */
  #endif

--- 35,38 -----
  
  extern long	atol();
  extern void novclose();		/* trash last group's data */
  #endif
***************
*** 38,41
  #endif
  
  import char
  *master_directory, *db_directory, *db_data_directory, *news_directory,

--- 38,72 -----
  #endif
  
+ #ifdef	CACHE_PURPOSE
+ #include <ctype.h>
+ 
+ struct purp_list {
+     char *group_name;
+     char *purpose;
+ } *purp_list;
+ 
+ static void cache_purpose __APROTO((void));
+ static int purp_cnt;
+ #endif	/* CACHE_PURPOSE */
+ 
+ /*
+  * String pool allocation
+  */
+ typedef struct stlist {
+     struct stlist *next;
+     char str[0];
+ } stlist_t;
+ 
+ static char *strkeep __APROTO((char *s, int hdr, int poolid));
+ static char *pmalloc __APROTO((int size, int poolid));
+ static void pfree __APROTO((int poolid));
+ 
+ #define	POOL_GRP 0
+ #define	POOL_PUR 1
+ #define	POOL_ACT 2
+ #define	POOL_TIM 3
+ #define	POOL_MAX 3
+ #define	POOL_TMP 4
+ 
  import char
  *master_directory, *db_directory, *db_data_directory, *news_directory,
***************
*** 496,499
      }
  
      sort_groups();
  }

--- 527,540 -----
      }
  
+     /*
+      * Free actlist and timtbl space.
+      * Don't free grplist, because active_groups[] has pointers thereto.
+      */
+     pfree(POOL_ACT);
+     free(actlist);
+ 
+     pfree(POOL_TIM);
+     free(timtbl);
+ 
      sort_groups();
  
***************
*** 497,500
  
      sort_groups();
  }
  

--- 538,545 -----
  
      sort_groups();
+ 
+ #ifdef	CACHE_PURPOSE
+     cache_purpose();	/* cache sorted newsgroups and descriptions */
+ #endif
  }
  
***************
*** 563,566
  
      sort_groups();
  }
  #endif /* NOV */

--- 608,615 -----
  
      sort_groups();
+ 
+ #ifdef	CACHE_PURPOSE
+     cache_purpose();	/* cache sorted newsgroups and descriptions */
+ #endif
  }
  #endif /* NOV */
***************
*** 610,619
  	ngovp = NULL;
      }
-     if (acttbl != NULL)
- 	hashwalk(acttbl, freeup, (char *)acttbl);
-     if (grouptbl != NULL)
- 	hashwalk(grouptbl, freeup, (char *)grouptbl);
-     if (timtbl != NULL)
- 	hashwalk(timtbl, freeup, (char *)timtbl);
  #endif
  	

--- 659,662 -----
  	ngovp = NULL;
      }
  #endif
  	
***************
*** 910,924
  
  
- static char	*
- grpnumtoname(num)
- int	num;
- {
-     char acount[30];
-     if (grouptbl == NULL)
-         nn_exitmsg(50, "Oh no! I've lost the plot!\n");
-     sprintf(acount, "%ld", num);
-     return hashfetch(grouptbl, acount);
- }
- 
  static void
  setgrpname(gh)

--- 953,956 -----
  
  
  static void
  readactfile()
***************
*** 922,943
  
  static void
- setgrpname(gh)
- register group_header *gh;
- {
-     if (gh->group_name == NULL) {
-         /*
-          * how bleedin' useful!
-          * turn gh->group_num into gh->group_name.
-          * remember to spoon-feed nn with gh->group_name_length.
-          */
-         gh->group_name = grpnumtoname(gh->group_num);
-         if (gh->group_name == NULL) {  
- 	  nn_exitmsg(1, "nn: can't map group %d to name\n", gh->group_num);
-         }
-     }
-     gh->group_name_length = strlen(gh->group_name);
- }
- 
- static void
  readactfile()
  {

--- 954,957 -----
  
  static void
  readactfile()
  {
***************
*** 942,948
  readactfile()
  {
!   register int	count = 0;
!   char	actline[512];
!   FILE *actfp;
  
    if (acttbl != NULL)

--- 956,964 -----
  readactfile()
  {
!     char actline[512];
!     int count = 0;
!     int	i;
!     FILE *actfp;
!     stlist_t *sthead, *stp;
  
      if (actlist != NULL)
***************
*** 946,955
    FILE *actfp;
  
!   if (acttbl != NULL)
!     return;
!   acttbl = hashcreate(3000, (unsigned (*)())NULL);
!   if (acttbl == NULL) {
!     nn_exitmsg(1, "nn: can't create hash table\n");
!   }
  
    grouptbl = hashcreate(3000, (unsigned (*)())NULL);

--- 962,967 -----
      stlist_t *sthead, *stp;
  
!     if (actlist != NULL)
! 	return;
  
  #ifdef NNTP 
***************
*** 953,961
    }
  
-   grouptbl = hashcreate(3000, (unsigned (*)())NULL);
-   if (grouptbl == NULL) {
-     nn_exitmsg(1, "nn: can't create group table\n");
-   }
- 
  #ifdef NNTP 
    if (use_nntp) {

--- 965,968 -----
  	return;
  
  #ifdef NNTP 
      if (use_nntp) {
***************
*** 959,965
  
  #ifdef NNTP 
!   if (use_nntp) {
!     actfp = nntp_fopen_list("LIST");
!   } else
  #endif
      actfp = fopen(relative(news_lib_directory, "active"), "r");

--- 966,972 -----
  
  #ifdef NNTP 
!     if (use_nntp) {
! 	actfp = nntp_fopen_list("LIST");
!     } else
  #endif
  	actfp = fopen(relative(news_lib_directory, "active"), "r");
***************
*** 963,967
    } else
  #endif
!     actfp = fopen(relative(news_lib_directory, "active"), "r");
  
    if (actfp == NULL) {

--- 970,974 -----
      } else
  #endif
! 	actfp = fopen(relative(news_lib_directory, "active"), "r");
  
      if (actfp == NULL) {
***************
*** 965,971
      actfp = fopen(relative(news_lib_directory, "active"), "r");
  
!   if (actfp == NULL) {
!     nn_exitmsg(1, "could not fetch active file\n");
!   }
  
  #ifdef NNTP

--- 972,978 -----
  	actfp = fopen(relative(news_lib_directory, "active"), "r");
  
!     if (actfp == NULL) {
! 	nn_exitmsg(1, "could not fetch active file\n");
!     }
  
      /*
***************
*** 969,972
    }
  
  #ifdef NNTP
    while ( use_nntp  ?  nntp_fgets(actline, sizeof actline)

--- 976,984 -----
      }
  
+     /*
+      * Snarf all of active up in first pass.  This gives us a count
+      * of the groups we can use for internal tables.
+      */
+     sthead = NULL;
  #ifdef NNTP
      while ( use_nntp  ?  nntp_fgets(actline, sizeof actline)
***************
*** 970,975
  
  #ifdef NNTP
!   while ( use_nntp  ?  nntp_fgets(actline, sizeof actline)
! 		    :  fgets(actline, sizeof actline, actfp) )
  #else
    while ( fgets(actline, sizeof actline, actfp) )

--- 982,987 -----
      sthead = NULL;
  #ifdef NNTP
!     while ( use_nntp  ?  nntp_fgets(actline, sizeof actline)
! 		      :  fgets(actline, sizeof actline, actfp) )
  #else
      while ( fgets(actline, sizeof actline, actfp) )
***************
*** 973,977
  		    :  fgets(actline, sizeof actline, actfp) )
  #else
!   while ( fgets(actline, sizeof actline, actfp) )
  #endif
    {

--- 985,989 -----
  		      :  fgets(actline, sizeof actline, actfp) )
  #else
!     while ( fgets(actline, sizeof actline, actfp) )
  #endif
      {
***************
*** 975,983
    while ( fgets(actline, sizeof actline, actfp) )
  #endif
!   {
!     char	acount[30];
!     char	*line = strsave(actline);
!     char	*p = strchr(line, ' ');
!     char	*g;
  
      if (p != NULL)

--- 987,1006 -----
      while ( fgets(actline, sizeof actline, actfp) )
  #endif
!     {
! 	stlist_t *stnew = (stlist_t *)strkeep(actline,sizeof(stlist_t),POOL_ACT);
! 	if (stnew == NULL) {
! 	    nn_exitmsg(1, "out of mem for active file (at line %d)\n", count+1);
! 	}
! 	if (sthead != NULL) {
! 	    stp->next = stnew;
! 	    stp = stnew;
! 	}
! 	else {
! 	    sthead = stnew;
! 	    stp = sthead;
! 	}
! 	count++;
!     }
!     stp->next = NULL;
  
      if (!use_nntp)
***************
*** 981,990
      char	*g;
  
!     if (p != NULL)
!       *p = '\0';
!     g = strsave(line);
!     
!     if (!hashstore(acttbl, strsave(line), line)) {
!       nn_exitmsg(1, "nn: active hashstore failed\n");
      }
      (void) sprintf(acount, "%ld", count);

--- 1004,1015 -----
      stp->next = NULL;
  
!     if (!use_nntp)
! 	(void) fclose(actfp);
! 
!     actlist = (char **)calloc(count + 1, sizeof(char *));
!     grplist = (char **)calloc(count + 1, sizeof(char *));
!     if (grplist == NULL) {
! 	nn_exitmsg(1, "can't create active or group list (%d entries)\n",
! 		   count+1);
      }
  
***************
*** 988,999
        nn_exitmsg(1, "nn: active hashstore failed\n");
      }
-     (void) sprintf(acount, "%ld", count);
-     if (!hashstore(grouptbl, strsave(acount),  g)) {
-       nn_exitmsg(1, "nn: group hashstore failed\n");
-     }
-     if (p != NULL)
-       *p = ' ';
-     count++;
-   }
  
    if (!use_nntp)

--- 1013,1016 -----
  		   count+1);
      }
  
      /*
***************
*** 997,1002
    }
  
!   if (!use_nntp)
!     (void) fclose(actfp);
  
    /* init the master struct */

--- 1014,1023 -----
      }
  
!     /*
!      * Second pass (in core):
!      * Put active lines and group names into string arrays.
!      */
!     for (i = 0, stp = sthead; stp && i < count; stp = stp->next, i++) {
! 	char *p = strchr(stp->str, ' ');
  
  	if (p == NULL)
***************
*** 1000,1006
      (void) fclose(actfp);
  
!   /* init the master struct */
!   clearobj(&master, sizeof(master), 1);
!   master.number_of_groups = count;
  
  }

--- 1021,1034 -----
  	char *p = strchr(stp->str, ' ');
  
! 	if (p == NULL)
! 	    actlist[i] = NULL;
! 	else {
! 	    *p++ = NUL;
! 	    actlist[i] = p;
! 	}
! 	grplist[i] = strkeep(stp->str, 0, POOL_GRP);
!     }
!     actlist[count] = NULL;
!     grplist[count] = NULL;
  
      /* init the master struct */
***************
*** 1004,1007
    master.number_of_groups = count;
  
  }
  

--- 1032,1039 -----
      grplist[count] = NULL;
  
+     /* init the master struct */
+     clearobj(&master, sizeof(master), 1);
+     master.number_of_groups = count;
+ 
  }
  
***************
*** 1140,1145
  readtimfile()
  {
! 	char	timline[512];
! 	FILE	*timfp;
  
  	if (timtbl != NULL)

--- 1172,1178 -----
  readtimfile()
  {
!     char timline[512];
!     FILE *timfp;
!     int hsize;
  
      if (timtbl != NULL)
***************
*** 1143,1152
  	FILE	*timfp;
  
! 	if (timtbl != NULL)
! 		return;
! 	timtbl = hashcreate(500, (unsigned (*)())NULL);
! 	if (timtbl == NULL) {
! 		nn_exitmsg(1, "nn: can't create hash table\n");
! 	}
  
  #ifdef NNTP

--- 1176,1186 -----
      int hsize;
  
!     if (timtbl != NULL)
! 	return;
!     hsize = master.number_of_groups | 0x1ff;
!     timtbl = hashcreate(hsize, (unsigned (*)())NULL);
!     if (timtbl == NULL) {
! 	nn_exitmsg(1, "can't create time hash (%d entries)\n", hsize);
!     }
  
  #ifdef NNTP
***************
*** 1151,1157
  
  #ifdef NNTP
! 	if (use_nntp)
! 		timfp = nntp_fopen_list("LIST active.times");
! 	else
  #endif
  		timfp = fopen(relative(news_lib_directory, "active.times"), "r");

--- 1185,1191 -----
  
  #ifdef NNTP
!     if (use_nntp)
! 	timfp = nntp_fopen_list("LIST active.times");
!     else
  #endif
  	timfp = fopen(relative(news_lib_directory, "active.times"), "r");
***************
*** 1155,1159
  	else
  #endif
! 		timfp = fopen(relative(news_lib_directory, "active.times"), "r");
  
  	if (timfp == NULL)

--- 1189,1193 -----
      else
  #endif
! 	timfp = fopen(relative(news_lib_directory, "active.times"), "r");
  
      if (timfp == NULL)
***************
*** 1157,1162
  		timfp = fopen(relative(news_lib_directory, "active.times"), "r");
  
! 	if (timfp == NULL)
! 		return;		/* no great shakes if its missing */
  
  	/* alt.fan.marla-thrift 736668095 netnews@ccc.amdahl.com */

--- 1191,1196 -----
  	timfp = fopen(relative(news_lib_directory, "active.times"), "r");
  
!     if (timfp == NULL)
! 	return;		/* no great shakes if its missing */
  
      /* alt.fan.marla-thrift 736668095 netnews@ccc.amdahl.com */
***************
*** 1160,1164
  		return;		/* no great shakes if its missing */
  
! 	/* alt.fan.marla-thrift 736668095 netnews@ccc.amdahl.com */
  
  #ifdef NNTP

--- 1194,1198 -----
  	return;		/* no great shakes if its missing */
  
!     /* alt.fan.marla-thrift 736668095 netnews@ccc.amdahl.com */
  
  #ifdef NNTP
***************
*** 1163,1168
  
  #ifdef NNTP
! 	while ( use_nntp  ?  nntp_fgets(timline, sizeof timline)
! 			  :  fgets(timline, sizeof timline, timfp) )
  #else
  	while ( fgets(timline, sizeof timline, timfp) )

--- 1197,1202 -----
  
  #ifdef NNTP
!     while ( use_nntp  ?  nntp_fgets(timline, sizeof timline)
! 		      :  fgets(timline, sizeof timline, timfp) )
  #else
      while ( fgets(timline, sizeof timline, timfp)
***************
*** 1166,1170
  			  :  fgets(timline, sizeof timline, timfp) )
  #else
! 	while ( fgets(timline, sizeof timline, timfp) )
  #endif
  	{

--- 1200,1204 -----
  		      :  fgets(timline, sizeof timline, timfp) )
  #else
!     while ( fgets(timline, sizeof timline, timfp)
  #endif
      {
***************
*** 1168,1174
  	while ( fgets(timline, sizeof timline, timfp) )
  #endif
! 	{
! 		char	*line = strsave(timline);
! 		char	*p = strchr(line, ' ');
  
  		if (p != NULL)

--- 1202,1208 -----
      while ( fgets(timline, sizeof timline, timfp)
  #endif
!     {
! 	char *line = strkeep(timline, 0, POOL_TIM);
! 	char *p = strchr(line, ' ');
  
  	if (p == NULL)
***************
*** 1172,1182
  		char	*p = strchr(line, ' ');
  
! 		if (p != NULL)
! 			*p = '\0';
! 		if (!hashstore(timtbl, strsave(line), line)) {
! 			nn_exitmsg(1, "nn: time hashstore failed\n");
! 		}
! 		if (p != NULL)
! 			*p = ' ';
  	}
  	if (!use_nntp)

--- 1206,1214 -----
  	char *p = strchr(line, ' ');
  
! 	if (p == NULL)
! 	    continue;
! 	*p++ = NUL;
! 	if (!hashstore(timtbl, line, p)) {
! 	    nn_exitmsg(1, "nn: time hashstore failed\n");
  	}
      }
***************
*** 1180,1185
  			*p = ' ';
  	}
! 	if (!use_nntp)
! 		(void) fclose(timfp);
  
  }

--- 1212,1216 -----
  	    nn_exitmsg(1, "nn: time hashstore failed\n");
  	}
!     }
  
      if (!use_nntp)
***************
*** 1183,1186
  		(void) fclose(timfp);
  
  }
  #endif /* NOV */

--- 1214,1220 -----
      }
  
+     if (!use_nntp)
+ 	(void) fclose(timfp);
+ 
  }
  #endif /* NOV */
***************
*** 1186,1189
  #endif /* NOV */
  
  
  

--- 1220,1230 -----
  #endif /* NOV */
  
+ #ifdef	CACHE_PURPOSE
+ static int
+ purpcmp(p0, p1)
+ struct purp_list *p0, *p1;
+ {
+     return strcmp(p0->group_name, p1->group_name);
+ }
  
  /*
***************
*** 1187,1190
  
  
  
  #ifndef NOV

--- 1228,1243 -----
  }
  
+ /*
+  * Open purpose file and cache sorted list of group purposes
+  */
+ static void
+ cache_purpose()
+ {
+     char buf[512];
+     register char *p;
+     FILE *fp;
+     int i, ngrp;
+     stlist_t *sthead, *stp, *stnew;
+     struct purp_list *plp;
  
      if ((fp = open_purpose_file()) == NULL
***************
*** 1188,1191
  
  
  #ifndef NOV
  off_t db_read_art(f)

--- 1241,1334 -----
      struct purp_list *plp;
  
+     if ((fp = open_purpose_file()) == NULL
+ 	|| (ngrp = master.number_of_groups) == 0
+ 	|| purp_list != NULL)
+     {
+ 	return;
+     }
+ 
+     ngrp = 0;
+     sthead = NULL;
+     while (fgets(buf, sizeof(buf), fp) != NULL) {
+ 	if ((p = strchr(buf, NL)) != NULL) {
+ 	    *p = NUL;
+ 	}
+ 	stnew = (stlist_t *)strkeep(buf, sizeof(stlist_t), POOL_PUR);
+ 	if (stnew == NULL) {
+ 	    /* tough cookies.  we'll just do without. */
+ 	    pfree(POOL_PUR);
+ 	    return;
+ 	}
+ 	if (sthead != NULL) {
+ 	    stp->next = stnew;
+ 	    stp = stnew;
+ 	}
+ 	else {
+ 	    sthead = stnew;
+ 	    stp = sthead;
+ 	}
+ 	stnew->next = NULL;
+ 	ngrp++;
+     }
+ 
+     purp_list = (struct purp_list *)calloc(ngrp + 1, sizeof(struct purp_list));
+     if (purp_list == NULL) {
+ 	pfree(POOL_PUR);
+ 	return;
+     }
+ 
+     for (i = 0, plp = purp_list, stp = sthead; stp; stp = stp->next) {
+ 	p = stp->str;
+ 	while (!isspace(*p)) {	/* skip newsgroup name */
+ 	    if (*++p == NUL)
+ 		goto next;
+ 	}
+ 	*p++ = NUL;
+ 
+ 	while (isspace(*p)) {	/* skip to group description */
+ 	    if (*++p == NUL)
+ 		goto next;
+ 	}
+ 	plp->group_name = stp->str;
+ 	plp->purpose = p;
+ 	plp++;
+ 	i++;
+ next:
+ 	continue;
+     }
+     plp->group_name = NULL;
+     plp->purpose = NULL;
+     purp_cnt = i;
+ 
+     qsort(purp_list, purp_cnt, sizeof(struct purp_list), purpcmp);
+ 
+ }
+ 
+ char *
+ purp_lookup(group)
+ char *group;
+ {
+     register i, j, k, t;
+ 
+     i = 0;
+     j = purp_cnt - 1;
+ 
+     while (i <= j) {
+ 	k = (i + j) / 2;
+ 
+ 	if ( (t=strcmp(group, purp_list[k].group_name)) > 0)
+ 	    i = k+1;
+ 	else
+ 	if (t < 0)
+ 	    j = k-1;
+ 	else
+ 	    return purp_list[k].purpose;
+     }
+ 
+     return "";
+ }
+ #endif	/* CACHE_PURPOSE */
+ 
+ 
  #ifndef NOV
  off_t db_read_art(f)
***************
*** 1269,1273
  int	num;
  {
! 	register char	*line;
  
  	/* tidy up the struct */

--- 1412,1416 -----
  int	num;
  {
! 	register char	*p;
  
  	/* tidy up the struct */
***************
*** 1275,1279
  
  	gh->group_num = num;
! 	setgrpname(gh);
  	gh->master_flag = M_VALID;
  	/* control.newgrp, etc are control groups */

--- 1418,1428 -----
  
  	gh->group_num = num;
! 	if (gh->group_name == NULL) {
! 	    gh->group_name = grplist[num];
! 	    if (gh->group_name == NULL) {  
! 		nn_exitmsg(1, "can't map group %d to name\n", num);
! 	    }
! 	    gh->group_name_length = strlen(gh->group_name);
! 	}
  	gh->master_flag = M_VALID;
  	/* control.newgrp, etc are control groups */
***************
*** 1290,1299
  	/* set the creation time */
  	gh->creation_time = 1;                  /* group creation date (~epoch) */
! 	line = hashfetch(timtbl, gh->group_name);
! 	if (line != NULL) {
! 		register char	*p = strchr(line, ' ');
! 
! 		if (p != NULL)
! 			gh->creation_time = atol(p + 1);
  	}
  

--- 1439,1445 -----
  	/* set the creation time */
  	gh->creation_time = 1;                  /* group creation date (~epoch) */
! 	p = hashfetch(timtbl, gh->group_name);
! 	if (p != NULL) {
! 	    gh->creation_time = atol(p);
  	}
  
***************
*** 1298,1314
  	}
  
! 	line = hashfetch(acttbl, gh->group_name);
! 	if (line != NULL) {
! 		register char	*p = strchr(line, ' ');
! 
! 		if (p == NULL)
! 			return;
! 		p++;
! 		gh->last_a_article = atol(p);
! 		p = strchr(p, ' ');
! 		if (p == NULL)
! 			return;
! 		p++;
! 		gh->first_a_article = atol(p);
  	}
  	gh->first_db_article = gh->first_a_article; /* lowest # in ov. data */

--- 1444,1454 -----
  	}
  
! 	p = actlist[num];
! 	if (p != NULL) {
! 	    gh->last_a_article = atol(++p);
! 	    p = strchr(p, ' ');
! 	    if (p == NULL)
! 		return;
! 	    gh->first_a_article = atol(++p);
  	}
  	gh->first_db_article = gh->first_a_article; /* lowest # in ov. data */
***************
*** 1344,1348
  		return;
  	}
! 	allarts = novall(ngovp);
  	if (allarts == NULL) {
  		/*

--- 1484,1488 -----
  		return;
  	}
! 	allarts = novall(ngovp, first, last);
  	if (allarts == NULL) {
  		/*
***************
*** 1693,1694
  }
  #endif /* NOV */

--- 1833,1969 -----
  }
  #endif /* NOV */
+ 
+ #if defined(NOV) || defined(CACHE_PURPOSE)
+ /*
+  * pmalloc()/pfree():
+  *	A scheme to avoid malloc()/free() overhead; handles memory in
+  *	STRCHUNK increments (deliberately same as STR_THUNK_SIZE).
+  *	Unlike mark_str()/alloc_str()/release_str(), pfree()'d memory
+  *	returns to the malloc() pool, which is arguably more social.
+  *	More important, the alloc_str() family assumes only one active
+  *	use at a time; interleaving uses or a misplaced release_str() has
+  *	the potential to leak memory or corrupt the current_str_t pool.
+  *
+  *	Perhaps should be globally available; move to global.c?
+  */
+ #define	STRCHUNK	((1<<14) - 32)	/* leave room for malloc header */
+ 
+ typedef struct stpool {
+     stlist_t *sthead;
+     char *pool;
+     int pfree;
+     int pslop;
+ } stpool_t;
+ 
+ static stpool_t stpool[POOL_MAX+1];
+ 
+ static char *
+ pmalloc(size, poolid)
+     int size, poolid;
+ {
+     register stpool_t *pp;
+     register stlist_t *stnew;
+     register char *ret;
+ 
+     if (poolid < 0 || poolid > POOL_MAX)
+ 	return NULL;
+ 
+     pp = &stpool[poolid];
+     if (size <= pp->pfree) {
+ 	/* Usually short; fits into current chunk */
+ 	ret = pp->pool;
+     }
+     else if (size <= STRCHUNK) {
+ 	/* Sometimes chunk is exhausted; chain new one to pool */
+ 	stnew = (stlist_t *)malloc(sizeof(stlist_t) + STRCHUNK);
+ 	if (stnew == NULL)
+ 	    return NULL;
+ 	pp->pslop += pp->pfree;
+ 	stnew->next = pp->sthead;
+ 	pp->sthead = stnew;
+ 	pp->pfree = STRCHUNK;
+ 	ret = stnew->str;
+     }
+     else {
+ 	/*
+ 	 * Last resort: allocate oversize chunk and chain to pool
+ 	 * behind current chunk.
+ 	 */
+ 	stnew = (stlist_t *)malloc(sizeof(stlist_t) + size);
+ 	if (stnew == NULL)
+ 	    return NULL;
+ 	if (pp->sthead != NULL) {
+ 	    stnew->next = pp->sthead->next;
+ 	    pp->sthead->next = stnew;
+ 	}
+ 	else {
+ 	    stnew->next = NULL;
+ 	    pp->sthead = stnew;
+ 	}
+ 	return stnew->str;
+ 	/*NOTREACHED*/
+     }
+ 
+     pp->pool = ret + size;
+     pp->pfree -= size;
+     return ret;
+ }
+ 
+ static void
+ pfree(poolid)
+     int poolid;
+ {
+     register stpool_t *pp;
+     register stlist_t *stp, *stnext;
+ 
+     if (poolid < 0 || poolid > POOL_MAX)
+ 	return;
+ 
+     pp = &stpool[poolid];
+     stp = pp->sthead;
+     for (stp = pp->sthead; stp; stp = stnext) {
+ 	stnext = stp->next;
+ 	free(stp);
+ 	stp = stnext;
+     }
+     pp->sthead = NULL;
+     pp->pool = NULL;
+     pp->pfree = 0;
+     pp->pslop = 0;
+ }
+ 
+ 
+ /*
+  * strkeep()
+  *	Save a string, allowing space for a header.
+  */
+ char *
+ strkeep(s, hdr, poolid)
+ char *s;
+ int hdr;
+ int poolid;
+ {
+     register int size;
+     register char *ret;
+     register stpool_t *pp;
+     register stlist_t *stnew;
+ 
+     if (poolid == POOL_TMP) {
+ 	size = hdr + strlen(s);
+ 	ret = alloc_str(size);
+     }
+     else {
+ 	size = (hdr + strlen(s) + sizeof(int)) & ~(sizeof(int) - 1);
+ 	ret = pmalloc(size, poolid);
+     }
+ 
+     if (ret)
+ #ifdef NO_MEMCPY
+ 	bcopy(s, ret+hdr, size-hdr);
+ #else
+ 	memcpy(ret+hdr, s, size-hdr);
+ #endif /* NO_MEMCPY */
+ 
+     return ret;
+ }
+ #endif	/* NOV || CACHE_PURPOSE */
diff -c2 nn-6.5.0.b3/global.h nn-6.5.0.b3+/global.h
*** nn-6.5.0.b3/global.h	Thu Feb 17 18:15:48 1994
--- nn-6.5.0.b3+/global.h	Sat Dec 31 10:39:43 1994
***************
*** 8,11
  #define _NN_GLOBAL_H 1
  
  #include <stdlib.h>
  #include <malloc.h>

--- 8,13 -----
  #define _NN_GLOBAL_H 1
  
+ #if 0
+ /* XXX these should be moved to the pertinent conf/s-*.h files */
  #include <stdlib.h>
  #include <malloc.h>
***************
*** 10,13
  #include <stdlib.h>
  #include <malloc.h>
  /*
   *	Marks for global/external variables

--- 12,17 -----
  #include <stdlib.h>
  #include <malloc.h>
+ #endif
+ 
  /*
   *	Marks for global/external variables
***************
*** 156,161
  #define I_AM_POST	7
  #define I_AM_GREP	8
! #define	I_AM_DAILY	9
! #define	I_AM_SPEW	10
  #define I_AM_EXPIRE	11
  #define	I_AM_ACCT	12

--- 160,165 -----
  #define I_AM_POST	7
  #define I_AM_GREP	8
! #define I_AM_DAILY	9
! #define I_AM_SPEW	10
  #define I_AM_EXPIRE	11
  #define I_AM_ACCT	12
***************
*** 159,163
  #define	I_AM_SPEW	10
  #define I_AM_EXPIRE	11
! #define	I_AM_ACCT	12
  
  extern unsigned short		/* as they are on most systems... */

--- 163,168 -----
  #define I_AM_SPEW	10
  #define I_AM_EXPIRE	11
! #define I_AM_ACCT	12
! #define I_AM_VIEW	13
  
  extern unsigned short		/* as they are on most systems... */
***************
*** 651,655
  int	nntp_get_active		__APROTO((void));
  FILE *	nntp_get_newsgroups	__APROTO((void));
! struct novgroup *nntp_get_overview	__APROTO((group_header *gh, int low, int high));
  FILE *	nntp_fopen_list		__APROTO((char *cmd));
  char *	nntp_fgets		__APROTO((char *buf, int size));

--- 656,661 -----
  int	nntp_get_active		__APROTO((void));
  FILE *	nntp_get_newsgroups	__APROTO((void));
! struct novgroup *nntp_get_overview	__APROTO((group_header *gh,
! 				article_number low, article_number high));
  FILE *	nntp_fopen_list		__APROTO((char *cmd));
  char *	nntp_fgets		__APROTO((char *buf, int size));
diff -c2 nn-6.5.0.b3/group.c nn-6.5.0.b3+/group.c
*** nn-6.5.0.b3/group.c	Mon Sep 13 10:42:19 1993
--- nn-6.5.0.b3+/group.c	Fri Dec 30 15:42:44 1994
***************
*** 837,841
      if (gh != orig_group) goto enter_new_level;
  
!     if (!only_unread_articles && gh->current_first <= gh->first_db_article) {
  	msg("No extra articles");
  	goto_return(ME_NO_REDRAW);

--- 837,847 -----
      if (gh != orig_group) goto enter_new_level;
  
!     if (!only_unread_articles)
! #ifdef NOV
! 	if (gh->current_first <= gh->first_a_article)
! #else
! 	if (gh->current_first <= gh->first_db_article)
! #endif /* NOV */
!     {
  	msg("No extra articles");
  	goto_return(ME_NO_REDRAW);
***************
*** 842,845
      }
  
      if (first < gh->first_db_article) first = gh->first_db_article;
  

--- 848,854 -----
      }
  
+ #ifdef NOV
+     if (first < gh->first_a_article) first = gh->first_a_article;
+ #else
      if (first < gh->first_db_article) first = gh->first_db_article;
  #endif /* NOV */
***************
*** 843,846
  
      if (first < gh->first_db_article) first = gh->first_db_article;
  
      if (access_group(gh, first, only_unread_articles ?

--- 852,856 -----
  #else
      if (first < gh->first_db_article) first = gh->first_db_article;
+ #endif /* NOV */
  
      if (access_group(gh, first, only_unread_articles ?
diff -c2 nn-6.5.0.b3/hdbm.c nn-6.5.0.b3+/hdbm.c
*** nn-6.5.0.b3/hdbm.c	Sat Oct  2 04:33:38 1993
--- nn-6.5.0.b3+/hdbm.c	Thu Dec 29 15:39:19 1994
***************
*** 66,70
  static int reusables = 0;
  
! static unsigned				/* not yet taken modulus table size */
  hdbmdef(key)
  HDBMDATUM key;

--- 66,74 -----
  static int reusables = 0;
  
! /*
!  * Gosling EMACS hash (h = 33*h + *s++) optimized, loop unrolled with
!  * "Duff's Device".  Thanks to Chris Torek.
!  */
! static unsigned
  hdbmdef(key)
  register HDBMDATUM key;
***************
*** 68,72
  static unsigned				/* not yet taken modulus table size */
  hdbmdef(key)
! HDBMDATUM key;
  {
  	register char *s = key.dat_ptr;

--- 72,76 -----
  static unsigned
  hdbmdef(key)
! register HDBMDATUM key;
  {
  	register unsigned char *s = (unsigned char *)key.dat_ptr;
***************
*** 70,76
  HDBMDATUM key;
  {
! 	register char *s = key.dat_ptr;
! 	register unsigned len = key.dat_len;
! 	register unsigned hash = 0;
  
  	while (len-- > 0)

--- 74,81 -----
  register HDBMDATUM key;
  {
! 	register unsigned char *s = (unsigned char *)key.dat_ptr;
! 	register int len = key.dat_len;
! 	register unsigned h;
! 	register int loop;
  
  #define HASHC   h = (h << 5) + h + *s++;
***************
*** 74,80
  	register unsigned hash = 0;
  
! 	while (len-- > 0)
! 		hash += *s++;
! 	return hash;
  }
  

--- 79,111 -----
  	register int loop;
  
! #define HASHC   h = (h << 5) + h + *s++;
! 
! 	h = 0;
! 	if (len > 0) {
! 		loop = (len + 8 - 1) >> 3;
! 
! 		switch (len & (8 - 1)) {
! 		case 0:
! 			do {	/* All fall throughs */
! 				HASHC;
! 		case 7:
! 				HASHC;
! 		case 6:
! 				HASHC;
! 		case 5:
! 				HASHC;
! 		case 4:
! 				HASHC;
! 		case 3:
! 				HASHC;
! 		case 2:
! 				HASHC;
! 		case 1:
! 				HASHC;
! 			} while (--loop);
! 		}
! 
! 	}
! 	return (h);
  }
  
diff -c2 nn-6.5.0.b3/libnov.c nn-6.5.0.b3+/libnov.c
*** nn-6.5.0.b3/libnov.c	Wed Nov 10 01:39:28 1993
--- nn-6.5.0.b3+/libnov.c	Fri Dec 30 16:43:02 1994
***************
*** 121,124
  }
  
  struct novart *
  novall(gp)

--- 121,182 -----
  }
  
+ /*
+  * novseek()
+  *	For local overview file, use binary search to find first line
+  *	which is at artnum or before.
+  *	Ripped off from inn1.4/nnrpd/newnews.c
+  */
+ novseek(fp, artnum)
+ register FILE *fp;
+ register int artnum;
+ {
+     char	*line;
+     long	upper;
+     long	lower;
+     long	middle;
+ 
+     /* Read first line -- is it in our range? */
+     (void)fseek(fp, 0L, 0);
+     if ((line = fgetstr(fp)) == NULL)
+ 	return 0;
+     if (atol(line) >= artnum) {
+ 	(void)fseek(fp, 0L, 0);
+ 	return 1;
+     }
+ 
+     /* Set search ranges and go. */
+     lower = 0;
+     (void)fseek(fp, 0L, 2);
+     upper = ftell(fp);
+     for ( ; ; ) {
+ 	/* Seek to middle line. */
+ 	middle = (upper + lower) / 2;
+ 	(void)fseek(fp, middle, 0);
+ 	while (getc(fp) != '\n' && ++middle <= upper)
+ 	    continue;
+ 
+ 	if (middle >= upper)
+ 	    break;
+ 
+ 	if ((line = fgetstr(fp)) != NULL && atol(line) > artnum)
+ 	    upper = middle;
+ 	else if (lower == middle)
+ 	    break;
+ 	else
+ 	    lower = middle;
+     }
+ 
+     /* Move to lower bound; we know this will always be the start of a line. */
+     (void)fseek(fp, lower, 0);
+     while ((line = fgetstr(fp)) != NULL)
+ 	if (atol(line) >= artnum) {
+ 	    (void)fseek(fp, lower, 0);
+ 	    return 1;
+ 	}
+ 
+     return 0;
+ }
+ 
+ 
  struct novart *
  novall(gp, first, last)
***************
*** 122,126
  
  struct novart *
! novall(gp)
  register struct novgroup *gp;
  {

--- 180,184 -----
  
  struct novart *
! novall(gp, first, last)
  register struct novgroup *gp;
  register int first, last;
***************
*** 124,127
  novall(gp)
  register struct novgroup *gp;
  {
  	if (gp->g_first == NULL)	/* new group? */

--- 182,186 -----
  novall(gp, first, last)
  register struct novgroup *gp;
+ register int first, last;
  {
  	if (gp->g_first == NULL)	/* new group? */
***************
*** 126,130
  {
  	if (gp->g_first == NULL)	/* new group? */
! 		(void) prsoverview(gp);
  	return gp->g_first;
  }

--- 185,189 -----
  {
  	if (gp->g_first == NULL)	/* new group? */
! 		(void) prsoverview(gp, first, last);
  	return gp->g_first;
  }
***************
*** 233,237
  
  static int
! prsoverview(gp)
  register struct novgroup *gp;			/* cookie from novopen */
  {

--- 292,296 -----
  
  static int
! prsoverview(gp, first, last)
  register struct novgroup *gp;			/* cookie from novopen */
  register int first, last;
***************
*** 235,238
  prsoverview(gp)
  register struct novgroup *gp;			/* cookie from novopen */
  {
  	register struct novart *art, *prevart = NULL;

--- 294,298 -----
  prsoverview(gp, first, last)
  register struct novgroup *gp;			/* cookie from novopen */
+ register int first, last;
  {
  	register struct novart *art, *prevart = NULL;
***************
*** 238,241
  	register struct novart *art, *prevart = NULL;
  	register int prssts;
  	char *line;
  

--- 298,302 -----
  	register struct novart *art, *prevart = NULL;
  	register int prssts;
+ 	int hsize;
  	char *line;
  
***************
*** 254,258
  
  	/* parse input and store in gp->g_msgids for later traversal */
! 	gp->g_msgids = hashcreate(200, (unsigned (*)())NULL);
  	if (gp->g_msgids == NULL) {
  		if (gp->g_dir != NULL)		/* we opened the stream? */

--- 315,320 -----
  
  	/* parse input and store in gp->g_msgids for later traversal */
! 	hsize = (last - first) | 0x7f;
! 	gp->g_msgids = hashcreate(hsize, (unsigned (*)())NULL);
  	if (gp->g_msgids == NULL) {
  		if (gp->g_dir != NULL)		/* we opened the stream? */
***************
*** 261,264
  	}
  
  	while ((line = fgetstr(gp->g_stream)) != NULL) {
  		if (strcmp(line, ".") == 0) /* EOF on a NNTP stream */

--- 323,330 -----
  	}
  
+ 	if (!use_nntp) {
+ 		if (!novseek(gp->g_stream, first))
+ 			goto done;
+ 	}
  	while ((line = fgetstr(gp->g_stream)) != NULL) {
  		if (strcmp(line, ".") == 0) /* EOF on a NNTP stream */
***************
*** 277,280
  			freeart(art);
  	}
  	if (gp->g_dir != NULL)		/* we opened the stream? */
  		(void) fclose(gp->g_stream);

--- 343,347 -----
  			freeart(art);
  	}
+ done:
  	if (gp->g_dir != NULL)		/* we opened the stream? */
  		(void) fclose(gp->g_stream);
***************
*** 344,345
  	}
  }

--- 411,413 -----
  	}
  }
+ 
diff -c2 nn-6.5.0.b3/menu.c nn-6.5.0.b3+/menu.c
*** nn-6.5.0.b3/menu.c	Sat Oct  2 04:33:53 1993
--- nn-6.5.0.b3+/menu.c	Thu Dec 29 15:46:34 1994
***************
*** 934,937
  char *purpose;
  {
      FILE *f;
      char line[256], *group;

--- 934,946 -----
  char *purpose;
  {
+ #ifdef	CACHE_PURPOSE
+     register char *cp;
+     extern char *purp_lookup();
+ 
+     cp = purp_lookup(current_group->group_name);
+     strncpy(purpose, cp, 76);
+     return;
+ 
+ #else
      FILE *f;
      char line[256], *group;
***************
*** 957,960
  	*pp = NUL;
      }
  }
  

--- 966,970 -----
  	*pp = NUL;
      }
+ #endif	/* CACHE_PURPOSE */
  }
  
diff -c2 nn-6.5.0.b3/more.c nn-6.5.0.b3+/more.c
*** nn-6.5.0.b3/more.c	Sat Oct  2 04:33:56 1993
--- nn-6.5.0.b3+/more.c	Sat Dec 31 11:37:18 1994
***************
*** 15,19
  /* more.c */
  
! static void do_auto_select __APROTO((void));
  static char *a_st_flags __APROTO((flag_type flag));
  static void brief_header_line __APROTO((register article_header *ah, int lno));

--- 15,19 -----
  /* more.c */
  
! static void more_auto_select __APROTO((void));
  static char *a_st_flags __APROTO((flag_type flag));
  static void brief_header_line __APROTO((register article_header *ah, int lno));
***************
*** 229,233
  
  static void
! do_auto_select()
  {
      register article_header *ah;

--- 229,233 -----
  
  static void
! more_auto_select()
  {
      register article_header *ah;
***************
*** 1246,1250
  	switch (kill_menu(ah)) {
  	 case 0:
! 	    do_auto_select();
  	    ah->attr = 0;
  	    break;

--- 1246,1250 -----
  	switch (kill_menu(ah)) {
  	 case 0:
! 	    more_auto_select();
  	    ah->attr = 0;
  	    break;
diff -c2 nn-6.5.0.b3/news.c nn-6.5.0.b3+/news.c
*** nn-6.5.0.b3/news.c	Tue Aug 31 14:06:06 1993
--- nn-6.5.0.b3+/news.c	Wed Dec 28 16:15:41 1994
***************
*** 238,241
      FILE *f;
      struct stat statb;
  #ifdef NNTP
      int lazy;

--- 238,242 -----
      FILE *f;
      struct stat statb;
+     off_t digest_artlen;
  #ifdef NNTP
      int lazy;
***************
*** 244,247
  #endif /* NNTP */
  
      if (art->flag & A_FOLDER) {
  	f = open_file(group_path_name, OPEN_READ);

--- 245,249 -----
  #endif /* NNTP */
  
+     digest_artlen = 0;
      if (art->flag & A_FOLDER) {
  	f = open_file(group_path_name, OPEN_READ);
***************
*** 248,251
  	if (f == NULL) return NULL;
  	fseek(f, art->hpos, 0);
      }
  #ifdef NNTP

--- 250,254 -----
  	if (f == NULL) return NULL;
  	fseek(f, art->hpos, 0);
+ 	digest_artlen = art->lpos - art->fpos;
      }
  #ifdef NNTP
***************
*** 343,347
  #endif /* NNTP */
  	    news.ng_lines = 0;
! 	    while ((c = getc(f)) != EOF)
  		if (c == '\n')
  		    news.ng_lines++;

--- 346,350 -----
  #endif /* NNTP */
  	    news.ng_lines = 0;
! 	    while ((c = getc(f)) != EOF) {
  		if (c == '\n')
  		    news.ng_lines++;
***************
*** 346,349
  		if (c == '\n')
  		    news.ng_lines++;
  #else /* DONT_COUNT_LINES */
  	    news.ng_lines = -1;

--- 349,355 -----
  		if (c == '\n')
  		    news.ng_lines++;
+ 		if (digest_artlen && --digest_artlen == 0)
+ 		    break;
+ 	    }
  #else /* DONT_COUNT_LINES */
  	    news.ng_lines = -1;
diff -c2 nn-6.5.0.b3/nn.c nn-6.5.0.b3+/nn.c
*** nn-6.5.0.b3/nn.c	Wed Nov 10 01:39:29 1993
--- nn-6.5.0.b3+/nn.c	Mon Dec 19 12:25:42 1994
***************
*** 150,153
       case I_AM_GREP:
       case I_AM_SPEW:
  	return 0;		/* will not update .newsrc */
      }

--- 150,154 -----
       case I_AM_GREP:
       case I_AM_SPEW:
+      case I_AM_VIEW:
  	return 0;		/* will not update .newsrc */
      }
***************
*** 774,777
  	who_am_i = I_AM_POST;
      } else
      if (strcmp(pname, "nnbatch") == 0) {
  	who_am_i = I_AM_NN;

--- 775,781 -----
  	who_am_i = I_AM_POST;
      } else
+     if (strcmp(pname, "nnview") == 0) {
+ 	who_am_i = I_AM_VIEW;
+     } else
      if (strcmp(pname, "nnbatch") == 0) {
  	who_am_i = I_AM_NN;
***************
*** 782,786
  #ifdef NOV
  # ifdef NOV_DIRECTORY
!     novartdir(NOV_DIRECTORY);
  # endif
  #endif

--- 786,791 -----
  #ifdef NOV
  # ifdef NOV_DIRECTORY
!     if (who_am_i != I_AM_VIEW)
! 	novartdir(NOV_DIRECTORY);
  # endif
  #endif
***************
*** 845,849
   nnspew:
  
!     open_master(OPEN_READ);
  
      switch (who_am_i) {

--- 850,855 -----
   nnspew:
  
!     if (who_am_i != I_AM_VIEW)
! 	open_master(OPEN_READ);
  
      switch (who_am_i) {
***************
*** 849,852
      switch (who_am_i) {
  
       case I_AM_NN:
  	visit_init_file(0, argv[1]);

--- 855,861 -----
      switch (who_am_i) {
  
+      case I_AM_VIEW:
+ 	/*FALLTHROUGH*/
+ 
       case I_AM_NN:
  	visit_init_file(0, argv[1]);
***************
*** 966,969
      if (!silent && who_am_i != I_AM_CHECK)
  	prt_version();
  
      if (nn_locked()) nn_exit(2);

--- 975,986 -----
      if (!silent && who_am_i != I_AM_CHECK)
  	prt_version();
+ 
+     if (who_am_i == I_AM_VIEW) {
+ 	named_group_sequence(argv + 1);
+ 	count_unread_articles();
+ 	if (read_news(access_mode, mask))
+ 	    clrdisp();
+ 	nn_exit(0);
+     }
  
      if (nn_locked()) nn_exit(2);
diff -c2 nn-6.5.0.b3/xmakefile nn-6.5.0.b3+/xmakefile
*** nn-6.5.0.b3/xmakefile	Wed Nov 10 01:39:31 1993
--- nn-6.5.0.b3+/xmakefile	Mon Dec 19 12:39:55 1994
***************
*** 68,72
  
  BIN_PROG =	nn NNMAIL nnusage nngrab nnstats ACCOUNT
! BIN_LINK =	nncheck nnadmin nntidy nngoback nngrep nnpost nnbatch
  LIB_PROG =	aux upgrade_rc
  #ifdef NOV

--- 68,72 -----
  
  BIN_PROG =	nn NNMAIL nnusage nngrab nnstats ACCOUNT
! BIN_LINK =	nncheck nnadmin nntidy nngoback nngrep nnpost nnbatch nnview
  LIB_PROG =	aux upgrade_rc
  #ifdef NOV
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads