Subject: more(1) has lingering TBDELAY reference (#393)
Index:	ucb/more/more.c,Makefile 2.11BSD

Description:
	more.c fails to compile due to TBDELAY being undefined.

Repeat-By:
	cd /usr/src/ucb/more
	make

Fix:
	When the special character delay handling was removed from the 
	system (updates 369 - 371) one reference was overlooked.  That there
	were not more is surprising given the number of files modified.

	TBDELAY is no longer defined and more/more.c needs to be updated.

	The initial fix was quite small but the urge to tidy up could not
	be resisted.  In addition to fixing more.c so it will compile once
	again these changes were made:
	
		1) The local copy of 'strlen' was removed - never did understand
		   why folks would code their own functions rather than use 
		   the system provided ones (especially on the PDP-11 where
		   strlen is written in assembly language for speed).

		2) putchar is undefined after including stdio.h.  Using the
		   function rather than the macro saves about 2kb of text with
		   no noticeable speed difference.

		3) local definitions of libc entities (errno, fseek, ...) were
		   removed and unistd.h/stdlib.h included.

		4) The Makefile was updated to install the helpfile with mode
		   444 rather than relying on the current umask at the time
		   of installation (the help file needs to be readable by 
		   everyone).

	To install this update cut where indicated saving to a file (/tmp/393).
	Then:

		patch -p0 < /tmp/393
		cd /usr/src/ucb/more
		make
		make install
		make clean

	As always this and previous updates to 2.11BSD are available via
	anonymous FTP to either FTP.IIPO.GTEGSC.COM or MOE.2BSD.COM in the
	directory /pub/2.11BSD.

=============================cut here========================
*** /usr/src/ucb/more/more.c.old	Wed Oct 23 15:59:26 1996
--- /usr/src/ucb/more/more.c	Sat Oct 18 16:47:43 1997
***************
*** 9,15 ****
  "@(#) Copyright (c) 1980 Regents of the University of California.\n\
   All rights reserved.\n";
  
! static char sccsid[] = "@(#)more.c	5.4.1 (2.11BSD) 1996/10/23";
  #endif
  
  /*
--- 9,15 ----
  "@(#) Copyright (c) 1980 Regents of the University of California.\n\
   All rights reserved.\n";
  
! static char sccsid[] = "@(#)more.c	5.4.2 (2.11BSD) 1997/10/18";
  #endif
  
  /*
***************
*** 22,34 ****
--- 22,38 ----
  */
  
  #include <stdio.h>
+ #undef	putchar			/* force use of function rather than macro */
  #include <sys/types.h>
  #include <ctype.h>
  #include <signal.h>
  #include <errno.h>
+ #include <paths.h>
  #include <sgtty.h>
  #include <setjmp.h>
  #include <sys/stat.h>
+ #include <stdlib.h>
+ #include <unistd.h>
  
  #define HELPFILE	"/usr/share/misc/more.help"
  #define VI		"/usr/ucb/vi"
***************
*** 96,103 ****
  int		soglitch;	/* terminal has standout mode glitch */
  int		ulglitch;	/* terminal has underline mode glitch */
  int		pstate = 0;	/* current UL state */
- long		fseek();
- char		*getenv();
  struct {
      long chrctr, line;
  } context, screen_start;
--- 100,105 ----
***************
*** 591,599 ****
  */
  
  printd (n)
! int n;
  {
!     int a, nchars;
  
      if (a = n/10)
  	nchars = 1 + printd(a);
--- 593,601 ----
  */
  
  printd (n)
! register int n;
  {
!     register int a, nchars;
  
      if (a = n/10)
  	nchars = 1 + printd(a);
***************
*** 616,623 ****
  }
  
  Sprintf (n)
  {
!     int a;
  
      if (a = n/10)
  	Sprintf (a);
--- 618,626 ----
  }
  
  Sprintf (n)
+ register int n;
  {
!     register int a;
  
      if (a = n/10)
  	Sprintf (a);
***************
*** 626,642 ****
  
  static char bell = ctrl(G);
  
- strlen (s)
- char *s;
- {
-     register char *p;
- 
-     p = s;
-     while (*p++)
- 	;
-     return (p - s - 1);
- }
- 
  /* See whether the last component of the path name "path" is equal to the
  ** string "string"
  */
--- 629,634 ----
***************
*** 1272,1279 ****
      register long line2 = startline;
      register long line3 = startline;
      register int lncount;
!     int saveln, rv, re_exec();
!     char *s, *re_comp();
  
      context.line = saveln = Currline;
      context.chrctr = startline;
--- 1264,1271 ----
      register long line2 = startline;
      register long line3 = startline;
      register int lncount;
!     int saveln, rv;
!     char *s;
  
      context.line = saveln = Currline;
      context.chrctr = startline;
***************
*** 1529,1535 ****
  
  	}
  	if ((shell = getenv("SHELL")) == NULL)
! 	    shell = "/bin/sh";
      }
      no_intty = gtty(fileno(stdin), &otty);
      gtty(fileno(stderr), &otty);
