[comp.emacs] unbufferd input; hypercard emulator

billl@sdbio2.ucsd.edu (bill lytton) (09/06/90)

I was wondering if there were any hooks or functions
that will permit one to run a program that requires 
unbuffered input (i.e. that wants to see a single typed
in character without a ^M)?  Other query:  Has anyone
written a Hypercard (like on the MAC) emulator in EMACS.
Outline-mode has some of the function of this but doesn't
offer all the possibilities for cross-reference.

		Bill Lytton (billl@no.sdsc.edu)

vd09+@ANDREW.CMU.EDU ("Vincent M. Del Vecchio") (09/07/90)

I'm not sure what this has to do with Emacs, but I'll respond anyway.

What you have to do is turn off the buffering on the tty.  Generally,
check the tty man pages to find out more (and possibly check ioctl as
well).  In BSD4.3 (can't verify for anything else, but it will be fairly
similar), this should work:

#include <sgtty.h>

struct sgttyb buf;
ioctl(0,TIOCGETP, &buf);
buf.sg_flags |= CBREAK;
ioctl(0,TIOCSETP, &buf);

Then, when you read() or getchar(), it will return immediately.

+----------------------------------------------------------------------------+
| Vincent Del Vecchio     \ Disclaimer: Views expressed are not necessarily  |
| Box 4872                 \ those of any person/group I am associated with. |
| 5125 Margaret Morrison St.\   UUCP: {uunet,harvard}!andrew.cmu.edu!vd09    |
| Pittsburgh, PA  15213      \   BITNET: vd09+%andrew@cmuccvma.bitnet        |
| (412) 268-4441              \   Internet: vd09+@andrew.cmu.edu             |
+----------------------------------------------------------------------------+