[comp.sources.bugs] Yet another offical patch to rn 4.3

rrn@lib.tmc.edu (Stan Barber) (12/10/90)

Description:
	This is an official patch for rn 4.3. This is patch 51.

	If you need the other patches, you can get them via the Archive Server
	by sending mail to "archive-server@bcm.tmc.edu" with the subject line
	of the form "send public rn.XX.patch". Note that only patches 41 and
	later are available from this resource at this time. Once rn 4.4 is
	released, the patches to rn 4.3 will be removed.

	The fully patched rn kit is also available via anonymous ftp from
	lib.tmc.edu and gazette.bcm.tmc.edu. Look in public/rn.

	Special note: rn 4.4 will be released in January, 1991. Other patches
	to rn 4.3 may be released before the rn 4.4 release, but there
	will be no patch upgrading rn 4.3 to rn 4.4. Please plan to get
	to fresh copy of the rn kit when 4.4 is released. It will be
	available via the archive-server@bcm.tmc.edu at that time.

	This patch fixes the following problems or adds the following new
	features:

	Fixes terminal handling for user using the -e and -L options when
	starting rn.

	First attempts to make rn "8 bit clean" for international character
	sets that use the high bit.

	Handles bogus errno RINTR returned when RDCHK is used on Xenix
	and rn is "suspended".

Fix:
	cd to your rn source directory and patch away

Index: art.c
Prereq: 4.3.2.7
*** art.c	Mon Dec 10 00:54:20 1990
--- ../rn/art.c	Mon Dec 10 01:35:01 1990
***************
*** 1,4
! /* $Header: art.c,v 4.3.2.7 90/11/22 13:48:59 sob Exp $
   *
   * $Log:	art.c,v $
   * Revision 4.3.2.7  90/11/22  13:48:59  sob

--- 1,4 -----
! /* $Header: art.c,v 4.3.2.9 90/12/10 01:34:42 sob Exp $
   *
   * $Log:	art.c,v $
   * Revision 4.3.2.9  90/12/10  01:34:42  sob
***************
*** 1,6
  /* $Header: art.c,v 4.3.2.7 90/11/22 13:48:59 sob Exp $
   *
   * $Log:	art.c,v $
   * Revision 4.3.2.7  90/11/22  13:48:59  sob
   * Added changes that will hopefully fix the "long lines" bug.
   * 

--- 1,12 -----
  /* $Header: art.c,v 4.3.2.9 90/12/10 01:34:42 sob Exp $
   *
   * $Log:	art.c,v $
+  * Revision 4.3.2.9  90/12/10  01:34:42  sob
+  * "8 bit clean" mods and fixes for rn -e -L problems.
+  * 
+  * Revision 4.3.2.8  90/12/04  02:49:12  sob
+  * Added long lost commands control-P and control-N back into rn.
+  * 
   * Revision 4.3.2.7  90/11/22  13:48:59  sob
   * Added changes that will hopefully fix the "long lines" bug.
   * 
***************
*** 329,335
  #endif
  		for (outpos = 0; outpos < COLS; ) {
  				    /* while line has room */