--- 1521,1527 ----
  
  	}
  	if ((shell = getenv("SHELL")) == NULL)
! 	    shell = _PATH_BSHELL;
      }
      no_intty = gtty(fileno(stdin), &otty);
      gtty(fileno(stderr), &otty);
***************
*** 1536,1542 ****
      savetty = otty;
      ospeed = otty.sg_ospeed;
      slow_tty = ospeed < B1200;
!     hardtabs = (otty.sg_flags & TBDELAY) != XTABS;
      if (!no_tty) {
  	otty.sg_flags &= ~ECHO;
  	if (MBIT == CBREAK || !slow_tty)
--- 1528,1534 ----
      savetty = otty;
      ospeed = otty.sg_ospeed;
      slow_tty = ospeed < B1200;
!     hardtabs = !(otty.sg_flags & XTABS);
      if (!no_tty) {
  	otty.sg_flags &= ~ECHO;
  	if (MBIT == CBREAK || !slow_tty)
***************
*** 1547,1553 ****
  readch ()
  {
  	char ch;
- 	extern int errno;
  
  	if (read (2, &ch, 1) <= 0)
  		if (errno != EINTR)
--- 1539,1544 ----
*** /usr/src/ucb/more/Makefile.old	Wed Oct 23 15:58:27 1996
--- /usr/src/ucb/more/Makefile	Sat Oct 18 17:46:42 1997
***************
*** 3,9 ****
  # All rights reserved.  The Berkeley software License Agreement
  # specifies the terms and conditions for redistribution.
  #
! #	@(#)Makefile	5.1.1 (2.11BSD) 1996/10/23
  #
  CFLAGS=	-O
  SEPFLAG= -i
--- 3,9 ----
  # All rights reserved.  The Berkeley software License Agreement
  # specifies the terms and conditions for redistribution.
  #
! #	@(#)Makefile	5.1.2 (2.11BSD) 1997/10/17
  #
  CFLAGS=	-O
  SEPFLAG= -i
***************
*** 13,32 ****
  	${CC} ${SEPFLAG} -o more more.o -ltermcap
  
  install: more more.help
! 	install -s more ${DESTDIR}/usr/ucb/more
  	rm -f ${DESTDIR}/usr/ucb/page
  	ln ${DESTDIR}/usr/ucb/more ${DESTDIR}/usr/ucb/page
! 	install -c more.help ${DESTDIR}/usr/share/misc/more.help
! 
! more.o:	more.c
! more.o:	/usr/include/stdio.h
! more.o:	/usr/include/ctype.h
! more.o:	/usr/include/signal.h
! more.o:	/usr/include/errno.h
! more.o:	/usr/include/sgtty.h
! more.o:	/usr/include/setjmp.h
! more.o:	/usr/include/sys/types.h
! more.o:	/usr/include/sys/stat.h
  
  clean:
  	rm -f more more.o core a.out errs
--- 13,22 ----
  	${CC} ${SEPFLAG} -o more more.o -ltermcap
  
  install: more more.help
! 	install -m 755 -s more ${DESTDIR}/usr/ucb/more
  	rm -f ${DESTDIR}/usr/ucb/page
  	ln ${DESTDIR}/usr/ucb/more ${DESTDIR}/usr/ucb/page
! 	install -m 444 -c more.help ${DESTDIR}/usr/share/misc/more.help
  
  clean:
  	rm -f more more.o core a.out errs
*** /VERSION.old	Tue Oct  7 19:56:21 1997
--- /VERSION	Sat Oct 18 16:22:44 1997
***************
*** 1,5 ****
! Current Patch Level: 392
! Date: October 7, 1997
  
  2.11 BSD
  ============
--- 1,5 ----
! Current Patch Level: 393
! Date: October 18, 1997
  
  2.11 BSD
  ============
