Path: utzoo!utgpu!attcan!uunet!mcvax!steven
From: steven@cwi.nl (Steven Pemberton)
Newsgroups: comp.sys.atari.st
Subject: Ctrl-C
Message-ID: <7620@boring.cwi.nl>
Date: 15 Aug 88 17:19:49 GMT
Sender: news@cwi.nl
Reply-To: steven@cwi.nl (or try mcvax!steven.uucp)
Organization: CWI, Amsterdam
Lines: 33

Gemdos only registers a ctrl-c when something is written to the
screen, or read from the keyboard (and then only non-raw I/O).

I've struggled to find a way of getting Gemdos to react at other
times, but all with failure.  I've tried testing to see if a character
is available, writing zero characters with Cconws, and a dozen other
ways, all to no avail.

With MS-DOS (on which Gemdos is modelled), there is a way of polling
to see if a ctrl-c has been typed, by telling Dos that you also want
ctrl-c checked when non I/O system calls are called, and then doing
some benign system call, like reading the time.

Unfortunately, with Gemdos they apparently forgot to allow this.

So it seems to me that the only way of allowing ctrl-c when you're not
doing I/O is the following:

	If output is not redirected: periodically write a NUL;
		this seems to have no effect on the screen, but does
		generate a ctrl-c trap if one has been typed. (If the
		output is redirected, the NUL's end up in the file.)

	If output is redirected, but input is not redirected:
		periodically read and buffer the input yourself.
		You could also do this in the above case.

	If both are redirected: read and discard raw characters from
		the keyboard, checking for ctrl-c.

My question is: does anybody know of a simpler method?

Steven Pemberton, CWI, Amsterdam; steven@cwi.nl