diff --git a/usr.bin/m4/m4.1 b/usr.bin/m4/m4.1 --- a/usr.bin/m4/m4.1 +++ b/usr.bin/m4/m4.1 @@ -41,7 +41,7 @@ .Nd macro language processor .Sh SYNOPSIS .Nm -.Op Fl EgPs +.Op Fl EGgPs .Oo .Sm off .Fl D Ar name Op No = Ar value @@ -156,8 +156,12 @@ .Nm will exit with a non-zero exit status. This behaviour matches GNU-m4 1.4.9 and later. +.It Fl G , Fl -traditional +Disable GNU compatibility mode (see +.Fl g +below). .It Fl g , Fl -gnu -Activate GNU-m4 compatibility mode. +Enable GNU compatibility mode. In this mode, translit handles simple character ranges (e.g., a-z), regular expressions mimic emacs behavior, multiple m4wrap calls are handled as a stack, @@ -485,7 +489,7 @@ specification. .Pp The flags -.Op Fl dEgIPot +.Op Fl dEGgIPot and the macros .Ic builtin , .Ic esyscmd , diff --git a/usr.bin/m4/main.c b/usr.bin/m4/main.c --- a/usr.bin/m4/main.c +++ b/usr.bin/m4/main.c @@ -61,11 +61,12 @@ #include "extern.h" #include "pathnames.h" -static const char *shortopts = "+D:d::EgI:o:Pst:U:"; +static const char *shortopts = "+D:d::EGgI:o:Pst:U:"; static const struct option longopts[] = { { "define", required_argument, NULL, 'D' }, { "debug", optional_argument, NULL, 'd' }, { "fatal-warnings", no_argument, NULL, 'E' }, + { "traditional", no_argument, NULL, 'G' }, { "gnu", no_argument, NULL, 'g' }, { "include", required_argument, NULL, 'I' }, { "error-output", required_argument, NULL, 'o' }, @@ -230,6 +231,9 @@ case 'U': /* undefine... */ macro_popdef(optarg); break; + case 'G': + mimic_gnu = 0; + break; case 'g': mimic_gnu = 1; break;