diff options
author | sjg <sjg@FreeBSD.org> | 2013-09-05 20:18:59 +0000 |
---|---|---|
committer | sjg <sjg@FreeBSD.org> | 2013-09-05 20:18:59 +0000 |
commit | 62bb1062226d3ce6a2350808256a25508978352d (patch) | |
tree | 22b131dceb13c3df96da594fbaadb693504797c7 /usr.bin/m4 | |
parent | 72ab90509b3a51ab361bf710338f2ef44a4e360d (diff) | |
parent | 04932445481c2cb89ff69a83b961bdef3d64757e (diff) | |
download | FreeBSD-src-62bb1062226d3ce6a2350808256a25508978352d.zip FreeBSD-src-62bb1062226d3ce6a2350808256a25508978352d.tar.gz |
Merge from head
Diffstat (limited to 'usr.bin/m4')
-rw-r--r-- | usr.bin/m4/Makefile | 4 | ||||
-rw-r--r-- | usr.bin/m4/TEST/ack.m4 | 4 | ||||
-rw-r--r-- | usr.bin/m4/TEST/hanoi.m4 | 4 | ||||
-rw-r--r-- | usr.bin/m4/TEST/hash.m4 | 4 | ||||
-rw-r--r-- | usr.bin/m4/TEST/sqroot.m4 | 4 | ||||
-rw-r--r-- | usr.bin/m4/TEST/string.m4 | 4 | ||||
-rw-r--r-- | usr.bin/m4/TEST/test.m4 | 4 | ||||
-rw-r--r-- | usr.bin/m4/eval.c | 2 | ||||
-rw-r--r-- | usr.bin/m4/extern.h | 2 | ||||
-rw-r--r-- | usr.bin/m4/lib/ohash_init.3 | 6 | ||||
-rw-r--r-- | usr.bin/m4/lib/ohash_interval.3 | 6 | ||||
-rw-r--r-- | usr.bin/m4/m4.1 | 43 | ||||
-rw-r--r-- | usr.bin/m4/main.c | 2 | ||||
-rw-r--r-- | usr.bin/m4/parser.y | 2 | ||||
-rw-r--r-- | usr.bin/m4/tokenizer.l | 4 |
15 files changed, 55 insertions, 40 deletions
diff --git a/usr.bin/m4/Makefile b/usr.bin/m4/Makefile index 1f1ec5e..f0e22f8 100644 --- a/usr.bin/m4/Makefile +++ b/usr.bin/m4/Makefile @@ -8,8 +8,8 @@ PROG= m4 CFLAGS+=-DEXTENDED -I${.CURDIR} -I${.CURDIR}/lib DPADD= ${LIBY} ${LIBL} ${LIBM} LDADD= -ly -ll -lm -# clang needs 1 while with gcc we can use 2 -#WARNS= 1 + +NO_WMISSING_VARIABLE_DECLARATIONS= SRCS= eval.c expr.c look.c main.c misc.c gnum4.c trace.c parser.y tokenizer.l .PATH: ${.CURDIR}/lib diff --git a/usr.bin/m4/TEST/ack.m4 b/usr.bin/m4/TEST/ack.m4 index c4bc39d..bf2a995 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 b26ec6b..5be47d1 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 7aa2038..06357df 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 9b80109..1442ecf6 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 ce12396..61fc28e 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 61b8de6..25b01b8 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 729cf18..fbd42aa 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 ccb2e77..7753c32 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/lib/ohash_init.3 b/usr.bin/m4/lib/ohash_init.3 index 19213f3..e0b2320 100644 --- a/usr.bin/m4/lib/ohash_init.3 +++ b/usr.bin/m4/lib/ohash_init.3 @@ -31,9 +31,9 @@ .Nm ohash_entries .Nd light-weight open hashing .Sh SYNOPSIS -.Fd #include <stdint.h> -.Fd #include <stddef.h> -.Fd #include <ohash.h> +.In stdint.h +.In stddef.h +.In ohash.h .Ft void .Fn ohash_init "struct ohash *h" "unsigned int size" "struct ohash_info *info" .Ft void diff --git a/usr.bin/m4/lib/ohash_interval.3 b/usr.bin/m4/lib/ohash_interval.3 index 12e7620..8abe7a8 100644 --- a/usr.bin/m4/lib/ohash_interval.3 +++ b/usr.bin/m4/lib/ohash_interval.3 @@ -25,9 +25,9 @@ .Nm ohash_qlookupi .Nd helper functions for open hashing .Sh SYNOPSIS -.Fd #include <stdint.h> -.Fd #include <stddef.h> -.Fd #include <ohash.h> +.In stdint.h +.In stddef.h +.In ohash.h .Ft uint32_t .Fn ohash_interval "const char *start" "const char **pend" .Ft "void *" diff --git a/usr.bin/m4/m4.1 b/usr.bin/m4/m4.1 index 6d26111..d0669c1 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 c8de97c..1cb0340 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 2239cf3..8e8ad8c 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 <espie@cvs.openbsd.org> * diff --git a/usr.bin/m4/tokenizer.l b/usr.bin/m4/tokenizer.l index ca3612e..2b4b2db 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 <espie@cvs.openbsd.org> * @@ -31,6 +31,8 @@ extern int32_t yylval; int32_t number(void); int32_t parse_radix(void); extern int yylex(void); + +#define YY_DECL int yylex(void) %} delim [ \t\n] |