Hi Enrique,

> $ cat file.txt |script.l
> (key) does not wait for a keypress.

I think this is not possible, at least I don't see a direct way.


(key) reads from standard input. However, here the process is started in
a pipe, so standard input is not the console, but a file. After reading
with

   (in NIL
      (until (eof)
         (prinl (line)) ) )

EOF is reached on that file, so no further reading is possible, and
(key) immediately returns NIL.


You _can_ force standard input back to the console with 'ctty'

   (prinl "Press Key...")
   (ctty "/dev/tty")
   (key)

but still this does not do what you want, because (key) cannot set the
terminal to raw mode. This is due to how the interpreter is implemented:
It determines the console parameters at startup, to be able to restore
them upon exit. However, in the above case, there is no console at
startup.

So the above works, but you have to press <enter> because the terminal
is in cooked mode.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to