robin@turing.ac.uk (Robin Boswell) (03/01/88)
I have an interactive C-program which reads some of its input from the
terminal in CBREAK mode. Is there any way I can run it as an inferior
shell process inside GNU-EMACS and retain this behaviour? (i.e. I want it
to read characters as they are typed, without the need for a <CRLF>).
Since CBREAK mode is only appropriate for some of the input
(e.g. as in rn), I need to be able to set the mode from within
the C program, and so a crude solution like binding all alpha-numeric
keys to "(insert-char ...) (send-shell-input)" wouldn't be
satisfactory.
I can get at the C-source to modify it, if necessary, as well as
playing around with EMACS.
The relevant C code is currently:
struct sgttyb state;
fd = open("/dev/tty", O_RDONLY, 0);
ioctl(fd, TIOCGETP, &state);
state.sg_flags |= CBREAK;
ioctl(fd, TIOCSETP, &state);
......
read(fd, &char, 1);
.....
Thank you for any suggestions.
Robin Boswell.
(Please send mail from outside the UK to
robin%uk.ac.ed.aiva@nss.cs.ucl.ac.uk
unless you are authorised to use the UCL gateway, as Turing isn't).