[alt.sources] vn patches

bobm@rtech.UUCP (Bob Mcqueer) (01/08/88)

OK, here's a bunch of diffs to correct the problem list I referred to a
week or two ago.  This includes Greg Earle's MORE=-c display optimization.
By file:

digest.c - fix bug causing followups / mail on digests to fail.  Changes
	page display on digest extractions a bit.

envir_set.c - MORE=-c optimization

hash.c - handle duplicate active list records more gracefully.  Fix an
	an excessive allocation.

reader.c - MORE=-c optimization, fix digest extraction problems.

session.c - fix digest extraction - clean up temp files properly.

sig_set.c - RESTART for terminals requiring it.

std.c - allow NEWSRC assignment to a different filesystem than the user's
	HOME.  Fix problem causing a crash on a screwed up article with
	no possible line to use for a mail reply.  define MAXPATHLEN if
	not defined (SYS V).

strings.c - stamp this set of patches as a new version.

svart.c - fix mkdir() for SYS V.  Note: somebody sent me their mkdir()
	cover which tracked back the directory string, producing all the
	neccesary directory levels (actually they snitched it from rn).
	Logically, that should really be done here for both BSD & SYSV,
	but would only matter if somebody wanted to put %s in the MIDDLE
	of their VNSAVE variable, or wanted vn to create several levels
	of directory for the them the first time they save an article.
	As I had already stuck in what I have here, I didn't put it in.
	And everybody can stop telling me to spawn a "mkdir" command on
	SYS V now :-).

vn.c - history update

vnglob.c - MORE=-c feature

