re-directing 'rup' to a file

Tom Christiansen tchrist at convex.COM
Tue Mar 5 18:02:51 AEST 1991


>From the keyboard of bill at unixland.uucp (Bill Heiser):
:I have a user that wants to get a list of hosts on the network
:that respond with n seconds.  I have a "timeout" program that someone
:on the net sent me -- it times out if a command doesn't complete 
:within a certain number of seconds -- and aborts the command.

[possibly mine -- i've one that looks like that i've sent out]

:Anyway, he is trying to do something like 
:   timeout 10 rup > rup.list
:
:When the timeout occurs, though, there is nothing in rup.list!
:
:The same thing happens if I type 'rup > rup.lis' and control-c
:out of it after some time period.
:
:Is it something to do with buffering of output?

Yes, that's exactly it.  Stdio is disk buffering.  

:How can I make whatever output occurs within seconds go to the file?

You need to get it to think its output is a tty.  Dan will
suggest using pty.  Nothing much short of hacking the source
comes to mind.  While it's nice that pty should care of a lot of
obnoxious things like this, I think that this is just a hack
around a problem caused by lack of design forethought in stdio:
you shouldn't need a whole pty just to get line buffering!

--tom



More information about the Comp.unix.questions mailing list