From laura!unido!mcvax!uunet!auspex!guy Thu Jul 13 18:11:25 MET DST 1989
Article 1835 of comp.sources.bugs:
Path: laura!unido!mcvax!uunet!auspex!guy
>From: guy@auspex.auspex.com (Guy Harris)
Newsgroups: comp.sources.bugs
Subject: Re: v07i001:  ularn - ultra-larn, an enhancement of the larn adventure game, Part01/08
Message-ID: <2232@auspex.auspex.com>
Date: 12 Jul 89 22:46:01 GMT
References: <4194@tekred.CNA.TEK.COM> <815@kosman.UUCP> <2228@auspex.auspex.com> <2230@auspex.auspex.com>
Reply-To: guy@auspex.auspex.com (Guy Harris)
Organization: Auspex Systems, Santa Clara
Lines: 34
Posted: Wed Jul 12 23:46:01 1989

Yes, the author is jumping the gun; the claim seems to be that System V
has "tcflush" and company, but only recent releases have it, i.e. it
must be S5R3.2 or later, since S5R3.1 from AT&T doesn't have that
POSIXism.

The routine "flushall()" is best replaced by something like:

#ifdef BSD
#include <sys/file.h>	/* to get FREAD */
#endif

/*
 *	flushall()	Function to flush all type-ahead in the input buffer
 */
flushall()
{
#ifdef BSD
	static int fread = FREAD;

	ioctl(0, TIOCFLUSH, &fread);
#else /* SYSV */
#  ifdef unix
	ioctl(0, TCFLSH, 0);
#  endif /* unix */
#endif /* BSD */
}

since not only should all System V systems (including Xenix System V, if
it's truly SVID-compatible in its tty driver) have TCFLSH in that form,
even if they don't have POSIX stuff, but BSD has had the ability to
selectively flush the input, output, or both queues since 4.2BSD (if you
have 4.1BSD, you lose here, oh well).  If the intent of the "#ifdef
unix" is to eliminate Xenix (although, if Xenix doesn't define "unix",
somebody screwed up), it can be eliminated.


