[comp.sources.games] v06i082: tt - Tetris for ordinary terminals, Patch1

billr@saab.CNA.TEK.COM (Bill Randle) (06/24/89)

Submitted-by: Mike Taylor <maujf@cu.warwick.ac.uk>
Posting-number: Volume 6, Issue 82
Archive-name: tt/Patch1
Patch-To: Volume 6, Issue 81

	[I repackaged this as a context diff inside a shar file. Feed
	 directly to patch(1), or however you want to do it.  -br]


Patch #1 for "tt" - Tetris for terminals
========================================

This is not a bug-fix as such, but a short piece of code to be
appended to the header-file tt.h, which will allow tt to run on
Berkeley UNIXes older than 4.3, (ie. those without the FD_ macros).
These macros were introduced in 4.3 (and in SunOS 4.0) since these
UNIXes allow more than 32 file-descriptors open at once, and thus they
can no longer all be flagged by setting bits in a 32-bit long integer.

In fact, "tt" only select()s on one file-descriptor at a time, so the
lack of width will certainly be no problem.  The macros as defined
here simply twiddle the bits of a long integer in much the same way as
I would have done in the first place had I written "tt" to run under
4.2, but using the same names as the corresponding 4.3 macros, so none
of the existing "tt" code need be changed.

Sorry I didn't think of this before I posted the first time!

Have fun! -- Unkle Mirk

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  patches01
# Wrapped by billr@saab on Fri Jun 23 17:20:37 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'patches01' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patches01'\"
else
echo shar: Extracting \"'patches01'\" \(1166 characters\)
sed "s/^X//" >'patches01' <<'END_OF_FILE'
X*** tt.h.orig	Wed Jun 21 06:46:22 1989
X--- tt.h	Fri Jun 23 17:17:31 1989
X***************
X*** 133,135 ****
X--- 133,154 ----
X  extern void signal_die ();	/* When CTRL-C etc. is pressed */
X  
X  /*-------------------------------------------------------------------------*/
X+ /***************************************************************************\
X+ |*									   *|
X+ |*  The following macros will be defined if FD_ZERO is not defined by	   *|
X+ |*  the system.  They simulate the behaviour of 4.3bsd's FD_ macros for	   *|
X+ |*  4.2bsd machines, (ie. those running Berkeley UNIX, but of earlier	   *|
X+ |*  issue than 4.3; also SunOS, issues earlier than 4.0.		   *|
X+ |*									   *|
X+ |*  This section added Fri Jun 23 20:18:20 BST 1989			   *|
X+ |*  Written by Mike Taylor (mirk@uk.ac.warwick.cs)			   *|
X+ |*									   *|
X+ \***************************************************************************/
X+ 
X+ #ifndef FD_ZERO
X+ #  define fd_set long int
X+ #  define FD_ZERO(fds_ptr) *(fds_ptr) = 0
X+ #  define FD_SET(fd, fds_ptr) *(fds_ptr) |= (1<<(fd))
X+ #endif /* FD_ZERO */
X+ 
X+ /*-------------------------------------------------------------------------*/
END_OF_FILE
if test 1166 -ne `wc -c <'patches01'`; then
    echo shar: \"'patches01'\" unpacked with wrong size!
fi
# end of 'patches01'
fi
echo shar: End of shell archive.
exit 0