[4844] in Athena Bugs

home help back first fref pref prev next nref lref last post

6.4R: more.c

daemon@ATHENA.MIT.EDU (Richard Basch)
Mon Apr 30 09:03:55 1990

Date: Mon, 30 Apr 90 09:03:40 -0400
To: bugs@MIT.EDU
From: Richard Basch <probe@MIT.EDU>

"more" doesn't compile with hc2.1y because of constants exceeding
maximum unsigned values.  I used V1.23 of IBM's patches, modified a bit,
since it used the value of max signed, as opposed to a generic max
unsigned.  Simple test programs proved that the previous value
0x7ffffffffff (I may be off on the number of f's) translates to
0xFFFFFFFF.  It is better using the larger value since file sizes could
easily be the former... 2GB (use an exabyte, for instance) [In fact, the
former is the size that we have specified for the exabyte drives for AFS
backups, since the AFS backup scheme doesn't seem to deal with values
greater than max signed int].  The patch is probably clearer than the
explanation...

This is already fixed and tested in 7.0 (the code doesn't compile
without it).

-Richard


*** /tmp/,RCSt1018939	Mon Apr 30 08:55:46 1990
--- more.c	Mon Apr 30 08:47:31 1990
***************
*** 1,10 ****
  /*
   *	$Source: /afs/rel-eng.athena.mit.edu/project/release/current/source/bsd-4.3/common/ucb/more/RCS/more.c,v $
!  *	$Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/bsd-4.3/common/ucb/more/RCS/more.c,v 1.10 90/03/24 14:04:13 probe Exp $
   */
  
  #ifndef lint
! static char *rcsid_more_c = "$Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/bsd-4.3/common/ucb/more/RCS/more.c,v 1.10 90/03/24 14:04:13 probe Exp $";
  #endif lint
  
  /*
--- 1,10 ----
  /*
   *	$Source: /afs/rel-eng.athena.mit.edu/project/release/current/source/bsd-4.3/common/ucb/more/RCS/more.c,v $
!  *	$Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/bsd-4.3/common/ucb/more/RCS/more.c,v 1.11 90/04/30 08:46:00 probe Exp $
   */
  
  #ifndef lint
! static char *rcsid_more_c = "$Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/bsd-4.3/common/ucb/more/RCS/more.c,v 1.11 90/04/30 08:46:00 probe Exp $";
  #endif lint
  
  /*
***************
*** 67,72 ****
--- 67,75 ----
  #define ESC	'\033'
  #define QUIT	'\034'
  
+ #define       LONG_MAX        ((unsigned)~0)
+ 
+ 
  struct sgttyb	otty, savetty;
  char		*def_editor = EDITOR;
  long		file_pos, file_size;
***************
*** 280,286 ****
  		left = command (fnames[fnum], f);
  	    }
  	    if (left != 0) {
! 		if ((noscroll || clearit) && (file_size != 0x7fffffffffffffffL))
  		    if (clreol)
  			home ();
  		    else
--- 283,289 ----
  		left = command (fnames[fnum], f);
  	    }
  	    if (left != 0) {
! 		if ((noscroll || clearit) && (file_size != LONG_MAX))
  		    if (clreol)
  			home ();
  		    else
***************
*** 431,437 ****
  	Ungetc (c, f);
      }
      if ((file_size = stbuf.st_size) == 0)
! 	file_size = 0x7fffffffffffffffL;
      return (f);
  }
  
--- 434,440 ----
  	Ungetc (c, f);
      }
      if ((file_size = stbuf.st_size) == 0)
! 	file_size = LONG_MAX;
      return (f);
  }
  

home help back first fref pref prev next nref lref last post