[talk] Receiving the output of a terminal

Jesse Callaway bonsaime at gmail.com
Wed Jul 12 10:48:30 EDT 2017


On Wed, Jul 12, 2017 at 2:59 AM, Thomas Levine <_ at thomaslevine.com> wrote:

> How can I receive the output of a tty in another program? Or, perhaps
> an easier way of asking this: is there good documentation on how to
> implement a terminal emulator?
>
> To give you an idea of what I am looking for, it could naïvely sort of
> make sense that the following procedure would accomplish what I want.
> Inside the sending virtual terminal, run this.
>
>   ln -s $(tty) /tmp/tty
>
> Then, inside the receiving program, run this
>
>   cat /tmp/tty
>
> Of course it does not do what I want, probably because both the first
> terminal and the cat are consuming output of the tty.
>
>
>
> I want this so I can improve my screen reader software. In the present
> implementation I have patched script(1) so that output to the file is
> less buffered and so that header and footer messages are not printed.
> https://thomaslevine.com/scm/tsh/artifact/ab625a43ee958dba
>
> Then I send the output from the resulting patched script(1) to a FIFO,
> and I read from the FIFO into espeak.
> https://thomaslevine.com/scm/tsh/artifact/75f981520a431d96
>
> I think I should be able to implement this far more simply by reading
> directly from an ordinary tty rather than using script(1).
>
> My present implementation is still much better than that of any other
> screen reader that I am aware of. Mine is far simpler than all the
> others that I have read about because the others all implement
> unnecessary non-standard alternatives to things that already already
> exist in shells or in Unix-style programs that can easily be called from
> shells. The main benefit of doing this without patching script(1) is
> thus to make it easier to port to other systems.
>
> _______________________________________________
> talk mailing list
> talk at lists.nycbug.org
> http://lists.nycbug.org/mailman/listinfo/talk


Funny I was looking to do something similar the other day. Wanted to pipe
stdout via a tee to netcat. I think creative use of the "screen" program
could do it, but haven't spent enough time in the gedankenwelt to get it
done.

-- 
-jesse
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nycbug.org/pipermail/talk/attachments/20170712/e6d1ffad/attachment.html>


More information about the talk mailing list