Home | History | Annotate | Download | only in m4
History log of /src/usr.bin/m4/main.c
RevisionDateAuthorComments
 1.50  25-Jun-2020  uwe Fix --error-output to be more like GNU m4.

GNU m4 --error-output is the same as -o despite the name. It does NOT
affect warnings, error messages, and 'errprint' output so drop the
misguided bit of code that tried to freopen stderr without closing it
on failure. Drop -e (which was our local invention) and make merge
--error-output with -o so that both set traceout. Make trace_file()
preserve the old traceout on error and return error status so that the
caller can emit appropriate warning.

Do not yet support disabling tracing with an empty name, the rest of
the code is not ready, we don't do -o positionally and we don't have
`debugfile'.
 1.49  24-Jun-2020  uwe Try not to lose error output with --error-output.

Try to avoid the trap we set up ourselves while avoiding freopen(3).
When exit flushes and closes open streams it may close sfp first and
when it comes about to flush and close stderr, the descriptor is
already gone and we lose any buffered error output. This actually
happens on some hosts, breaking --trace output used by autoconf.
 1.48  26-Mar-2019  christos branches: 1.48.2;
fix use-after-free issue.
 1.47  26-Mar-2019  christos Behave like gnu m4; when the error output file cannot be opened, just warn
and keep going.
 1.46  23-Jan-2016  christos branches: 1.46.16;
Explain what REDIRECT is for.
 1.45  16-Jan-2016  christos fix the option string.
 1.44  16-Jan-2016  christos mention that nesting limit is unimplemented
 1.43  16-Jan-2016  christos add most gnu m4 long options
 1.42  25-Apr-2012  christos Fix wrong loop index leading to infinite loop
ifdef(`FOO',
# FOO
)
XXX: Pullup to 6.
 1.41  06-Sep-2011  joerg branches: 1.41.2; 1.41.4;
Move usage and onintr to make them static. Add __dead as needed.
 1.40  14-Aug-2011  christos kill gcc-4.5 warning
 1.39  06-Nov-2009  joerg Fix __progname mess.
 1.38  26-Oct-2009  christos resolve conflicts.
 1.37  21-Jul-2008  lukem Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
 1.36  07-Jun-2005  he branches: 1.36.22;
Initialize a local variable to appease -Wuninitialized.
Marked with XXXGCC for sun2 (found while compiling for it).

Reviewed by lukem.
 1.35  20-Jun-2004  jmc Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.34  07-Aug-2003  agc branches: 1.34.2;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.33  02-May-2002  wiz Really fix -P.
Fixes regression failure, and thus my PR #16225.
 1.32  05-Mar-2002  tv Put `klen' and `newk' back in local block so that their scope is limited.
(Reduces 1.31 to a one-line diff from 1.30.)
 1.31  04-Mar-2002  lukem fix -P (which was broken in rev 1.29)
 1.30  31-Jan-2002  tv Protect __RCSID and __COPYRIGHT from being invoked if not defined.
 1.29  21-Jan-2002  tv Make compilable from src/tools/m4 on non-NetBSD hosts.
 1.28  14-Nov-2001  tv Get first getopt string right; provide better usage message.
 1.27  14-Nov-2001  tv Pull in various changes from OpenBSD, most from Marc Espie, including:
* Provide some GNUisms as extensions.
* Provide dynamically growable string space.
* Make define(defn(foo)) work correctly for builtins.
(The current version is supposed to be capable of satisfying autoconf.)

All still relevant NetBSD changes have been preserved in this version, and
formatting and style fixes have been applied in various places.

Thanks to Masao Uebayashi <uebayasi@soum.co.jp> for pointing this out.
 1.26  05-Mar-2001  wiz Sprinkle some const, and rename a shadow-variable.
 1.25  05-Mar-2001  wiz Fix appearance of bogus 0xff at EOF reported by me in bin/12287.
 1.24  18-Oct-2000  jdolecek couple more whitespace fixes, by Nathan Ahlstrom
 1.23  16-Aug-1999  enami branches: 1.23.8;
Always unlink the temporary file created by mkstemp(3).
 1.22  23-Jun-1999  tv Implement the very useful `-P' option from GNU's m4 (causes all builtin
macros to be prefixed with the string `m4_').
 1.21  20-Apr-1999  mrg use mkstemp.
 1.20  19-Dec-1998  christos char -> unsigned char
 1.19  01-Sep-1998  enami add -Dunix to CPPFLAGS to suppress cpp warning.
 1.18  30-Aug-1998  perry try another way of fixing #if defined(unix) issues
 1.17  30-Aug-1998  enami Nuke unix symbol warning differently (I've used wrong compiler to check
in previous commit).
 1.16  01-Jun-1998  kleink Need <stdlib.h> for mktemp() prototype.
 1.15  29-Dec-1997  cgd fix an inconsistency between signed- and unsigned-char machines:
