[comp.sources.d] vn update - NNTP, "all.all" bug, enhancements

bobm@rtech.UUCP (Bob McQueer) (03/09/88)

Since I've been running an NNTP'ed vn myself for several months, and a couple
folks have been soaking it at a couple other sites as well, I'm sending
a "vn NNTP conversion kit" out to comp.sources.unix.  This conversion
is also backwards compatible to compile a non-NNTP version.  Any diffs
against the files involved (std.c, config_std.h) I might issue in the
future will be against these, so you might pick it up even if you
aren't interested in talking to NNTP.

There turns out to be a bug in the handling of "all" in option strings
for -n options.  Basically, if you specify a string with multiple
all's in it, such as "all.all", the regular expression it gets turned
into is wrong, usually resulting in "No News" since "..*ll" only matches
a few groups like rec.sport.football.  Basically, if you go into std.c,
and find a for loop involving a call to "findall", all references to the
variable "s" in the innards of that loop should be "ptr" instead, which points
into the middle of the s string after the first loop iteration.  The
fix will be reflected in the NNTP conversion posted, and I'll attach a
diff to the end of this article.

I picked up the fix for specifying a mode on the open (..O_CREATE..) call.
Thank you.  Since the file is unlinked immediately after open'ing, as long
as your system doesn't care about bogus mode bits, the mode really doesn't
matter, which is why it's been working most places.  Nonetheless, it should
have a mode.

I will send that fix out together with a group of enhancements:

Two new keys, (> and <) to page by newsgroup rather than by page.

Enhancements to the server interface allowing the server layer to
know about article marks.  This is the hook which one could hang
retaining a few non-consecutive articles in the .newsrc from.  I'm not
planning on adding such a feature, but the hook will be there for it.
It would still take a good bit of work to implement the feature in std.c.
I mainly thought about this because I HAVE been toying with the idea
of using vn as an interface to one's mailbox & mail folders, where
my argument that the "article" expires before you get a chance to
come back to it anyway doesn't hold.  I was curious to see a
reference to this idea in Rich's editorial comment on the archive.

A couple people have brought up saving articles in mailbox format.
Again, I've enhanced the server layer a bit to allow a little more
control over the save operation, and allow the user a toggle (+ key)
for the save mode of articles.  I also saw the need for enhancing
the interface a little bit if you wanted to use it as a mailer -
you need to open folders based on the .mailrc.  Saving in mailbox
format is something I would like myself, so I might implement it
as well as providing the hooks.

All these new server hooks are in the form of initially NULL function
pointers that the server layer can optionally define if it sees fit.

I'll post the enhancements as a set of patches separate from the NNTP
conversion.

"all.all" fix follows, context diff generated by rcs:

--------
RCS file: RCS/std.c,v
retrieving revision 6.0
diff -c -r6.0 std.c
*** /tmp/,RCSt1027033	Tue Mar  8 18:10:29 1988
--- std.c	Tue Mar  8 18:09:34 1988
***************
*** 636,642
  	/* convert "all" not bounded by alphanumerics to ".*". ".all" becomes ".*" */
  	for (ptr = s; (len = findall(ptr)) >= 0; ptr += len+1)
  	{
! 		if (len > 0 && isalnum (s[len-1]))
  			continue;
  		if (isalnum (s[len+3]))
  			continue;

--- 636,642 -----
  	/* convert "all" not bounded by alphanumerics to ".*". ".all" becomes ".*" */
  	for (ptr = s; (len = findall(ptr)) >= 0; ptr += len+1)
  	{
! 		if (len > 0 && isalnum (ptr[len-1]))
  			continue;
  		if (isalnum (ptr[len+3]))
  			continue;
***************
*** 638,644
  	{
  		if (len > 0 && isalnum (s[len-1]))
  			continue;
! 		if (isalnum (s[len+3]))
  			continue;
  		if (len > 0 && s[len-1] == '.')
  		{

--- 638,644 -----
  	{
  		if (len > 0 && isalnum (ptr[len-1]))
  			continue;
! 		if (isalnum (ptr[len+3]))
  			continue;
  		if (len > 0 && ptr[len-1] == '.')
  		{
***************
*** 640,646
  			continue;
  		if (isalnum (s[len+3]))
  			continue;
! 		if (len > 0 && s[len-1] == '.')
  		{
  			--len;
  			strcpy (s+len,s+len+1);

--- 640,646 -----
  			continue;
  		if (isalnum (ptr[len+3]))
  			continue;
! 		if (len > 0 && ptr[len-1] == '.')
  		{
  			--len;
  			strcpy (ptr+len,ptr+len+1);
***************
*** 643,649
  		if (len > 0 && s[len-1] == '.')
  		{
  			--len;
! 			strcpy (s+len,s+len+1);
  		}
  		s[len] = '.';
  		s[len+1] = '*';

--- 643,649 -----
  		if (len > 0 && ptr[len-1] == '.')
  		{
  			--len;
! 			strcpy (ptr+len,ptr+len+1);
  		}
  		ptr[len] = '.';
  		ptr[len+1] = '*';
***************
*** 645,653
  			--len;
  			strcpy (s+len,s+len+1);
  		}
! 		s[len] = '.';
! 		s[len+1] = '*';
! 		strcpy (s+len+2,s+len+3);
  	}
  
  	/* now use regular expressions */

--- 645,653 -----
  			--len;
  			strcpy (ptr+len,ptr+len+1);
  		}
! 		ptr[len] = '.';
! 		ptr[len+1] = '*';
! 		strcpy (ptr+len+2,ptr+len+3);
  	}
  
  	/* now use regular expressions */

{amdahl, sun, mtxinu, hoptoad, cpsc6a}!rtech!bobm