From: utzoo!decvax!cca!FC01@USC-ECL@sri-unix
Newsgroups: net.unix-wizards
Title: m4 io asap
Article-I.D.: sri-unix.2393
Posted: Sun Aug  1 20:22:44 1982
Received: Mon Aug  2 03:46:53 1982

From: FC01 
Date:  2 Jul 1982 1144-PDT
The following change to your change is what I am using. - note that the first
if you had was a syntax error (unknown reason since I didn't use it) and the
modified version does great

From: Dan Franklin 
Subject: Re: m4 io a line at a time
We made exactly that change so we could use m4 as a front end to adb.
The change was based on the idea that m4 ought to be interactive if
it is reading standard input and standard input is a terminal. The
change was so simple that I might as well give it here. The file is m4.c.
	if (argc>1)
		putbak(0);
/*ADD*/ else if (isatty(0))		/*fc - ignore to do always*/
/*ADD*/ 	setbuf(stdout, NULL);	/* rfg:bbn mod for interactive */
	for (;;) {
	.
	.
	.
			if (infile[infptr]!=stdin)
				fclose(infile[infptr]);
			if (**argv=='-')
	/*ADD*/ 	{
				infile[infptr] = stdin;
/*ADD*/ /*ignore to do always*/	if (isatty(0)) /*rfg:bbn mod for interactive*/
	/*ADD*/ 			setbuf(stdout, NULL);
	/*ADD*/ 	}

It might be nice to add a command-line option to force interactiveness,
in case m4 is getting its input from another interactive filter.
	Dan Franklin

The ignore to do always comments are my modifications to always do output asap
it seems to work real well in pipesas well as out. What do you think about
making this a permanent fix to m4?
		Fred
-------