[comp.sources.games.bugs] Larn 12.2 and SYSV

routley@tle.enet.dec.com (02/02/91)

Andreas Wettengal (andreas@nixhhs.uucp) sent me the following patch that
allowed him to compile and run Larn 12.2 on a Pyramid SYSV system.  I'd
like to post it as an "official" patch, except that it needs testing
first, and I
don't have access to a SYSV system.  Could some kind souls out there try
out this patch and let me know if it does the job on various SYSV systems?

The patch is basically changing the keyboard flush stuff in TOK.C to use
SYSV ioctl() parameters.  I'm not completely confident that the patch is
all that is required to get Larn 12.2 running under SYSV, since Ultra-larn
had additional SYSV-specific areas in the code.

Assistance from SYSV users greatly appreciated.

Thanks,
Kevin

diff -rc larn.orig/tok.c larn122/tok.c
*** larn.orig/tok.c	Mon Jan  7 15:58:13 1991
--- larn122/tok.c	Mon Jan  7 15:59:15 1991
***************
*** 105,110
  		/* If keyboard input buffer is too big then flush some? RDE */
  		/* Check this! but for now just ignore it... */
  # else
  		do /* if keyboard input buffer is too big, flush some of it */
  			{
  			ioctl(0,FIONREAD,&ic);

--- 105,111 -----
  		/* If keyboard input buffer is too big then flush some? RDE */
  		/* Check this! but for now just ignore it... */
  # else
+ #ifdef BSD
  		do /* if keyboard input buffer is too big, flush some of it */
  			{
  			ioctl(0,FIONREAD,&ic);
***************
*** 111,116
  			if (ic>flushno)   read(0,&cc,1);
  			}
  		while (ic>flushno);
  # endif VMS
  # endif MSDOS
  

--- 112,120 -----
  			if (ic>flushno)   read(0,&cc,1);
  			}
  		while (ic>flushno);
+ #else /* NOT BSD */
+ 		ioctl(0,TCFLSH,0);
+ #endif /* not BSD */
  # endif VMS
  # endif MSDOS
  
***************
*** 176,181
  # else VMS
  	char cc;
  	int ic;
  	for (;;) {		/* if keyboard input buffer is too big, flush some of it */
  		ioctl(0,FIONREAD,&ic);
  		if (ic<=0)

--- 180,186 -----
  # else VMS
  	char cc;
  	int ic;
+ #ifdef BSD
  	for (;;) {		/* if keyboard input buffer is too big, flush some of it */
  		ioctl(0,FIONREAD,&ic);
  		if (ic<=0)
***************
*** 185,190
  			--ic;
  		} /* gobble up the byte */
  	}
  # endif VMS
  # endif MSDOS
  }

--- 190,198 -----
  			--ic;
  		} /* gobble up the byte */
  	}
+ #else /* not BSD */
+ 		ioctl(0,TCFLSH,0);
+ #endif /* not BSD */
  # endif VMS
  # endif MSDOS
  }