Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!harpo!seismo!hao!hplabs!sri-unix!dan@bbncd From: dan@bbncd@sri-unix.UUCP Newsgroups: net.unix-wizards Subject: stdio buffering considered harmful Message-ID: <3610@sri-arpa.UUCP> Date: Fri, 29-Jul-83 14:31:18 EDT Article-I.D.: sri-arpa.3610 Posted: Fri Jul 29 14:31:18 1983 Date-Received: Mon, 1-Aug-83 08:59:30 EDT Lines: 22 From: Dan FranklinThanks for the comments. Since no one came up with anything better than using the environment, that's what I will do. In case anyone else is interested in solving this problem, here's exactly how I plan to do it (when I finally get around to it). I plan to have three choices, each set by assigning a value to STDOUT in the environment: STDOUT=NBUF # no buffering STDOUT=LBUF # line buffering STDOUT=BBUF # block buffering If there is an explicit setbuf(stdout,...) in the program, it seems like the environment setting ought to override it, at least in the case where the environment specifies less buffering than the setbuf. I plan to have it override all the time. The environment variable would also override stdio's determination of the buffering to use based on isatty(). The same mechanism will also work for STDERR. (STDERR=BBUF could be handy when you have a program producing lots of error output, all unbuffered.) Dan Franklin