! 		    if (*bufptr >= ' ') {	/* normal char? */
  #ifdef ULSMARTS
  			if (*bufptr == '_') {
  			    if (bufptr[1] == '\b') {

--- 335,341 -----
  #endif
  		for (outpos = 0; outpos < COLS; ) {
  				    /* while line has room */
! 		    if (*(unsigned char *)bufptr >= ' ') { /* normal char? */
  #ifdef ULSMARTS
  			if (*bufptr == '_') {
  			    if (bufptr[1] == '\b') {
***************
*** 409,425
  #ifdef INNERSEARCH
  			if (outputok)
  #endif
- 			{
- 			    /* handle normal end of output line formalities */
- 
- 			    if (highlight == artline) {
- 						/* were we highlighting line? */
- 		    		if (marking == STANDOUT)
- 				    un_standout();
- 		    	    	else
- 				    un_underline();
- 		    		highlight = -1;	/* no more we are */
- 			    }
  			    putchar('\n') FLUSH;
  			}
  			restart = 0;

--- 415,420 -----
  #ifdef INNERSEARCH
  			if (outputok)
  #endif
  			    putchar('\n') FLUSH;
  			restart = 0;
  			outpos = 1000;	/* signal normal \n */
***************
*** 421,427
  		    		highlight = -1;	/* no more we are */
  			    }
  			    putchar('\n') FLUSH;
- 			}
  			restart = 0;
  			outpos = 1000;	/* signal normal \n */
  		    }

--- 416,421 -----
  			if (outputok)
  #endif
  			    putchar('\n') FLUSH;
  			restart = 0;
  			outpos = 1000;	/* signal normal \n */
  		    }
***************
*** 487,493
  		    }
  #ifdef CLEAREOL
  #ifdef INNERSEARCH
! 		    if (outputok)
  #endif
   		    {
   		      /* force movement onto the new line so CE will work */

--- 481,487 -----
  		    }
  #ifdef CLEAREOL
  #ifdef INNERSEARCH
! 		    if (outputok) 
  #endif
   		    {
   		      /* force movement onto the new line so CE will work */
***************
*** 498,503
  #endif /* CLEAREOL */
  		}
  
  		artline++;	/* count the line just printed */
  		if (artline - LINES + 1 > topline)
  			    /* did we just scroll top line off? */

--- 492,507 -----
  #endif /* CLEAREOL */
  		}
  
+ 		/* handle normal end of output line formalities */
+ 
+ 		if (highlight == artline) {
+ 					/* were we highlighting line? */
+ 		    if (marking == STANDOUT)
+ 			un_standout();
+ 		    else
+ 			un_underline();
+ 		    highlight = -1;	/* no more we are */
+ 		}
  		artline++;	/* count the line just printed */
  		if (artline - LINES + 1 > topline)
  			    /* did we just scroll top line off? */
***************
*** 545,550
  	standout();		/* enter standout mode */
  	printf("--MORE--(%ld%%)",(long)(artpos*100/artsize));
  	un_standout();	/* leave standout mode */
  	fflush(stdout);
  /* reinp_pager:     			/* unused, commented for lint */
  	eat_typeahead();

--- 549,555 -----
  	standout();		/* enter standout mode */
  	printf("--MORE--(%ld%%)",(long)(artpos*100/artsize));
  	un_standout();	/* leave standout mode */
+  	maybe_eol();
  	fflush(stdout);
  /* reinp_pager:     			/* unused, commented for lint */
  	eat_typeahead();
***************
*** 835,841
  #endif
  	reread = FALSE;
  	do_hiding = TRUE;
! 	if (index("nNpP",*buf) == Nullch &&
  	  index("wWsS!&|/?123456789.",*buf) != Nullch) {
  	    setdfltcmd();
  	    standout();		/* enter standout mode */

--- 840,846 -----
  #endif
  	reread = FALSE;
  	do_hiding = TRUE;
! 	if (index("nNpP\016\018",*buf) == Nullch &&
  	  index("wWsS!&|/?123456789.",*buf) != Nullch) {
  	    setdfltcmd();
  	    standout();		/* enter standout mode */
Index: term.h
Prereq: 4.3.2.5
*** term.h	Mon Dec 10 00:54:37 1990
--- ../rn/term.h	Mon Dec 10 01:33:50 1990
***************
*** 1,4
! /* $Header: term.h,v 4.3.2.5 90/11/22 13:48:09 sob Exp $
   *
   * $Log:	term.h,v $
   * Revision 4.3.2.5  90/11/22  13:48:09  sob

--- 1,4 -----
! /* $Header: term.h,v 4.3.2.6 90/12/10 01:32:08 sob Exp $
   *
   * $Log:	term.h,v $
   * Revision 4.3.2.6  90/12/10  01:32:08  sob
***************
*** 1,6
  /* $Header: term.h,v 4.3.2.5 90/11/22 13:48:09 sob Exp $
   *
   * $Log:	term.h,v $
   * Revision 4.3.2.5  90/11/22  13:48:09  sob
   * Backed out change in Patch 48.
   * 

--- 1,9 -----
  /* $Header: term.h,v 4.3.2.6 90/12/10 01:32:08 sob Exp $
   *
   * $Log:	term.h,v $
+  * Revision 4.3.2.6  90/12/10  01:32:08  sob
+  * Hopefully, the rn -e -L problem is now fixed.
+  * 
   * Revision 4.3.2.5  90/11/22  13:48:09  sob
   * Backed out change in Patch 48.
   * 
***************
*** 193,199
  #define erase_eol() tputs(CE,1,putchr) FLUSH
  #ifdef CLEAREOL
  #define clear_rest() tputs(CD,LINES,putchr) FLUSH
! #define maybe_eol() if(!erase_screen&&can_home_clear)tputs(CE,1,putchr) FLUSH
  #endif /* CLEAREOL */
  #define underline() tputs(US,1,putchr) FLUSH
  #define un_underline() tputs(UE,1,putchr) FLUSH

--- 196,202 -----
  #define erase_eol() tputs(CE,1,putchr) FLUSH
  #ifdef CLEAREOL
  #define clear_rest() tputs(CD,LINES,putchr) FLUSH
! #define maybe_eol() if(erase_screen&&can_home_clear)tputs(CE,1,putchr) FLUSH
  #endif /* CLEAREOL */
  #define underline() tputs(US,1,putchr) FLUSH
  #define un_underline() tputs(UE,1,putchr) FLUSH
Index: term.c
Prereq: 4.3.2.11
*** term.c	Mon Dec 10 00:54:13 1990
--- ../rn/term.c	Mon Dec 10 01:34:39 1990
***************
*** 1,4
! /* $Header: term.c,v 4.3.2.11 90/11/22 13:34:06 sob Exp $
   *
   * $Log:	term.c,v $
   * Revision 4.3.2.11  90/11/22  13:34:06  sob

--- 1,4 -----
! /* $Header: term.c,v 4.3.2.12 90/12/10 01:33:54 sob Exp $
   *
   * $Log:	term.c,v $
   * Revision 4.3.2.12  90/12/10  01:33:54  sob
***************
*** 1,6
  /* $Header: term.c,v 4.3.2.11 90/11/22 13:34:06 sob Exp $
   *
   * $Log:	term.c,v $
   * Revision 4.3.2.11  90/11/22  13:34:06  sob
   * Added a change to circfill to make it work with POSIX-compliant OSes.
   * 

--- 1,9 -----
  /* $Header: term.c,v 4.3.2.12 90/12/10 01:33:54 sob Exp $
   *
   * $Log:	term.c,v $
+  * Revision 4.3.2.12  90/12/10  01:33:54  sob
+  * First attempts to make rn "8 bit clean"
+  * 
   * Revision 4.3.2.11  90/11/22  13:34:06  sob
   * Added a change to circfill to make it work with POSIX-compliant OSes.
   * 
***************
*** 209,214
      CD = Tgetstr("cd");			/* clear to end of display */
      if (!*CE || !*CD || (!*CM && !*HO))	/* can we CE, CD, and home? */
  	can_home_clear = FALSE;		/*  no, so disable use of clear eol */
  #endif /* CLEAREOL */
      SO = Tgetstr("so");			/* begin standout */
      SE = Tgetstr("se");			/* end standout */

--- 212,218 -----
      CD = Tgetstr("cd");			/* clear to end of display */
      if (!*CE || !*CD || (!*CM && !*HO))	/* can we CE, CD, and home? */
  	can_home_clear = FALSE;		/*  no, so disable use of clear eol */
+     if (!*CE) CE = CD;
  #endif /* CLEAREOL */
      SO = Tgetstr("so");			/* begin standout */
      SE = Tgetstr("se");			/* end standout */
***************
*** 621,627
  int
  circfill()
  {
!     register int Howmany = read(devtty,circlebuf+nextin,1);
  
      if (Howmany < 0 && errno == EAGAIN)	/* POSIX sez this is how it works */
  	Howmany = 0;

--- 625,633 -----
  int
  circfill()
  {
!     register int Howmany;
!     errno = 0;
!     Howmany = read(devtty,circlebuf+nextin,1);
  
      if (Howmany < 0 && (errno == EAGAIN || errno == EINTR)
  	Howmany = 0;
***************
*** 623,629
  {
      register int Howmany = read(devtty,circlebuf+nextin,1);
  
!     if (Howmany < 0 && errno == EAGAIN)	/* POSIX sez this is how it works */
  	Howmany = 0;
      if (Howmany) {
  	nextin += Howmany;

--- 629,635 -----
      errno = 0;
      Howmany = read(devtty,circlebuf+nextin,1);
  
!     if (Howmany < 0 && (errno == EAGAIN || errno == EINTR)
  	Howmany = 0;
      if (Howmany) {
  	nextin += Howmany;
***************
*** 759,765
      for (;;) {
  	int_count = 0;
  	errno = 0;
! 	if (read_tty(whatbuf,1) < 0)
  	    if (!errno)
  	        errno = EINTR;
  	    else {

--- 765,771 -----
      for (;;) {
  	int_count = 0;
  	errno = 0;
! 	if (read_tty(whatbuf,1) < 0){
  	    if (!errno)
  	        errno = EINTR;
  	    if (errno == EINTR)
***************
*** 762,768
  	if (read_tty(whatbuf,1) < 0)
  	    if (!errno)
  	        errno = EINTR;
! 	    else {
  	    perror(readerr);
  	    sig_catcher(0);
  	}

--- 768,775 -----
  	if (read_tty(whatbuf,1) < 0){
  	    if (!errno)
  	        errno = EINTR;
! 	    if (errno == EINTR)
! 		return;
  	    perror(readerr);
  	    sig_catcher(0);
  	}
***************
*** 951,957
  	for (i=0; i<COLS; i++) {
  	    if (!*s)
  		break;
! 	    if (*s >= ' ')
  		putchar(*s);
  	    else if (*s == '\t') {
  		putchar(*s);

--- 958,964 -----
  	for (i=0; i<COLS; i++) {
  	    if (!*s)
  		break;
! 	    if (*(unsigned char *)s >= ' ')
  		putchar(*s);
  	    else if (*s == '\t') {
  		putchar(*s);
***************
*** 1009,1015
  printcmd()
  {
      if (verify && buf[1] == FINISHCMD) {
! 	if (*buf < ' ') {
  	    putchar('^');
  	    putchar(*buf | 64);
  	    backspace();

--- 1016,1022 -----
  printcmd()
  {
      if (verify && buf[1] == FINISHCMD) {
! 	if (*(unsigned char *)buf < ' ') {
  	    putchar('^');
  	    putchar(*buf | 64);
  	    backspace();
Index: rn.c
Prereq: 4.3.2.7
*** rn.c	Mon Dec 10 00:54:21 1990
--- ../rn/rn.c	Mon Dec 10 01:35:56 1990
***************
*** 9,16
   *      RRN/RN: 11/01/89
  */
  
! static char rnid[] = "@(#)$Header: rn.c,v 4.3.2.7 90/11/23 20:30:43 sob Exp $";
! static char patchlevel[] = "Patch #: 50";
  
  /* $Log:	rn.c,v $
   * Revision 4.3.2.7  90/11/23  20:30:43  sob

--- 9,16 -----
   *      RRN/RN: 11/01/89
  */
  
! static char rnid[] = "@(#)$Header: rn.c,v 4.3.2.8 90/12/10 01:35:43 sob Exp $";
! static char patchlevel[] = "Patch #: 51";
  
  /* $Log:	rn.c,v $
   * Revision 4.3.2.8  90/12/10  01:35:43  sob
***************
*** 13,18
  static char patchlevel[] = "Patch #: 50";
  
  /* $Log:	rn.c,v $
   * Revision 4.3.2.7  90/11/23  20:30:43  sob
   * Checkpoint for patch 50
   * 

--- 13,21 -----
  static char patchlevel[] = "Patch #: 51";
  
  /* $Log:	rn.c,v $
+  * Revision 4.3.2.8  90/12/10  01:35:43  sob
+  * Checkpoint for patch 51
+  * 
   * Revision 4.3.2.7  90/11/23  20:30:43  sob
   * Checkpoint for patch 50
   * 
Index: patchlevel
Prereq: 50
*** patchlevel	Mon Dec 10 00:53:54 1990
--- ../rn/patchlevel	Mon Dec 10 01:36:07 1990
***************
*** 1,2
! Patch #: 50
  

--- 1,2 -----
! Patch #: 51