[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UNIX terminal io incompatibility

Common Lisp maps poorly onto UNIX(tm) in the area of terminal io.

On pages 328 and 329 of CLtL it says:

"*standard-input*,  *standard-output*,  *error-output*,   *trace-
output*,  *query-io*,  and  *debug-io*  are  initially  bound  to
synonym streams that pass all operations on to the stream that is
the  value  of  *terminal-io*."   Earlier  on,  the specification
describes *query-io* and *debug-io* as always  being  interactive

These requirements cause problems under UNIX  when  you  redirect
the  output  of  a  program,  specifically  when you redirect the
output of a Lisp session.  For example:

        clisp > FOO

If we follow the specification and attach *terminal-io*  to  UNIX
stdin/stdout  file  descriptors  and  leave all the other streams
bound to *terminal-io*,  output  from  *debug-io*  will  also  be
redirected  to  the  file,  not  to  the  terminal.  If we attach
*terminal-io* to /dev/tty and leave the other  streams  bound  to
*terminal-out*, then UNIX redirection doesn't work.

Our proposed solution is to  attach  *terminal-io*  to  /dev/tty,
then  attach  *standard-in*  to  UNIX stdin and *standard-out* to
UNIX stdout (not to *terminal-io*).  All  the  other  io  streams
remain bound to *terminal-io*.

This permits the user to redirect stdin and  stdout,  and  output
from  *debug-io*,  etc., still appears on the terminal.  Although
this does not abide by the standard, it is useful enough that  we
propose it as a UNIX-specific addition.
			Anne Jane Gray
			Gould CSD, Urbana, IL.