Re: Raw Terminal I/O in lisp



fungsin.lui@xxxxxxxxx wrote:

My platform is linux 2.6 (sbcl or lispworks). I'm trying to figure out
how to do terminal I/O in noncanonical mode with lisp.

The easiest way is to write a C function that sets the terminal mode to
your specifications, and call it from Lisp.

(load-shared-object "my_terminal.so")
(define-alien-routine tty-raw int (fd int))

(tty-raw 0)

FD's 0-2 are standard in the sense that they are what you console talks
to. Which Lisp stream they are attached to is less-obvious, but I'd be
moderately surprised if STDIN wasn't what you want.

You may want to look at how Linedit deals with this (though there are
some things I would do differently if I was writing it now, but isn't
too horrible).

http://common-lisp.net/project/linedit

Cheers,

-- Nikodemus

.