[comp.unix.questions] How do you get *unbuffered* pipeline I/O from sys commands

mackeown@CompSci.Bristol.AC.UK (W. Mackeown) (02/02/90)

Does anyone know if it is possible to force SunOS v4.0.1 Unix on Sun 3/50's
to do unbuffered pipeline I/O ?  What is wanted is a way to make system
commands send their output through a pipe in unbuffered form, ie. a single
character at a time. "stty +cbreak" obviously won't accomplish this.

Any ideas/suggestions welcomed. Thanks.

William Mackeown
mackeown@compsci.bristol.ac.uk

richard@aiai.ed.ac.uk (Richard Tobin) (02/09/90)

In article <1320@csisles.Bristol.AC.UK> mackeown@csisles.UUCP (W. Mackeown) writes:
>Does anyone know if it is possible to force SunOS v4.0.1 Unix on Sun 3/50's
>to do unbuffered pipeline I/O ?  What is wanted is a way to make system
>commands send their output through a pipe in unbuffered form, ie. a single
>character at a time. "stty +cbreak" obviously won't accomplish this.

If a program is using standard i/o to write to a pipe, then there's no
way to remove the buffering without modifying the program - the buffering
is done by the program, not by the operating system.

What you *can* do is use a pseudo-terminal instead of a pipe.  Then the
buffering will be the same as when the program is sending output to the
screen - typically a line at a time.  This may or may not be good enough.

You won't be able to arrange this from a standard shell, but you could
write a program that takes two commands and connects them through a pseudo-
terminal.

-- Richard
-- 
Richard Tobin,                       JANET: R.Tobin@uk.ac.ed             
AI Applications Institute,           ARPA:  R.Tobin%uk.ac.ed@nsfnet-relay.ac.uk
Edinburgh University.                UUCP:  ...!ukc!ed.ac.uk!R.Tobin