vn.man - MORE=-c feature

	NOTE concerning terminfo:

	I've been informed that tgetflag("bs") doesn't work in the terminfo
	termcap covers.  It seems to me that terminfo is at fault here, and
	I don't want to issue a general patch to work around that.  If
	this is your situation, the easiest thing for you to do is simply
	replace the tgetflag("bs"); line in term_set.c with 1, and blow
	off any terminals which don't handle backspace.  If you want to be
	a bit more complicated modify things so that you assume backspace
	works if there is no "bc" string.  It shouldn't be a major problem
	anyway - all that will happen is that rubout sequences won't work
	right (you'll just space).  That is assuming your terminal has a
	clear to end.  If it doesn't, this would mess up clear to end also.
	Either of the suggested solutions is definitely something you only
	want to do to use terminfo, since you could theoretically be screwing
	up some particular terminal.

	NOTE concerning name lengths:

	I looked over the objects, and found that the only symbols I
	had which were not unique to within 7 characters were the two
	routines digest_extract() and digest_page().  I probably should
	have fixed that while I was doing this, but I forgot.

The diffs were obtained by running rcsdiff -c -r5.0 <files>, revision 5.0
being the stuff posted in alt.sources.  My apologies if it requires too
much jiggery-pokery to make them go through the various patchamatics
out there.
---------- cut here ---------------
digest.c
envir_set.c
hash.c
reader.c
session.c
sig_set.c
std.c
strings.c
svart.c
vn.c
vnglob.c
vn.man
RCS file: RCS/digest.c,v
retrieving revision 5.0
diff -c -r5.0 digest.c
*** /tmp/,RCSt1010535	Thu Jan  7 10:59:38 1988
--- digest.c	Wed Jan  6 13:04:14 1988
***************
*** 36,42
  digest_page (idx,skip)
  int idx;
  {
! 	char *ptr,name[24],*title,*index();
  	FILE *fp;
  	int i,len,hl;
  	char subj[RECLEN],date[RECLEN],from[RECLEN],junk[RECLEN],*str_store();

--- 36,42 -----
  digest_page (idx,skip)
  int idx;
  {
! 	char name[24];
  	FILE *fp;
  	int i,len,hl;
  	char subj[RECLEN],date[RECLEN],from[RECLEN],junk[RECLEN],*str_store();
***************
*** 57,68
  			return (-1);
  	}
  
- 	/* every new call to a digest Page "loses" a small amount of storage */
- 	title = str_store(Page.b[idx].art_t);
- 	if ((ptr = index(title,'~')) != 0)
- 		*ptr = '\0';
- 	title [C_allow - 20] = '\0';
- 
  	for (i=0; i < L_allow &&
  			(len = dig_advance(fp,from,subj,date,junk,&pos,&hl)) >= 0; ++i)
  	{

--- 57,62 -----
  			return (-1);
  	}
  
  	for (i=0; i < L_allow &&
  			(len = dig_advance(fp,from,subj,date,junk,&pos,&hl)) >= 0; ++i)
  	{
***************
*** 80,86
  	if (i == 0)
  		return (-1);
  
- 	Page.h.name = title;
  	Page.h.artnum = i;
  	return (i);
  }

--- 74,79 -----
  	if (i == 0)
  		return (-1);
  
  	Page.h.artnum = i;
  	return (i);
  }
===================================================================
RCS file: RCS/envir_set.c,v
retrieving revision 5.0
diff -c -r5.0 envir_set.c
*** /tmp/,RCSt1010535	Thu Jan  7 10:59:43 1988
--- envir_set.c	Wed Jan  6 12:36:27 1988
***************
*** 12,17
  #include <sys/param.h>
  #include "tune.h"
  #include "config.h"
  
  extern char *Editor, *Ps1, *Printer;
  extern char *Orgdir, *Savedir, *Ccfile;	/* path names */

--- 12,18 -----
  #include <sys/param.h>
  #include "tune.h"
  #include "config.h"
+ #include "vn.h"
  
  extern char *Editor, *Ps1, *Printer;
  extern char *Orgdir, *Savedir, *Ccfile;	/* path names */
***************
*** 17,22
  extern char *Orgdir, *Savedir, *Ccfile;	/* path names */
  extern char Cxitop[], Cxitor[], Cxrtoi[], Cxptoi[];
  extern char *Home;
  
  #ifdef SYSV
  extern char *getcwd();

--- 18,24 -----
  extern char *Orgdir, *Savedir, *Ccfile;	/* path names */
  extern char Cxitop[], Cxitor[], Cxrtoi[], Cxptoi[];
  extern char *Home;
+ extern int More;
  
  #ifdef SYSV
  extern char *getcwd();
***************
*** 32,38
  
  envir_set ()
  {
!  	char dbuf [MAXPATHLEN], *ccname, *keyxln;
  	char *vn_env(), *getcwd(), *str_store();
  	struct passwd *ptr, *getpwuid();
  

--- 34,40 -----
  
  envir_set ()
  {
! 	char dbuf [MAXPATHLEN], *ccname, *keyxln;
  	char *vn_env(), *getcwd(), *str_store();
  	struct passwd *ptr, *getpwuid();
  
***************
*** 37,42
  	struct passwd *ptr, *getpwuid();
  
  	vns_envir();
  
  	Ps1 = vn_env("PS1",DEF_PS1);
  	Editor = vn_env("EDITOR",DEF_ED);

--- 39,45 -----
  	struct passwd *ptr, *getpwuid();
  
  	vns_envir();
+ 	More = 0;
  
  	Ps1 = vn_env("PS1",DEF_PS1);
  	Editor = vn_env("EDITOR",DEF_ED);
***************
*** 44,49
  	ccname = vn_env("CCFILE",DEF_CCFILE);
  	keyxln = vn_env("VNKEY",DEF_KEYXLN);
  	Savedir = vn_env("VNSAVE",NULL);
  
  	/*
  		set original directory strings.

--- 47,53 -----
  	ccname = vn_env("CCFILE",DEF_CCFILE);
  	keyxln = vn_env("VNKEY",DEF_KEYXLN);
  	Savedir = vn_env("VNSAVE",NULL);
+ 	More = (strcmp(vn_env("MORE",""), "-c") == 0 ? TRUE : FALSE);
  
  	/*
  		set original directory strings.
===================================================================
RCS file: RCS/hash.c,v
retrieving revision 5.0
diff -c -r5.0 hash.c
*** /tmp/,RCSt1010535	Thu Jan  7 10:59:47 1988
--- hash.c	Wed Jan  6 12:36:29 1988
***************
*** 39,44
  {
  	char *str_store();
  	NODE *ptr,*node_store();
  	int i;
  
  	i=hash(s);

--- 39,45 -----
  {
  	char *str_store();
  	NODE *ptr,*node_store();
+ 	NODE *hashfind();
  	int i;
  
  	if ((ptr = hashfind(s)) != NULL)
***************
*** 41,46
  	NODE *ptr,*node_store();
  	int i;
  
  	i=hash(s);
  	ptr = node_store();
  	ptr->next = Tab[i];

--- 42,53 -----
  	NODE *hashfind();
  	int i;
  
+ 	if ((ptr = hashfind(s)) != NULL)
+ 	{
+ 		fgprintf ("Warning: group %s encountered twice",s);
+ 		return (ptr);
+ 	}
+ 
  	i=hash(s);
  	ptr = node_store();
  	ptr->next = Tab[i];
***************
*** 76,82
  	int i;
  	NODE *ptr;
  
! 	if ((Newsorder = (NODE **) malloc(Ncount * sizeof(NODE))) == NULL)
  		printex("Memory allocation failure - newsorder array");
  	for (i=0; i < Ncount; ++i)
  		Newsorder[i] = NULL;

--- 83,89 -----
  	int i;
  	NODE *ptr;
  
! 	if ((Newsorder = (NODE **) malloc(Ncount * sizeof(NODE *))) == NULL)
  		printex("Memory allocation failure - newsorder array");
  	for (i=0; i < Ncount; ++i)
  		Newsorder[i] = NULL;
===================================================================
RCS file: RCS/reader.c,v
retrieving revision 5.0
diff -c -r5.0 reader.c
*** /tmp/,RCSt1010535	Thu Jan  7 10:59:56 1988
--- reader.c	Wed Jan  6 13:04:45 1988
***************
*** 27,32
  extern int Rot;
  extern int Headflag;
  extern int Digest;
  extern char *No_msg;
  extern char *Roton_msg;
  extern char *Rotoff_msg;

--- 27,33 -----
  extern int Rot;
  extern int Headflag;
  extern int Digest;
+ extern int More;
  extern char *No_msg;
  extern char *Roton_msg;
  extern char *Rotoff_msg;
***************
*** 67,72
  	int lines,percent;
  	int i;
  	int top, bottom;
  	char c,  buf[RECLEN];
   	char pstr[24], dgname[48];
   	char getpgch(), *index(), *digest_extract(), *tgetstr();

--- 68,74 -----
  	int lines,percent;
  	int i;
  	int top, bottom;
+ 	int step;
  	char c,  buf[RECLEN];
  	char lasave[RECLEN];
  	char pstr[24], dgname[48];
***************
*** 68,75
  	int i;
  	int top, bottom;
  	char c,  buf[RECLEN];
!  	char pstr[24], dgname[48];
!  	char getpgch(), *index(), *digest_extract(), *tgetstr();
  	FILE *vns_aopen();
  	long ftell();
  

--- 70,79 -----
  	int top, bottom;
  	int step;
  	char c,  buf[RECLEN];
! 	char lasave[RECLEN];
! 	char pstr[24], dgname[48];
! 	char getpgch(), *index(), *digest_extract(), *tgetstr();
! 	char *any;
  	FILE *vns_aopen();
  	long ftell();
  
***************
*** 75,80
  
  	Fname = fn;
  	*pages = 0;
  
  	term_set(ERASE);
  	sig_set(BRK_READ,&Fpread);

--- 79,85 -----
  
  	Fname = fn;
  	*pages = 0;
+ 	step = FALSE;	/* Boolean; to indicate user input a <RET> (PG_STEP) */
  
  	term_set(ERASE);
  	sig_set(BRK_READ,&Fpread);
***************
*** 79,84
  	term_set(ERASE);
  	sig_set(BRK_READ,&Fpread);
  
  	if (Digest)
  	{
  		lines = atoi(Fname);

--- 84,91 -----
  	term_set(ERASE);
  	sig_set(BRK_READ,&Fpread);
  
+ 	any = "any key to continue .... ";
+ 
  	if (Digest)
  	{
  		lines = atoi(Fname);
***************
*** 84,90
  		lines = atoi(Fname);
  		if ((Fname = digest_extract(dgname,lines,&hdr,&Rew_pos)) == NULL)
  		{
! 			printf("couldn't extract article %d from digest",lines);
  			sig_set(BRK_RFIN);
  			return (0);
  		}

--- 91,99 -----
  		lines = atoi(Fname);
  		if ((Fname = digest_extract(dgname,lines,&hdr,&Rew_pos)) == NULL)
  		{
! 			rerrmsg("couldn't extract article %d from digest",lines);
! 			printf(any);
! 			getnoctl();
  			sig_set(BRK_RFIN);
  			return (0);
  		}
***************
*** 90,96
  		}
  		if ((Fpread = fopen(Fname,"r")) == NULL)
  		{
! 			printf("couldn't open %s\n",Fname);
  			sig_set(BRK_RFIN);
  			return (0);
  		}

--- 99,107 -----
  		}
  		if ((Fpread = fopen(Fname,"r")) == NULL)
  		{
! 			rerrmsg("couldn't open %s",Fname);
! 			printf(any);
! 			getnoctl();
  			sig_set(BRK_RFIN);
  			return (0);
  		}
***************
*** 100,106
  	{
  		if ((Fpread = vns_aopen(atoi(Fname),&hdr)) == NULL)
  		{
! 			rerrmsg("couldn't open article");
  			sig_set(BRK_RFIN);
  			return (0);
  		}

--- 111,119 -----
  	{
  		if ((Fpread = vns_aopen(atoi(Fname),&hdr)) == NULL)
  		{
! 			rerrmsg("couldn't open article %s",Fname);
! 			printf(any);
! 			getnoctl();
  			sig_set(BRK_RFIN);
  			return (0);
  		}
***************
*** 136,141
  		** If Lookahead is null after this loop, we've
  		** hit EOF.
  		*/
  		lines += do_out(Lookahead,L_allow-lines);
  		while (1)
  		{

--- 149,177 -----
  		** If Lookahead is null after this loop, we've
  		** hit EOF.
  		*/
+ 		if (Lookahead != NULL && More && !step)
+ 		{
+ 			char *looktmp;
+ 
+ 			/*
+ 			** Save Lookahead because `do_out' nukes it.
+ 			** Perhaps we could just use `printf' here
+ 			** but for now we'll play it safe. - GKE 12/26/87
+ 			*/
+ 			looktmp = Lookahead;
+ 			term_set(ERASE);
+ 			/* 
+ 			** The following presents the last line of the
+ 			** previous page in reversed video, as the first line
+ 			** of the current page, `rn'-stylee.  Since `rn'
+ 			** uses an option to enable/disable this, remove the
+ 			** two `term_set's if not to your liking.
+ 			*/
+ 			term_set(ONREVERSE);
+ 			do_out(lasave,1);
+ 			term_set(OFFREVERSE);
+ 			Lookahead = looktmp;
+ 		}
  		lines += do_out(Lookahead,L_allow-lines);
  		while (1)
  		{
***************
*** 150,156
  			}
  			if (lines >= L_allow)
  				break;
! 			lines += do_out(buf,L_allow-lines);
  		}
  
  		if (Lookahead != NULL)

--- 186,194 -----
  			}
  			if (lines >= L_allow)
  				break;
! 			if (More)
! 				strcpy(lasave,Lookahead);
! 			lines += do_out(Lookahead,L_allow-lines);
  		}
  
  		if (Lookahead != NULL)
***************
*** 196,201
  			handle user input:
  			CAUTION!!  return cases must close Fpread.
  		*/
  		switch (c)
  		{
  		case PG_NEXT:

--- 234,240 -----
  			handle user input:
  			CAUTION!!  return cases must close Fpread.
  		*/
+ 		step = FALSE;
  		switch (c)
  		{
  		case PG_NEXT:
***************
*** 199,205
  		switch (c)
  		{
  		case PG_NEXT:
! 			vns_aclose (Fpread);
  			sig_set(BRK_RFIN);
  			return (0);
  		case PG_FLIP:

--- 238,250 -----
  		switch (c)
  		{
  		case PG_NEXT:
! 			if (Digest)
! 			{
! 				fclose (Fpread);
! 				unlink (Fname);
! 			}
! 			else
! 				vns_aclose (Fpread);
  			sig_set(BRK_RFIN);
  			return (0);
  		case PG_FLIP:
***************
*** 205,211
  		case PG_FLIP:
  			*pages = 1;	/* fall through */
  		case PG_QUIT:
! 			vns_aclose (Fpread);
  			sig_set(BRK_RFIN);
  			return (-1);
  		case PG_REWIND:

--- 250,262 -----
  		case PG_FLIP:
  			*pages = 1;	/* fall through */
  		case PG_QUIT:
! 			if (Digest)
! 			{
! 				fclose (Fpread);
! 				unlink (Fname);
! 			}
! 			else
! 				vns_aclose (Fpread);
  			sig_set(BRK_RFIN);
  			return (-1);
  		case PG_REWIND:
***************
*** 235,241
  		case PG_STEP:
  			if (Lookahead == NULL)
  			{
! 				vns_aclose (Fpread);
  				sig_set(BRK_RFIN);
  				return (0);
  			}

--- 286,298 -----
  		case PG_STEP:
  			if (Lookahead == NULL)
  			{
! 				if (Digest)
! 				{
! 					fclose (Fpread);
! 					unlink (Fname);
! 				}
! 				else
! 					vns_aclose (Fpread);
  				sig_set(BRK_RFIN);
  				return (0);
  			}
***************
*** 240,245
  				return (0);
  			}
  			lines = L_allow - 1;
  			break;
  		default:
  			if (Lookahead == NULL)

--- 297,303 -----
  				return (0);
  			}
  			lines = L_allow - 1;
+ 			step = TRUE;	/* Temporarily disable paging */
  			break;
  		default:
  			if (Lookahead == NULL)
***************
*** 244,250
  		default:
  			if (Lookahead == NULL)
  			{
! 				vns_aclose (Fpread);
  				sig_set(BRK_RFIN);
  				return (0);
  			}

--- 302,314 -----
  		default:
  			if (Lookahead == NULL)
  			{
! 				if (Digest)
! 				{
! 					fclose (Fpread);
! 					unlink (Fname);
! 				}
! 				else
! 					vns_aclose (Fpread);
  				sig_set(BRK_RFIN);
  				return (0);
  			}
***************
*** 339,345
  {
  	char buf[RECLEN],msg[RECLEN],*str_store();
  
!  	user_str (buf,"save file ? ",0,Savefile);
  	if (buf[0] != '\0' && buf[0] != '|')
  		Savefile = str_store(buf);
  	if (save_art(Fname,buf,msg) != 0)

--- 403,409 -----
  {
  	char buf[RECLEN],msg[RECLEN],*str_store();
  
! 	user_str (buf,"save file ? ",0,Savefile);
  	if (buf[0] != '\0' && buf[0] != '|')
  		Savefile = str_store(buf);
  	if (save_art(Fname,buf,msg) != 0)
***************
*** 712,720
  	current = ftell(Fpread);
  	orlines = Rlines;
  
!  	sprintf (lasave,SEARCHFORM,searchstr);
!  	user_str (searchstr,lasave,0,searchstr);
!  
  	/* Now compile the search string */
  	if(( reg = regcmp(searchstr, (char *)0)) == NULL) {
  		rerrmsg("Invalid search string \"%s\"", searchstr);

--- 776,784 -----
  	current = ftell(Fpread);
  	orlines = Rlines;
  
! 	sprintf (lasave,SEARCHFORM,searchstr);
! 	user_str (searchstr,lasave,0,searchstr);
! 
  	/* Now compile the search string */
  	if(( reg = regcmp(searchstr, (char *)0)) == NULL) {
  		rerrmsg("Invalid search string \"%s\"", searchstr);
===================================================================
RCS file: RCS/session.c,v
retrieving revision 5.0
diff -c -r5.0 session.c
*** /tmp/,RCSt1010535	Thu Jan  7 11:00:11 1988
--- session.c	Wed Jan  6 13:38:18 1988
***************
*** 539,544
  {
  	char cmd [RECLEN];
  	char fn[L_tmpnam];
  
  	prinfo ("preparing print command ....");
  

--- 539,545 -----
  {
  	char cmd [RECLEN];
  	char fn[L_tmpnam];
+ 	char dsave[RECLEN];	/* save list for unlinking */
  
  	prinfo ("preparing print command ....");
  
***************
*** 543,548
  	prinfo ("preparing print command ....");
  
  	if (Digest)
  		dig_list (s);
  
  	if (*s != '\0')

--- 544,550 -----
  	prinfo ("preparing print command ....");
  
  	if (Digest)
+ 	{
  		dig_list (s);
  		strcpy(dsave,s);
  	}
***************
*** 544,549
  
  	if (Digest)
  		dig_list (s);
  
  	if (*s != '\0')
  	{

--- 546,553 -----
  	if (Digest)
  	{
  		dig_list (s);
+ 		strcpy(dsave,s);
+ 	}
  
  	if (*s != '\0')
  	{
***************
*** 564,570
  		preinfo (No_msg);
  
  	if (Digest)
! 		dig_ulist (s);
  }
  
  /*

--- 568,574 -----
  		preinfo (No_msg);
  
  	if (Digest)
! 		dig_ulist (dsave);
  }
  
  /*
***************
*** 626,631
  {
  	char *ptr, newfile [MAX_C+1], msg[RECLEN];
  	char *str_store();
  
  	if (Digest)
  		dig_list (s);

--- 630,636 -----
  {
  	char *ptr, newfile [MAX_C+1], msg[RECLEN];
  	char *str_store();
+ 	char dsave[RECLEN];
  
  	if (Digest)
  	{
***************
*** 628,633
  	char *str_store();
  
  	if (Digest)
  		dig_list (s);
  
  	if (*s != '\0')

--- 633,639 -----
  	char dsave[RECLEN];
  
  	if (Digest)
+ 	{
  		dig_list (s);
  		strcpy(dsave,s);
  	}
***************
*** 629,634
  
  	if (Digest)
  		dig_list (s);
  
  	if (*s != '\0')
  	{

--- 635,642 -----
  	if (Digest)
  	{
  		dig_list (s);
+ 		strcpy(dsave,s);
+ 	}
  
  	if (*s != '\0')
  	{
***************
*** 660,666
  		preinfo (No_msg);
  
  	if (Digest)
! 		dig_ulist (s);
  }
  
  /*

--- 668,674 -----
  		preinfo (No_msg);
  
  	if (Digest)
! 		dig_ulist (dsave);
  }
  
  /*
===================================================================
RCS file: RCS/sig_set.c,v
retrieving revision 5.0
diff -c -r5.0 sig_set.c
*** /tmp/,RCSt1010535	Thu Jan  7 11:00:23 1988
--- sig_set.c	Wed Jan  6 12:36:52 1988
***************
*** 26,31
  static FILE **Fpseek;		/* article reading file pointer pointer */
  static int Foreground;
  static jmp_buf Jumploc;		/* for BRK_SESS phase */
  
  /*
  	interrupt handler - unusual termination (longjmp and printex aborts)

--- 26,32 -----
  static FILE **Fpseek;		/* article reading file pointer pointer */
  static int Foreground;
  static jmp_buf Jumploc;		/* for BRK_SESS phase */
+ static int Need_restart = 0;
  
  /*
  	interrupt handler - unusual termination (longjmp and printex aborts)
***************
*** 80,85
  				and can turn newsgroup name printing back on
  			*/
  		tty_set (RESTORE);
  		switch (Sigflag)
  		{
  		case BRK_SESS:

--- 81,93 -----
  				and can turn newsgroup name printing back on
  			*/
  		tty_set (RESTORE);
+ 
+ 		/*
+ 		** Note concerning RESTART.  If in state BRK_IN, we simply
+ 		** set a flag to do it upon switch to state BRK_SESS - we
+ 		** don't want to send i/o to the terminal when we
+ 		** background during BRK_IN phase ("stopped on tty output")
+ 		*/
  		switch (Sigflag)
  		{
  		case BRK_SESS:
***************
*** 84,89
  		{
  		case BRK_SESS:
  			signal (SIGTSTP,sigcatch);
  			longjmp (Jumploc,1);
  		case BRK_IN:
  			ioctl (1,TIOCGPGRP,&pgrp);

--- 92,98 -----
  		{
  		case BRK_SESS:
  			signal (SIGTSTP,sigcatch);
+ 			term_set (RESTART);
  			longjmp (Jumploc,1);
  		case BRK_IN:
  			Need_restart = 1;
***************
*** 86,91
  			signal (SIGTSTP,sigcatch);
  			longjmp (Jumploc,1);
  		case BRK_IN:
  			ioctl (1,TIOCGPGRP,&pgrp);
  			if (pgrp == getpgrp(0))
  				Foreground = 1;

--- 95,101 -----
  			term_set (RESTART);
  			longjmp (Jumploc,1);
  		case BRK_IN:
+ 			Need_restart = 1;
  			ioctl (1,TIOCGPGRP,&pgrp);
  			if (pgrp == getpgrp(0))
  				Foreground = 1;
***************
*** 91,96
  				Foreground = 1;
  			break;
  		default:
  			break;
  		}
  		signal (SIGTSTP,sigcatch);

--- 101,107 -----
  				Foreground = 1;
  			break;
  		default:
+ 			term_set (RESTART);
  			break;
  		}
  		signal (SIGTSTP,sigcatch);
***************
*** 167,172
  		Sigflag = BRK_READ;
  		break;
  	case BRK_SESS:
  		xfer = (int *) Jumploc;
  		for (i=0; i < sizeof(Jumploc) / sizeof(int); ++i)
  			xfer[i] = dat[i];

--- 178,185 -----
  		Sigflag = BRK_READ;
  		break;
  	case BRK_SESS:
+ 		if (Need_restart)
+ 			term_set(RESTART);
  		xfer = (int *) Jumploc;
  		for (i=0; i < sizeof(Jumploc) / sizeof(int); ++i)
  			xfer[i] = dat[i];
===================================================================
RCS file: RCS/std.c,v
retrieving revision 5.0
diff -c -r5.0 std.c
*** /tmp/,RCSt1010535	Thu Jan  7 11:00:33 1988
--- std.c	Wed Jan  6 12:36:55 1988
***************
*** 6,11
  #include "config_std.h"
  #include "std.h"
  
  extern NODE *hashfind();
  extern FILE *fopen();
  extern char *index(), *rindex();

--- 6,15 -----
  #include "config_std.h"
  #include "std.h"
  
+ #ifndef MAXPATHLEN
+ #define MAXPATHLEN 240
+ #endif
+ 
  extern NODE *hashfind();
  extern FILE *fopen();
  extern char *index(), *rindex();
***************
*** 25,31
  #define GF_SPEC 2	/* -n option(s) - user specified groups */
  #define GF_OVER 4	/* command line specification - overide marks */
  
! char *Vns_version = "res1.0";
  
  static char *Onews, *Newsrc;
  static int Ntopt, Nntopt, Nwopt, Nnwopt;

--- 29,35 -----
  #define GF_SPEC 2	/* -n option(s) - user specified groups */
  #define GF_OVER 4	/* command line specification - overide marks */
  
! char *Vns_version = "res1.1";
  
  static char *Onews, *Newsrc;
  static int Ntopt, Nntopt, Nwopt, Nnwopt;
***************
*** 91,97
  	}
  	else
  		Newsrc = str_store (rcname);
! 	sprintf (dbuf, "%s/%s%s",ptr->pw_dir,".vn","XXXXXX");
  	mktemp(dbuf);
  	Onews = str_store (dbuf);
  	if (access (Newsrc,0) != 0)

--- 95,104 -----
  	}
  	else
  		Newsrc = str_store (rcname);
! 
! 	/* above logic guarantees that Newsrc contains a '/' */
!  	strcpy(dbuf,Newsrc);
!  	strcpy(rindex(dbuf,'/')+1,".vnXXXXXX");
  	mktemp(dbuf);
  	Onews = str_store (dbuf);
  
***************
*** 94,99
  	sprintf (dbuf, "%s/%s%s",ptr->pw_dir,".vn","XXXXXX");
  	mktemp(dbuf);
  	Onews = str_store (dbuf);
  	if (access (Newsrc,0) != 0)
  		creat (Newsrc,0666);
  }

--- 101,107 -----
   	strcpy(rindex(dbuf,'/')+1,".vnXXXXXX");
  	mktemp(dbuf);
  	Onews = str_store (dbuf);
+ 
  	if (access (Newsrc,0) != 0)
  		creat (Newsrc,0666);
  }
***************
*** 910,916
  
  static char *Mail[2], *Show[6], *Post[4];
  static char *Priv[8];
! static char *Pool;
  
  FILE *
  vns_aopen(art,hdr)

--- 918,924 -----
  
  static char *Mail[2], *Show[6], *Post[4];
  static char *Priv[8];
! static char *Pool = NULL;
  
  FILE *
  vns_aopen(art,hdr)
***************
*** 1066,1072
  	if (path != NULL)
  		reply = path;
  #endif
- 	reply =  mail_trim(reply);
  	if (reply != NULL)
  		mail_cmd(hdr,reply,resubj);
  #endif /* MAILCHOOSE */

--- 1074,1079 -----
  	if (path != NULL)
  		reply = path;
  #endif
  	if (reply != NULL)
  		reply =  mail_trim(reply);
  	mail_cmd(hdr,reply,resubj);
***************
*** 1068,1074
  #endif
  	reply =  mail_trim(reply);
  	if (reply != NULL)
! 		mail_cmd(hdr,reply,resubj);
  #endif /* MAILCHOOSE */
  
  	if (flto == NULL)

--- 1075,1082 -----
  		reply = path;
  #endif
  	if (reply != NULL)
! 		reply =  mail_trim(reply);
! 	mail_cmd(hdr,reply,resubj);
  #endif /* MAILCHOOSE */
  
  	if (flto == NULL)
***************
*** 1230,1236
  vns_aclose(fp)
  FILE *fp;
  {
! 	str_tfree(Pool);
  	fclose(fp);
  }
  

--- 1238,1246 -----
  vns_aclose(fp)
  FILE *fp;
  {
!  	if (Pool != NULL)
!  		str_tfree(Pool);
!  	Pool = NULL;
  	fclose(fp);
  }
  
===================================================================
RCS file: RCS/strings.c,v
retrieving revision 5.0
diff -c -r5.0 strings.c
*** /tmp/,RCSt1010535	Thu Jan  7 11:01:04 1988
--- strings.c	Wed Jan  6 12:36:59 1988
***************
*** 10,16
  #include "node.h"
  #include "page.h"
  
! char *Version = "8/87";
  
  char *No_msg = "No articles";
  char *Hdon_msg = "Headers being printed";

--- 10,16 -----
  #include "node.h"
  #include "page.h"
  
! char *Version = "1/88";
  
  char *No_msg = "No articles";
  char *Hdon_msg = "Headers being printed";
===================================================================
RCS file: RCS/svart.c,v
retrieving revision 5.0
diff -c -r5.0 svart.c
*** /tmp/,RCSt1010535	Thu Jan  7 11:01:08 1988
--- svart.c	Wed Jan  6 12:37:01 1988
***************
*** 141,147
  	}
  	if (stat(dir,&sbuf) != 0)
  	{
! 		if (mkdir(dir,0755) != 0)
  		{
  			sprintf(msg,"Cannot make directory %s",dir);
  			return (-1);

--- 141,156 -----
  	}
  	if (stat(dir,&sbuf) != 0)
  	{
! #ifdef SYSV
! 		/*
! 		** late enough releases of SYSV may have a mkdir() call, but
! 		** this is an obscure feature anyway.  We'll accept the fork.
! 		*/
! 		sprintf(buf,"mkdir %s",dir);
! 		if (system(buf) != 0)
! #else
! 		if (mkdir(dir,0755) != 0)
! #endif
  		{
  			sprintf(msg,"Cannot make directory %s",dir);
  			return (-1);
===================================================================
RCS file: RCS/vn.c,v
retrieving revision 5.0
diff -c -r5.0 vn.c
*** /tmp/,RCSt1010535	Thu Jan  7 11:01:14 1988
--- vn.c	Wed Jan  6 12:37:07 1988
***************
*** 152,157
  			message being output.
  
  			key to print version being used.
  Known bugs:
  
  	non-erasure of stuff on prompt line when the new

--- 152,192 -----
  			message being output.
  
  			key to print version being used.
+ 
+ 	Bug fixes following 12/87 posting.  Made this version 1/88 / res1.1
+ 	to distinguish.
+ 
+ 		Digest extraction in reader.c, fix from steve@mahendo.  Thanks
+ 		to steve@mahendo & greg@mahendo for tracking down digest
+ 		extraction bugs.  I obviously didn't beat on the feature enough
+ 		after rearranging things to abstract the server interface.
+ 		The digest extraction display is a little less informative,
+ 		the price paid to allow mail & followup.
+ 
+ 		SYS V ifdefs - svart.c, independently arrived at by several
+ 		people - thank you.  At the behest of a couple people I made
+ 		it spawn a "mkdir" instead of punting by calling mknod.
+ 
+ 		Fix bug which would cause vn to crash if article has
+ 		no "From" / "Reply-to" / "Path" line. - std.c
+ 
+ 		Fix bug preventing assignment of .newsrc to filesystem other
+ 		than that containing user's HOME.
+ 
+ 		Fix excessive allocation in hash.c
+ 
+ 		Handle duplicate active list records more gracefully.
+ 
+ 		term_set(RESTART) call added to recovery from being
+ 		backgrounded in sig_set.c, in case something you ran while
+ 		backgrounded messed up your terminal state.  I lost the name
+ 		of the person reporting the problem & fix - my apologies.
+ 
+ 		display optimization in reader.c which repaints instead of
+ 		scrolling if indicated by user's MORE variable.  This came
+ 		from Greg Earle, earle@mahendo.  Modified slightly for
+ 		cosmetic reasons & to fix a small folded-line bug.
+ 
  Known bugs:
  
  	If your terminal init string contains a newline, I suspect you will
***************
*** 153,158
  
  			key to print version being used.
  Known bugs:
  
  	non-erasure of stuff on prompt line when the new
  	string includes an escape sequence (like PS1 maybe)

--- 188,200 -----
  		cosmetic reasons & to fix a small folded-line bug.
  
  Known bugs:
+ 
+ 	If your terminal init string contains a newline, I suspect you will
+ 	get an initial "stopped on tty output" if you fire up backgrounded.
+ 	Cooked mode until session is started probably saves us in a lot of
+ 	cases where the init string contains no newlines.  Can be fixed, but
+ 	it's esoteric enough that I don't want to add another file to the
+ 	"patched" list.
  
  	non-erasure of stuff on prompt line when the new
  	string includes an escape sequence (like PS1 maybe)
===================================================================
RCS file: RCS/vnglob.c,v
retrieving revision 5.0
diff -c -r5.0 vnglob.c
*** /tmp/,RCSt1010535	Thu Jan  7 11:01:19 1988
--- vnglob.c	Wed Jan  6 12:37:17 1988
***************
*** 35,40
  int Rot;	/* rotation */
  int Headflag;	/* header printing flag */
  int Digest;	/* if non-zero, digest article */
  
  char *Ku, *Kd, *Kl, *Kr;	/* Cursor movement capabilities */
  

--- 35,42 -----
  int Rot;	/* rotation */
  int Headflag;	/* header printing flag */
  int Digest;	/* if non-zero, digest article */
+ int More;	/* if non-zero, clear screen between each page.  Set by */
+ 		/* user's MORE environment variable; if `-c', then set true */
  
  char *Ku, *Kd, *Kl, *Kr;	/* Cursor movement capabilities */
  
===================================================================
RCS file: RCS/vn.man,v
retrieving revision 5.0
diff -c -r5.0 vn.man
*** /tmp/,RCSt1010535	Thu Jan  7 11:01:24 1988
--- vn.man	Wed Jan  6 12:37:15 1988
***************
*** 253,258
  want to read it.  You can jump from the reading portion back to either
  page you came from or the NEXT page.
  .sp
  For replying and posting followups, you will be thrown into an editor
  to create the reply or article.
  The article will be included in the file you are editing, marked with

--- 253,262 -----
  want to read it.  You can jump from the reading portion back to either
  page you came from or the NEXT page.
  .sp
+ You can cause the article reading interface to repaint the screen rather
+ than scroll, if that is more efficient for your display.  See description
+ of the MORE variable, below.
+ .sp
  For replying and posting followups, you will be thrown into an editor
  to create the reply or article.
  The article will be included in the file you are editing, marked with
***************
*** 466,471
  if set, can be used to override the choice of ".newsrc" as the
  name for the status file.  Name will still be used relative to
  the login directory, unless it begins with "/".
  .TP 24
  CCFILE
  if set, overrides the choice of "author_copy" as the name of the

--- 470,481 -----
  if set, can be used to override the choice of ".newsrc" as the
  name for the status file.  Name will still be used relative to
  the login directory, unless it begins with "/".
+ .TP 24
+ MORE
+ if set to "-c", will cause the article reading display to clear and
+ repaint, rather than relying on scrolling.  For some environments,
+ notably Sun, this is faster.  This also causes some minor display
+ modifications which you may prefer.
  .TP 24
  CCFILE
  if set, overrides the choice of "author_copy" as the name of the
-- 
{amdahl, sun, mtxinu, hoptoad, cpsc6a}!rtech!bobm