Two paths for one file descriptor

Don Libes libes at cme.nist.gov
Wed Feb 20 08:10:25 AEST 1991


In article <3814 at wb3ffv.ampr.org> wmark at wb3ffv.ampr.org (Mark Winsor) writes:
>I need the ability within a curses based program to be able to send the 
>standard output to two different terminals upon receipt of a SIGUSR1. The
>purpose of this is to enable remote viewing via modem of what a user is 
>doing WITHOUT requiring them to get out of the application. Anybody have
>any suggestions? I realize that most solutions will require that the
>local and remote terminals are the same type (which is not a problem). Any
>ideas would be appreciated.

If you have expect (see comp.unix.questions FAQ), you can do this with
the following script:

	trap {log_file another-terminal} SIGUSR1
	spawn curses-based-program
	interact

You can jam this all on the command line without the script as:

	expect -c "trap {log_file file} SIGUSR1; spawn program; interact"

Don Libes          libes at cme.nist.gov      ...!uunet!cme-durer!libes



More information about the Comp.unix.programmer mailing list