diff --git a/usr.bin/m4/TEST/ack.m4 b/usr.bin/m4/TEST/ack.m4 index c4bc39d26eea..bf2a9956455f 100644 --- a/usr.bin/m4/TEST/ack.m4 +++ b/usr.bin/m4/TEST/ack.m4 @@ -1,4 +1,4 @@ -# $OpenBSD: ack.m4,v 1.2 1996/06/26 05:36:18 deraadt Exp $ +# $OpenBSD: ack.m4,v 1.3 2003/06/03 02:56:11 millert Exp $ # $NetBSD: ack.m4,v 1.4 1995/09/28 05:37:54 tls Exp $ # # Copyright (c) 1989, 1993 @@ -15,7 +15,7 @@ # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. -# 4. Neither the name of the University nor the names of its contributors +# 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # diff --git a/usr.bin/m4/TEST/hanoi.m4 b/usr.bin/m4/TEST/hanoi.m4 index b26ec6b8f2b9..5be47d1da5ee 100644 --- a/usr.bin/m4/TEST/hanoi.m4 +++ b/usr.bin/m4/TEST/hanoi.m4 @@ -1,4 +1,4 @@ -# $OpenBSD: hanoi.m4,v 1.2 1996/06/26 05:36:19 deraadt Exp $ +# $OpenBSD: hanoi.m4,v 1.3 2003/06/03 02:56:11 millert Exp $ # $NetBSD: hanoi.m4,v 1.4 1995/09/28 05:37:56 tls Exp $ # # Copyright (c) 1989, 1993 @@ -15,7 +15,7 @@ # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. -# 4. Neither the name of the University nor the names of its contributors +# 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # diff --git a/usr.bin/m4/TEST/hash.m4 b/usr.bin/m4/TEST/hash.m4 index 7aa20380e3cf..06357df6181d 100644 --- a/usr.bin/m4/TEST/hash.m4 +++ b/usr.bin/m4/TEST/hash.m4 @@ -1,4 +1,4 @@ -# $OpenBSD: hash.m4,v 1.2 1996/06/26 05:36:19 deraadt Exp $ +# $OpenBSD: hash.m4,v 1.3 2003/06/03 02:56:11 millert Exp $ # $NetBSD: hash.m4,v 1.4 1995/09/28 05:37:58 tls Exp $ # # Copyright (c) 1989, 1993 @@ -15,7 +15,7 @@ # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. -# 4. Neither the name of the University nor the names of its contributors +# 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # diff --git a/usr.bin/m4/TEST/sqroot.m4 b/usr.bin/m4/TEST/sqroot.m4 index 9b801099e5ad..1442ecf6cc7b 100644 --- a/usr.bin/m4/TEST/sqroot.m4 +++ b/usr.bin/m4/TEST/sqroot.m4 @@ -1,4 +1,4 @@ -# $OpenBSD: sqroot.m4,v 1.2 1996/06/26 05:36:20 deraadt Exp $ +# $OpenBSD: sqroot.m4,v 1.3 2003/06/03 02:56:11 millert Exp $ # $NetBSD: sqroot.m4,v 1.4 1995/09/28 05:38:01 tls Exp $ # # Copyright (c) 1989, 1993 @@ -15,7 +15,7 @@ # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. -# 4. Neither the name of the University nor the names of its contributors +# 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # diff --git a/usr.bin/m4/TEST/string.m4 b/usr.bin/m4/TEST/string.m4 index ce12396d6b04..61fc28e8bee8 100644 --- a/usr.bin/m4/TEST/string.m4 +++ b/usr.bin/m4/TEST/string.m4 @@ -1,4 +1,4 @@ -# $OpenBSD: string.m4,v 1.2 1996/06/26 05:36:20 deraadt Exp $ +# $OpenBSD: string.m4,v 1.3 2003/06/03 02:56:11 millert Exp $ # $NetBSD: string.m4,v 1.4 1995/09/28 05:38:03 tls Exp $ # # Copyright (c) 1989, 1993 @@ -15,7 +15,7 @@ # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. -# 4. Neither the name of the University nor the names of its contributors +# 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # diff --git a/usr.bin/m4/TEST/test.m4 b/usr.bin/m4/TEST/test.m4 index 61b8de698011..25b01b8b3e82 100644 --- a/usr.bin/m4/TEST/test.m4 +++ b/usr.bin/m4/TEST/test.m4 @@ -1,4 +1,4 @@ -# $OpenBSD: test.m4,v 1.2 1996/06/26 05:36:21 deraadt Exp $ +# $OpenBSD: test.m4,v 1.3 2003/06/03 02:56:11 millert Exp $ # $NetBSD: test.m4,v 1.4 1995/09/28 05:38:05 tls Exp $ # # Copyright (c) 1989, 1993 @@ -15,7 +15,7 @@ # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. -# 4. Neither the name of the University nor the names of its contributors +# 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # diff --git a/usr.bin/m4/eval.c b/usr.bin/m4/eval.c index 729cf18ce39a..fbd42aa9e796 100644 --- a/usr.bin/m4/eval.c +++ b/usr.bin/m4/eval.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eval.c,v 1.69 2011/03/24 11:23:08 espie Exp $ */ +/* $OpenBSD: eval.c,v 1.70 2012/04/12 17:00:11 espie Exp $ */ /* $NetBSD: eval.c,v 1.7 1996/11/10 21:21:29 pk Exp $ */ /* diff --git a/usr.bin/m4/extern.h b/usr.bin/m4/extern.h index ccb2e77045e7..7753c32c8a0e 100644 --- a/usr.bin/m4/extern.h +++ b/usr.bin/m4/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.51 2011/09/27 07:24:02 espie Exp $ */ +/* $OpenBSD: extern.h,v 1.52 2012/04/12 17:00:11 espie Exp $ */ /* $NetBSD: extern.h,v 1.3 1996/01/13 23:25:24 pk Exp $ */ /*- diff --git a/usr.bin/m4/m4.1 b/usr.bin/m4/m4.1 index 6d261116cb40..d0669c127dd6 100644 --- a/usr.bin/m4/m4.1 +++ b/usr.bin/m4/m4.1 @@ -1,5 +1,5 @@ -.\" $NetBSD: m4.1,v 1.22 2010/05/14 17:14:28 joerg Exp $ -.\" @(#) $OpenBSD: m4.1,v 1.56 2009/10/14 17:19:47 sthen Exp $ +.\" $NetBSD: m4.1,v 1.23 2012/04/08 22:00:39 wiz Exp $ +.\" @(#) $OpenBSD: m4.1,v 1.59 2010/10/21 13:20:51 jmc Exp $ .\" .\" Copyright (c) 1989, 1993 .\" The Regents of the University of California. All rights reserved. @@ -33,14 +33,14 @@ .\" .\" $FreeBSD$ .\" -.Dd October 14, 2009 +.Dd October 21, 2010 .Dt M4 1 .Os .Sh NAME .Nm m4 .Nd macro language processor .Sh SYNOPSIS -.Nm m4 +.Nm .Op Fl gPs .Oo .Sm off @@ -50,18 +50,16 @@ .Op Fl d Ar flags .Op Fl I Ar dirname .Op Fl o Ar filename -.Bk -words .Op Fl t Ar macro .Op Fl U Ns Ar name .Op Ar -.Ek .Sh DESCRIPTION The -.Nm m4 +.Nm utility is a macro processor that can be used as a front end to any language (e.g., C, ratfor, fortran, lex, and yacc). If no input files are given, -.Nm m4 +.Nm reads from the standard input, otherwise files specified on the command line are processed in the given order. @@ -69,7 +67,7 @@ Input files can be regular files, files in the m4 include paths, or a single dash .Pq Sq - , denoting standard input. -.Nm m4 +.Nm writes the processed text to the standard output, unless told otherwise. .Pp @@ -77,7 +75,7 @@ Macro calls have the form name(argument1[, argument2, ..., argumentN]). .Pp There cannot be any space following the macro name and the open parenthesis -.Sq \&( . +.Pq Sq \&( . If the macro name is not followed by an open parenthesis it is processed with no arguments. .Pp @@ -169,7 +167,7 @@ Undefine the symbol .Ar name . .El .Sh SYNTAX -.Nm m4 +.Nm provides the following built-in macros. They may be redefined, losing their original meaning. Return values are null unless otherwise stated. @@ -240,7 +238,7 @@ macro definitions (even for built-in macros). .It Fn divert num There are 10 output queues (numbered 0-9). At the end of processing -.Nm m4 +.Nm concatenates all the queues in numerical order to produce the final output. Initially the output queue is 0. @@ -259,7 +257,7 @@ Prints the first argument on the standard error output stream. .It Fn esyscmd cmd Passes its first argument to a shell and returns the shell's standard output. Note that the shell shares its standard input and standard error with -.Nm m4 . +.Nm . .It Fn eval expr Computes the first argument as an arithmetic expression using 32-bit arithmetic. @@ -348,6 +346,9 @@ Multiple calls to get inserted in sequence at the final .Dv EOF . .It Fn maketemp template +Like +.Ic mkstemp . +.It Fn mkstemp template Invokes .Xr mkstemp 3 on the first argument, and returns the modified string. @@ -431,10 +432,16 @@ Returns the current file's line number. .It Ic __file__ Returns the current file's name. .El +.Sh EXIT STATUS +.Ex -std m4 +.Pp +But note that the +.Ic m4exit +macro can modify the exit status. .Sh STANDARDS The .Nm -utility is compliant with the +utility is mostly compliant with the .St -p1003.1-2008 specification. .Pp @@ -456,6 +463,12 @@ and .Ic __file__ are extensions to that specification. .Pp +.Ic maketemp +is not supposed to be a synonym for +.Ic mkstemp , +but instead to be an insecure temporary file name creation function. +The change causes no known compatibility issues. +.Pp The output format of tracing and of .Ic dumpdef are not specified in any standard, @@ -480,7 +493,7 @@ replaces the top-most definition only. Other implementations may erase all definitions on the stack instead. .Pp All built-ins do expand without arguments in many other -.Nm m4 . +.Nm . .Pp Many other .Nm diff --git a/usr.bin/m4/main.c b/usr.bin/m4/main.c index c8de97c8bbf4..1cb0340fbdd4 100644 --- a/usr.bin/m4/main.c +++ b/usr.bin/m4/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.80 2011/09/27 07:24:02 espie Exp $ */ +/* $OpenBSD: main.c,v 1.81 2012/04/12 17:00:11 espie Exp $ */ /* $NetBSD: main.c,v 1.12 1997/02/08 23:54:49 cgd Exp $ */ /*- diff --git a/usr.bin/m4/parser.y b/usr.bin/m4/parser.y index 2239cf39c18d..8e8ad8c5e264 100644 --- a/usr.bin/m4/parser.y +++ b/usr.bin/m4/parser.y @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: parser.y,v 1.6 2008/08/21 21:00:14 espie Exp $ */ +/* $OpenBSD: parser.y,v 1.7 2012/04/12 17:00:11 espie Exp $ */ /* * Copyright (c) 2004 Marc Espie * diff --git a/usr.bin/m4/tokenizer.l b/usr.bin/m4/tokenizer.l index ca3612e41441..da362b4025d1 100644 --- a/usr.bin/m4/tokenizer.l +++ b/usr.bin/m4/tokenizer.l @@ -1,6 +1,6 @@ %option nounput noinput %{ -/* $OpenBSD: tokenizer.l,v 1.7 2010/03/22 20:40:44 espie Exp $ */ +/* $OpenBSD: tokenizer.l,v 1.8 2012/04/12 17:00:11 espie Exp $ */ /* * Copyright (c) 2004 Marc Espie *