For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > July 2007 > Redirect stdin -> tty, tty -> stdout









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Redirect stdin -> tty, tty -> stdout
Daniel Engeler

2007-07-25, 7:07 pm

Hi,

I wrote a simple program that does the following:

Thread 1: c = read(stdin); write(tty, c);
Thread 2: c = read(tty); write(stdout, c);

Basically, send everything from stdin to the tty, and send everything
from the tty to stdout.

This is so simple it must already exist, hopefully with all the gory
tty details handled nicely. Do you know any such program?

Thanks,
Daniel

Alan Curry

2007-07-25, 7:07 pm

In article <1185391263.628830.121190@g4g2000hsf.googlegroups.com>,
Daniel Engeler <engeler@gmail.com> wrote:
>Hi,
>
>I wrote a simple program that does the following:
>
> Thread 1: c = read(stdin); write(tty, c);
> Thread 2: c = read(tty); write(stdout, c);
>


sh -c 'cat /dev/tty & cat >/dev/tty ; wait'

I have trouble seeing where this would be useful. Reinventing /usr/bin/script?

--
Alan Curry
pacman@world.std.com
Daniel Engeler

2007-07-26, 4:18 am

> sh -c 'cat /dev/tty & cat >/dev/tty ; wait'
>
> I have trouble seeing where this would be useful. Reinventing /usr/bin/script?


This makes a simple serial terminal in Emacs.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com