[net.bugs.2bsd] bug in script

mcdermot@unmvax.UUCP (02/15/85)

Subject: script does not sync correctly with prog being scripted
Index: 	script under 2.9BSD

Description:
	script "buffers" lines from application programs and does
	not print them at the proper time. Sometimes input must be
	accepted before output is printed.

Repeat-By:
	Try this f77 program:
	print *,'message'
	read(5,*) i
	end

	or a similar C program.  Invoke script and run the program.
	Note that the message is not printed until the value for i
	is entered.


	Any ideas?



-- 

John McDermott			{gatech|ucbvax|convex|pur-ee}!unmvax!mcdermot
Univ of NM			W (505) 277-4650 
Albuquerque, NM 87131		H (505) 255-7796

jsdy@hadron.UUCP (Joseph S. D. Yao) (02/20/85)

> 	script "buffers" lines from application programs and does
> 	not print them at the proper time. Sometimes input must be
> 	accepted before output is printed.

Actually, this is a general problem, not limited to 2bsd.  Solve by
flushing output after print/printf, or by declaring output unbuffered
to begin with.  In C, the latter is:
	setbuf(stdout, (FILE *)NULL);
I don't know what the Furtrann for that would be.

Joe Yao		hadron!jsdy@seismo.{ARPA,UUCP}