make sure that pushed-back 0xff character isn't accidentally
interpreted as an EOF because of sign extension when chars were being
assigned to pbents. (signed-char machines lost.) To do this, make
putback() and pbstr() operate only on unsigned chars, and add a
putbackeof() function to do the obvious thing when necessary.
 1.14  02-Dec-1997  cgd add a typedef which describes elements in the push-back buffer. Make
that typedef 'short'. 'char' (which was previously used) because char
may be unsigned and ((char)EOF) != EOF if that is the case. That was
causing the (char)EOF (0xff) pushed back in main to be interepreted as
a character, and, in some cases, to be written to the output. 'short'
was used rather than 'signed char' because if the latter is used,
0xff characters in the input would confuse m4. (No point in introducing
(more?) 8-bit lossage.)
 1.13  19-Oct-1997  lukem branches: 1.13.2;
WARNSify, fix .Nm usage, getopt returns -1 not EOF, deprecate register
 1.12  08-Feb-1997  cgd handle quoted strings in quoted strings properly, when using multicharacter
quotes. E.g. if left quote was "``" and right quote was "''", then
"``foo ``bar'' baz''" would yield "foo `bar' baz" when it should yield
"foo ``bar'' baz".
 1.11  13-Jan-1996  pk Handle multichar comment and quote delimiters (up to 5 characters, per the
manual page). Takes care of PR#485.
 1.10  29-Sep-1995  cgd change #ifdef unix's to also accept __NetBSD__. After 1.1 (per a
decision made a long time ago), 'unix' will no longer be defined, and
is not currently defined on some architectures.
 1.9  28-Sep-1995  tls Sync with 4.4BSD-Lite2
 1.8  19-Jun-1994  glass upgrade to 4.4-lite m4. no local changes of note
 1.7  03-Nov-1993  cgd 'official' patch from Ozan S. Yigit <oz@ursa.sis.yorku.ca>:
bug:if there are multiple files on the command line, file index is not
reset properly, ie. it falls off the side. sigh. also, somewhere along
the line, i again lost the proper m4wrap/autodiversion semantics
[sorry, eric. :-|] but fixed with this patch.
 1.6  02-Nov-1993  jtc Don't dump core when processing more than one file.
Bugfix has been forwarded to Ozan, and should be in his next release.
 1.5  30-Oct-1993  glass latest m4 from ozan. now does the right thing w/respect to sendmail
 1.4  02-Aug-1993  mycroft Add RCS identifiers, remove some completely useless RCS logs and patchkit
headers, and a few other insignificant changes.
 1.3  18-Jun-1993  glass fixed compilation, and mktemp usage problem
 1.2  18-Jun-1993  glass baseline of new version of m4 supplied by Ozan Yigit, original author
of the broken m4 we had. This is his stuff virgin + our Makefile.
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3  26-Oct-2009  christos Import new m4 from OpenBSD.
 1.1.1.2  28-Sep-1995  tls imported from 44lite2
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.13.2.1  29-Jan-1998  mellon Pull up 1.14 and 1.15 (cgd)
 1.23.8.1  20-Mar-2002  he Pull up revision 1.25 (requested by jmc):
Fix a conversion bug internal to m4 which causes it to output
0xff as the last byte of output.
 1.34.2.1  22-Jun-2004  tron Pull up revision 1.35 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.36.22.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.41.4.1  07-May-2012  riz Pull up following revision(s) (requested by christos in ticket #217):
usr.bin/m4/main.c: revision 1.42
Fix wrong loop index leading to infinite loop
ifdef(`FOO',
)
XXX: Pullup to 6.
 1.41.2.1  23-May-2012  yamt sync with head.
 1.46.16.1  10-Jun-2019  christos Sync with HEAD
 1.48.2.1  07-Jul-2020  martin Pull up following revision(s) (requested by uwe in ticket #981):

usr.bin/m4/m4.1: revision 1.28
usr.bin/m4/m4.1: revision 1.29
usr.bin/m4/extern.h: revision 1.20
usr.bin/m4/main.c: revision 1.49
usr.bin/m4/m4.1: revision 1.30
usr.bin/m4/trace.c: revision 1.9
usr.bin/m4/main.c: revision 1.50

Try not to lose error output with --error-output.

Try to avoid the trap we set up ourselves while avoiding freopen(3).
When exit flushes and closes open streams it may close sfp first and
when it comes about to flush and close stderr, the descriptor is
already gone and we lose any buffered error output. This actually
happens on some hosts, breaking --trace output used by autoconf.

Fix --error-output to be more like GNU m4.

GNU m4 --error-output is the same as -o despite the name. It does NOT
affect warnings, error messages, and 'errprint' output so drop the
misguided bit of code that tried to freopen stderr without closing it
on failure. Drop -e (which was our local invention) and make merge
--error-output with -o so that both set traceout. Make trace_file()
preserve the old traceout on error and return error status so that the
caller can emit appropriate warning.

Do not yet support disabling tracing with an empty name, the rest of
the code is not ready, we don't do -o positionally and we don't have
`debugfile'.

Fix --error-output to be more like GNU m4. It's a long version of -o.

Bump date for previous.

Use a date that is actually a real date.

RSS XML Feed