On Wed, Dec 12, 2007 at 01:20:53PM -0300, Jorge Pereira wrote: > anybody have any idea about how to make hooking of "stdin"?
Yes, 34 years ago Doug McIlroy thought about it when writing a shell
and Ken Thompson implemented it overnight in Unix[1].
> eg: i has the "device barcode" that receive bytes in /dev/ttyS0, and i need
> redirect this bytes to stdin.
> it's possible? have ideas or exaple to i start this implemetation?
Either use redirection from the shell or use close(0) followed
immediately by open(/dev/ttyS0);
Or get yourself a copy of "Advanced programming in the Unix
environment" by the late W. Richard Stevens which explains all of the
above and more.
Erik
[1] See "A quarter century of Unix" by Peter H. Salus and
http://en.wikipedia.org/wiki/Pipeline_(Unix) .
--
They're all fools. Don't worry. Darwin may be slow, but he'll
eventually get them. -- Matthew Lammers in alt.sysadmin.recovery
signature.asc
Description: Digital signature
