[comp.bugs.4bsd] 4.3bsd /usr/ucb/more outputs spurious NUL character +FIX

mp@allegra.UUCP (Mark Plotnick) (09/29/88)

On a "crt", when erasing a character in an input line the 4.3BSD 'more'
program winds up writing a NUL after each backspace-space-backspace sequence.
This ordinarily isn't a problem, except on terminals that
display a NUL as a visible character (my terminal prints out
all control characters that aren't part of an escape sequence
as visible characters).  Here's a suggested fix.  This also applies
to the 'more' on SunOS 4.0.
	Mark Plotnick
	allegra!mp


RCS file: more.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** /tmp/,RCSt1008181	Wed Sep 28 15:10:39 1988
--- /tmp/,RCSt2008181	Wed Sep 28 15:10:40 1988
***************
*** 1564,1570 ****
  static char CARAT = '^';
  #define ERASEONECHAR \
      if (docrterase) \
! 	write (2, BSB, sizeof(BSB)); \
      else \
  	write (2, &BS, sizeof(BS));
  
--- 1564,1570 ----
  static char CARAT = '^';
  #define ERASEONECHAR \
      if (docrterase) \
! 	write (2, BSB, strlen(BSB)); \
      else \
  	write (2, &BS, sizeof(BS));
  
***************
*** 1616,1622 ****
  		    erase (1);
  		else if (docrtkill)
  		    while (promptlen-- > 1)
! 			write (2, BSB, sizeof(BSB));
  		promptlen = 1;
  	    }
  	    sptr = buf;
--- 1616,1622 ----
  		    erase (1);
  		else if (docrtkill)
  		    while (promptlen-- > 1)
! 			write (2, BSB, strlen(BSB));
  		promptlen = 1;
  	    }
  	    sptr = buf;