FC01@sri-unix (07/02/82)
Date: 21 Jun 1982 2123-PDT Does some m4 wizard know how to get m4 to output results as soon as it has them. This would be very nice for implementing a macro processed front end to programs or the shell, but as far as I can tell it would take some changes to the yacc and c sources to make it go. If it is possible to do this externally it would be very nice. Otherwise I'm willing to make the changes if I can find out what they are. Sincerely, Fred Cohen -------
dan@BBN-UNIX@sri-unix (08/02/82)
From: Dan Franklin <dan@BBN-UNIX>
Date: 2 Jul 1982 11:00:29 EDT (Friday)
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))
/*ADD*/ setbuf(stdout, NULL); /* rfg:bbn mod for interactive */
for (;;) {
.
.
.
if (infile[infptr]!=stdin)
fclose(infile[infptr]);
if (**argv=='-')
/*ADD*/ {
infile[infptr] = stdin;
/*ADD*/ 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