diff -ruNp m4-1.4.6/ChangeLog m4-1.4.7/ChangeLog --- m4-1.4.6/ChangeLog 2006-08-25 08:08:32.000000000 -0600 +++ m4-1.4.7/ChangeLog 2006-09-25 06:15:00.000000000 -0600 @@ -1,3 +1,104 @@ +2006-09-25 Eric Blake + + Release 1.4.7: + + * configure.ac (AC_INIT): Bump version number. + * NEWS: Describe changes since 1.4.6. + +2006-09-21 Eric Blake + + * doc/m4.texinfo (Invoking m4): Add clarification on option + processing behavior. + * THANKS: Update. + Reported by Mikhail Teterin. + + * bootstrap: Add --force option, based on idea from coreutils. + * README: Document that ./bootstrap and autoreconf are for + developers, and not lightly done in tarballs. + +2006-09-20 Eric Blake + + * src/m4.c (usage, OPTSTRING, main): Rename -e to -i, and give + deprecation warning on -e. + * doc/m4.texinfo (Invoking m4, Extensions): Document this. + * NEWS: Document this. + +2006-09-19 Eric Blake + + * src/m4.c (usage, long_options, main, DEBUGFILE_OPTION): Rename + -o/--error-output to --debugfile, and deprecate the former. This + will allow a future release to be more consistent with other GNU + tools, with -o/--output affecting stdout, not debug. + * doc/m4.texinfo (Invoking m4, Debug Output): Document this. + * NEWS: Document this. + +2006-09-14 Eric Blake + + * src/m4.c (main): Warn on deprecated options -B, -S, -T, -N, + --diversions. `m4 --help --version' now displays help, not + version. + (interactive, frozen_file_to_read, frozen_file_to_write): Move to + smaller scope. + (show_help, show_version): No longer needed. + (long_options, DIVERSIONS_OPTION): Backport patch from head to + distinguish between -N and --diversions in warning. + * doc/m4.texinfo (Invoking m4): Document this. + * NEWS: Likewise. + +2006-09-11 Eric Blake + + * src/Makefile.am (m4_LDADD): Add any gnulib dependent libraries. + * src/debug.c (debug_flush_files) [UNIX]: Flush stdin if it is + seekable. + (debug_set_file): Use STDOUT_FILENO. + * src/builtin.c (m4_m4exit): Flush stdin before exiting, to comply + with POSIX in regards to unread input. + * NEWS: Document this fix. + * doc/m4.texinfo (Syscmd, Esyscmd, M4exit): Likewise. + +2006-09-07 Eric Blake + + * m4/gnulib-cache.m4: Update to newer gnulib-tool. + * src/m4.h (push_file): Change prototype. + * src/input.c (push_file, peek_input, next_char_1): Only call getc + once at EOF, to avoid double ^D on terminal stdin; regression from + 2006-09-04. + (push_file, pop_file): Allow reading stdin twice. + * src/m4.c (main): Likewise. + * src/builtin.c (include): Update caller. + * NEWS: Document this change. + * doc/m4.texinfo (Invoking m4, Incompatibilities): Likewise. + (Syscmd): Add a test that failed before this patch. + +2006-09-07 Ralf Wildenhues + + * checks/check-them: Quote $pwd. + +2006-09-05 Eric Blake + + * src/builtin.c (define_macro): Warn on invalid macro name. + * NEWS: Document this change. + * doc/m4.texinfo: Fix typos. + (Invoking m4, Macro Arguments, Pseudo Arguments, Defn, Indir) + (Ifelse): Backport some improvements from head. + +2006-09-04 Eric Blake + + * doc/m4.texinfo (Changeword): Skip test on mingw, where the + native echo is braindead. + * checks/check-them (strip_needed): Ignore \r in output. Now the + testsuite will pass when cross-compiling from cygwin to mingw. + + * src/input.c (peek_input): Fix regression in handling macro + without arguments as last token in file; debian bug 385720. + (next_token): Always consume an input character. + Reported by Andreas Schultz. + * configure.ac (AC_INIT): Bump version number. + * NEWS: Document this fix. + * doc/m4.texinfo (History): Mention next version. + (Changeword): Add example that exposes this bug. + * THANKS: Update. + 2006-08-25 Eric Blake Release 1.4.6: @@ -2904,7 +3005,7 @@ Mon Jan 22 21:08:52 1990 Rene' Seindal ----- - $Revision: 1.1.1.1.2.169 $ $Date: 2006/08/25 14:08:32 $ + $Revision: 1.1.1.1.2.181 $ $Date: 2006/09/25 12:15:00 $ Local Variables: coding: utf-8 diff -ruNp m4-1.4.6/Makefile.in m4-1.4.7/Makefile.in --- m4-1.4.6/Makefile.in 2006-08-24 12:20:15.000000000 -0600 +++ m4-1.4.7/Makefile.in 2006-09-25 06:08:01.000000000 -0600 @@ -148,6 +148,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIBM4_LIBDEPS = @LIBM4_LIBDEPS@ +LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ diff -ruNp m4-1.4.6/NEWS m4-1.4.7/NEWS --- m4-1.4.6/NEWS 2006-08-25 08:06:53.000000000 -0600 +++ m4-1.4.7/NEWS 2006-09-25 06:02:21.000000000 -0600 @@ -2,6 +2,37 @@ GNU M4 NEWS - User visible changes. Copyright (C) 1992, 1993, 1994, 2004, 2005, 2006 Free Software Foundation, Inc. +Version 1.4.7 - 25 September 2006, by Eric Blake (CVS version 1.4.6a) + +* Fix regression from 1.4.5 in handling a file that ends in a macro + expansion without arguments instead of a newline. +* The define and pushdef macros now warn when the first argument is not + a string, rather than silently doing nothing. +* Standard input can now be read more than once, as in 'm4 - file -', and + is not closed until all wrapped text is handled. This makes a + difference when stdin is not a regular file, and also fixes bugs when + using the syscmd or esyscmd macros from wrapped text. +* When standard input is a seekable file, the m4exit, syscmd, and esyscmd + macros now restore the current position to the next unread byte rather + than discarding an arbitrary amount of buffered data. +* SysV command-line compatibility is no longer a goal of GNU M4; the + focus will be instead on POSIX compatibility. This release continues to + support previous usage, but adds warnings in areas which will allow a + future version of GNU M4 to use its own extensions without being tied to + the SysV command line interface. +* The no-op compatibility command line options -B, -N, -S, -T, and + --diversions may be withdrawn or assigned new meanings in future + releases, so they now issue a warning if used. +* A new command line option -i replaces the compatibility -e as the + short spelling of --interactive, for consistency with other GNU tools; a + warning is issued if the old spelling is used, and it may be assigned new + meaning in future releases. +* A new command line option --debugfile replaces the options -o and + --error-output as the preferred spelling. The old options were + misleading in their names and inconsistent with other GNU tools; they are + still silently accepted, but no longer documented in --help, and may be + assigned new meanings in future releases. + Version 1.4.6 - 25 August 2006, by Eric Blake (CVS version 1.4.5a) * Fix buffer overruns in regexp and patsubst macros when handed a trailing diff -ruNp m4-1.4.6/README m4-1.4.7/README --- m4-1.4.6/README 2006-08-21 19:44:42.000000000 -0600 +++ m4-1.4.7/README 2006-09-23 22:28:02.000000000 -0600 @@ -10,6 +10,13 @@ This release is considered stable. If GNU `m4' is meant to serve GNU `autoconf', beware that `m4' should be fully installed *prior to* configuring `autoconf' itself. +Likewise, if you intend on hacking GNU `m4' from CVS, the bootstrap +process requires that you first install a released copy of GNU `m4'. + +If you are just trying to build `m4' from a released tarball, you +should not normally need to run `./bootstrap' or `autoreconf'; just go +ahead and start with `./configure'. If you are trying to build `m4' +from CVS, more information can be found in the CVS-only file HACKING. In the subdirectory `examples' you will find various m4 files, ranging from trivial test files to rather advanced macros. If you intend to @@ -24,7 +31,7 @@ See file `THANKS' for a list of contribu By using `./configure --enable-changeword', you get an experimental feature which allows for changing the syntax of what is a "word" in `m4'. This feature will not be present in m4 2.0, but will be -replaced by other new features which provide the same capability, so +replaced by other new features which provide similar capability, so do not count on it. Send bug reports to `bug-m4@gnu.org'. A bug report is an adequate diff -ruNp m4-1.4.6/THANKS m4-1.4.7/THANKS --- m4-1.4.6/THANKS 2006-08-21 19:51:21.000000000 -0600 +++ m4-1.4.7/THANKS 2006-09-23 22:28:02.000000000 -0600 @@ -12,6 +12,7 @@ Alexander Lehmann alex@hal.rhein-main.de Amos Shapira amoss@cs.huji.ac.il Andreas Büning andreas.buening@nexgo.de Andreas Gustafsson gson@niksula.hut.fi +Andreas Schultz aschultz@warp10.net Andreas Schwab schwab@ls5.informatik.uni-dortmund.de Assar Westerlund assar@nada.kth.se Ben A. Mesander ben@piglet.cr.usgs.gov @@ -62,6 +63,7 @@ Michael Fetterman mafetter@ichips.intel. Michael L. Welcome welcome@bigbird.llnl.gov Mike Frysinger vapier@gentoo.org Mike Lijewski lijewski@theory.tc.cornell.edu +Mikhail Teterin Mikhail.Teterin@murex.com Nelson H. F. Beebe beebe@math.utah.edu Nick S. Kanakakorn skanan@otl.scu.edu Nicolas Lichtmaier nick@technisys.com.ar diff -ruNp m4-1.4.6/bootstrap m4-1.4.7/bootstrap --- m4-1.4.6/bootstrap 2006-07-15 15:10:39.000000000 -0600 +++ m4-1.4.7/bootstrap 2006-09-23 22:28:02.000000000 -0600 @@ -1,6 +1,6 @@ #! /bin/sh -# bootstrap (GNU M4) version 2006-07-15 +# bootstrap (GNU M4) version 2006-09-21 # Written by Gary V. Vaughan # Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. @@ -25,6 +25,7 @@ # Usage: $progname [options] +# -f --force bootstrap even when sources are not from CVS # -v --version print version information # -h,-? --help print short or long help message @@ -58,6 +59,9 @@ progpath="$0" progname=`echo "$progpath" | $SED "$basename"` PROGRAM=bootstrap +# Detect whether this is a CVS checkout or a tarball +CVS_only_file=HACKING + # func_echo arg... # Echo program name prefixed message. func_echo () @@ -180,6 +184,7 @@ func_update () shift case $opt in # Separate optargs to short options: + -f|--force) CVS_only_file= ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; @@ -191,6 +196,10 @@ func_update () # Bail if the options were screwed $exit_cmd $EXIT_FAILURE + + if test -n "$CVS_only_file" && test ! -r "$CVS_only_file"; then + func_fatal_error "Bootstrapping from a non-CVS distribution is risky." + fi } ## ---------------------------- ## diff -ruNp m4-1.4.6/checks/001.comments m4-1.4.7/checks/001.comments --- m4-1.4.6/checks/001.comments 2006-08-24 12:08:25.000000000 -0600 +++ m4-1.4.7/checks/001.comments 2006-09-23 22:33:20.000000000 -0600 @@ -1,4 +1,4 @@ -dnl @ ../doc/m4.texinfo:774: Origin of test +dnl @ ../doc/m4.texinfo:807: Origin of test dnl @ Copyright (C) 2006 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it diff -ruNp m4-1.4.6/checks/002.inhibiting m4-1.4.7/checks/002.inhibiting --- m4-1.4.6/checks/002.inhibiting 2006-08-24 12:08:25.000000000 -0600 +++ m4-1.4.7/checks/002.inhibiting 2006-09-23 22:33:20.000000000 -0600 @@ -1,12 +1,14 @@ -dnl @ ../doc/m4.texinfo:982: Origin of test +dnl @ ../doc/m4.texinfo:984: Origin of test dnl @ Copyright (C) 2006 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`x', `substr(ab') -dnl @result{} -define(`y', `cde, `3', `2')') -dnl @result{} -x`'y -dnl @result{}de +`divert' +dnl @result{}divert +`d'ivert +dnl @result{}divert +di`ver't +dnl @result{}divert +div`'ert +dnl @result{}divert diff -ruNp m4-1.4.6/checks/003.inhibiting m4-1.4.7/checks/003.inhibiting --- m4-1.4.6/checks/003.inhibiting 2006-08-24 12:08:25.000000000 -0600 +++ m4-1.4.7/checks/003.inhibiting 2006-09-23 22:33:20.000000000 -0600 @@ -1,12 +1,10 @@ -dnl @ ../doc/m4.texinfo:995: Origin of test +dnl @ ../doc/m4.texinfo:998: Origin of test dnl @ Copyright (C) 2006 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`macro', `m') +`'divert +dnl @result{} +divert`' dnl @result{} -macro(`m')macro -dnl @result{}mmacro -macro(`m')`'macro -dnl @result{}mm diff -ruNp m4-1.4.6/checks/004.inhibiting m4-1.4.7/checks/004.inhibiting --- m4-1.4.6/checks/004.inhibiting 2006-08-24 12:08:25.000000000 -0600 +++ m4-1.4.7/checks/004.inhibiting 2006-09-23 22:33:20.000000000 -0600 @@ -1,12 +1,12 @@ -dnl @ ../doc/m4.texinfo:1007: Origin of test +dnl @ ../doc/m4.texinfo:1013: Origin of test dnl @ Copyright (C) 2006 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`macro', `di$1') +define(`x', `substr(ab') dnl @result{} -macro(`v')`ert' -dnl @result{}divert -macro(`v')ert +define(`y', `cde, `3', `2')') dnl @result{} +x`'y +dnl @result{}de diff -ruNp m4-1.4.6/checks/005.inhibiting m4-1.4.7/checks/005.inhibiting --- m4-1.4.6/checks/005.inhibiting 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/005.inhibiting 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1026: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`macro', `m') +dnl @result{} +macro(`m')macro +dnl @result{}mmacro +macro(`m')`'macro +dnl @result{}mm diff -ruNp m4-1.4.6/checks/005.macro_argu m4-1.4.7/checks/005.macro_argu --- m4-1.4.6/checks/005.macro_argu 2006-08-24 12:08:25.000000000 -0600 +++ m4-1.4.7/checks/005.macro_argu 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:1061: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`f', `1') -dnl @result{} -f(define(`f', `2')) -dnl @result{}1 -f -dnl @result{}2 diff -ruNp m4-1.4.6/checks/006.inhibiting m4-1.4.7/checks/006.inhibiting --- m4-1.4.6/checks/006.inhibiting 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/006.inhibiting 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1038: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`macro', `di$1') +dnl @result{} +macro(`v')`ert' +dnl @result{}divert +macro(`v')ert +dnl @result{} diff -ruNp m4-1.4.6/checks/006.macro_argu m4-1.4.7/checks/006.macro_argu --- m4-1.4.6/checks/006.macro_argu 2006-08-24 12:08:25.000000000 -0600 +++ m4-1.4.7/checks/006.macro_argu 1969-12-31 17:00:00.000000000 -0700 @@ -1,8 +0,0 @@ -dnl @ ../doc/m4.texinfo:1072: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define( -dnl @error{}m4:stdin:1: ERROR: end of file in argument list diff -ruNp m4-1.4.6/checks/007.define m4-1.4.7/checks/007.define --- m4-1.4.6/checks/007.define 2006-08-24 12:08:25.000000000 -0600 +++ m4-1.4.7/checks/007.define 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:1177: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Hello world.') -dnl @result{} -foo -dnl @result{}Hello world. diff -ruNp m4-1.4.6/checks/007.macro_argu m4-1.4.7/checks/007.macro_argu --- m4-1.4.6/checks/007.macro_argu 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/007.macro_argu 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1093: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`f', `1') +dnl @result{} +f(define(`f', `2')) +dnl @result{}1 +f +dnl @result{}2 diff -ruNp m4-1.4.6/checks/008.define m4-1.4.7/checks/008.define --- m4-1.4.6/checks/008.define 2006-08-24 12:08:25.000000000 -0600 +++ m4-1.4.7/checks/008.define 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:1194: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(foo, one) -dnl @result{} -define(foo, two) -dnl @result{} -one -dnl @result{}two diff -ruNp m4-1.4.6/checks/008.macro_argu m4-1.4.7/checks/008.macro_argu --- m4-1.4.6/checks/008.macro_argu 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/008.macro_argu 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,8 @@ +dnl @ ../doc/m4.texinfo:1104: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define( +dnl @error{}m4:stdin:1: ERROR: end of file in argument list diff -ruNp m4-1.4.6/checks/009.define m4-1.4.7/checks/009.define --- m4-1.4.6/checks/009.define 2006-08-24 12:08:25.000000000 -0600 +++ m4-1.4.7/checks/009.define 2006-09-23 22:33:20.000000000 -0600 @@ -1,18 +1,10 @@ -dnl @ ../doc/m4.texinfo:1213: Origin of test +dnl @ ../doc/m4.texinfo:1210: Origin of test dnl @ Copyright (C) 2006 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`array', `defn(format(``array[%d]'', `$1'))') +define(`foo', `Hello world.') dnl @result{} -define(`array_set', `define(format(``array[%d]'', `$1'), `$2')') -dnl @result{} -array_set(`4', `array element no. 4') -dnl @result{} -array_set(`17', `array element no. 17') -dnl @result{} -array(`4') -dnl @result{}array element no. 4 -array(eval(`10 + 7')) -dnl @result{}array element no. 17 +foo +dnl @result{}Hello world. diff -ruNp m4-1.4.6/checks/010.arguments m4-1.4.7/checks/010.arguments --- m4-1.4.6/checks/010.arguments 2006-08-24 12:08:25.000000000 -0600 +++ m4-1.4.7/checks/010.arguments 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:1242: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`exch', `$2, $1') -dnl @result{} -exch(`arg1', `arg2') -dnl @result{}arg2, arg1 diff -ruNp m4-1.4.6/checks/010.define m4-1.4.7/checks/010.define --- m4-1.4.6/checks/010.define 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/010.define 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1227: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(foo, one) +dnl @result{} +define(foo, two) +dnl @result{} +one +dnl @result{}two diff -ruNp m4-1.4.6/checks/011.arguments m4-1.4.7/checks/011.arguments --- m4-1.4.6/checks/011.arguments 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/011.arguments 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:1252: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`exch', `$2, $1') -dnl @result{} -define(exch(``expansion text'', ``macro'')) -dnl @result{} -macro -dnl @result{}expansion text diff -ruNp m4-1.4.6/checks/011.define m4-1.4.7/checks/011.define --- m4-1.4.6/checks/011.define 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/011.define 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:1253: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`array', `defn(format(``array[%d]'', `$1'))') +dnl @result{} +define(`array_set', `define(format(``array[%d]'', `$1'), `$2')') +dnl @result{} +array_set(`4', `array element no. 4') +dnl @result{} +array_set(`17', `array element no. 17') +dnl @result{} +array(`4') +dnl @result{}array element no. 4 +array(eval(`10 + 7')) +dnl @result{}array element no. 17 diff -ruNp m4-1.4.6/checks/012.arguments m4-1.4.7/checks/012.arguments --- m4-1.4.6/checks/012.arguments 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/012.arguments 2006-09-23 22:33:20.000000000 -0600 @@ -1,10 +1,10 @@ -dnl @ ../doc/m4.texinfo:1275: Origin of test +dnl @ ../doc/m4.texinfo:1282: Origin of test dnl @ Copyright (C) 2006 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`test', ``Macro name: $0'') +define(`exch', `$2, $1') dnl @result{} -test -dnl @result{}Macro name: test +exch(`arg1', `arg2') +dnl @result{}arg2, arg1 diff -ruNp m4-1.4.6/checks/013.arguments m4-1.4.7/checks/013.arguments --- m4-1.4.6/checks/013.arguments 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/013.arguments 2006-09-23 22:33:20.000000000 -0600 @@ -1,10 +1,12 @@ -dnl @ ../doc/m4.texinfo:1285: Origin of test +dnl @ ../doc/m4.texinfo:1292: Origin of test dnl @ Copyright (C) 2006 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`foo', `This is macro `foo'.') +define(`exch', `$2, $1') dnl @result{} -foo -dnl @result{}This is macro foo. +define(exch(``expansion text'', ``macro'')) +dnl @result{} +macro +dnl @result{}expansion text diff -ruNp m4-1.4.6/checks/014.arguments m4-1.4.7/checks/014.arguments --- m4-1.4.6/checks/014.arguments 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/014.arguments 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:1315: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`test', ``Macro name: $0'') +dnl @result{} +test +dnl @result{}Macro name: test diff -ruNp m4-1.4.6/checks/014.pseudo_arg m4-1.4.7/checks/014.pseudo_arg --- m4-1.4.6/checks/014.pseudo_arg 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/014.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 @@ -1,21 +0,0 @@ -dnl @ ../doc/m4.texinfo:1309: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`nargs', `$#') -dnl @result{} -nargs -dnl @result{}0 -nargs() -dnl @result{}1 -nargs(`arg1', `arg2', `arg3') -dnl @result{}3 -nargs(`commas can be quoted, like this') -dnl @result{}1 -nargs(arg1#inside comments, commas do not separate arguments -still arg1) -dnl @result{}1 -nargs((unquoted parentheses, like this, group arguments)) -dnl @result{}1 diff -ruNp m4-1.4.6/checks/015.arguments m4-1.4.7/checks/015.arguments --- m4-1.4.6/checks/015.arguments 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/015.arguments 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:1325: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `This is macro `foo'.') +dnl @result{} +foo +dnl @result{}This is macro foo. diff -ruNp m4-1.4.6/checks/015.pseudo_arg m4-1.4.7/checks/015.pseudo_arg --- m4-1.4.6/checks/015.pseudo_arg 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/015.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:1330: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`echo', `$*') -dnl @result{} -echo(arg1, arg2, arg3 , arg4) -dnl @result{}arg1,arg2,arg3 ,arg4 diff -ruNp m4-1.4.6/checks/016.pseudo_arg m4-1.4.7/checks/016.pseudo_arg --- m4-1.4.6/checks/016.pseudo_arg 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/016.pseudo_arg 2006-09-23 22:33:20.000000000 -0600 @@ -1,10 +1,21 @@ -dnl @ ../doc/m4.texinfo:1341: Origin of test +dnl @ ../doc/m4.texinfo:1349: Origin of test dnl @ Copyright (C) 2006 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`echo', `$@') +define(`nargs', `$#') dnl @result{} -echo(arg1, arg2, arg3 , arg4) -dnl @result{}arg1,arg2,arg3 ,arg4 +nargs +dnl @result{}0 +nargs() +dnl @result{}1 +nargs(`arg1', `arg2', `arg3') +dnl @result{}3 +nargs(`commas can be quoted, like this') +dnl @result{}1 +nargs(arg1#inside comments, commas do not separate arguments +still arg1) +dnl @result{}1 +nargs((unquoted parentheses, like this, group arguments)) +dnl @result{}1 diff -ruNp m4-1.4.6/checks/017.pseudo_arg m4-1.4.7/checks/017.pseudo_arg --- m4-1.4.6/checks/017.pseudo_arg 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/017.pseudo_arg 2006-09-23 22:33:20.000000000 -0600 @@ -1,20 +1,10 @@ -dnl @ ../doc/m4.texinfo:1351: Origin of test +dnl @ ../doc/m4.texinfo:1370: Origin of test dnl @ Copyright (C) 2006 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`echo1', `$*') +define(`echo', `$*') dnl @result{} -define(`echo2', `$@') -dnl @result{} -define(`foo', `This is macro `foo'.') -dnl @result{} -echo1(foo) -dnl @result{}This is macro This is macro foo.. -echo1(`foo') -dnl @result{}This is macro foo. -echo2(foo) -dnl @result{}This is macro foo. -echo2(`foo') -dnl @result{}foo +echo(arg1, arg2, arg3 , arg4) +dnl @result{}arg1,arg2,arg3 ,arg4 diff -ruNp m4-1.4.6/checks/018.pseudo_arg m4-1.4.7/checks/018.pseudo_arg --- m4-1.4.6/checks/018.pseudo_arg 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/018.pseudo_arg 2006-09-23 22:33:20.000000000 -0600 @@ -1,20 +1,10 @@ -dnl @ ../doc/m4.texinfo:1373: Origin of test +dnl @ ../doc/m4.texinfo:1381: Origin of test dnl @ Copyright (C) 2006 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`echo1', `$*') +define(`echo', `$@') dnl @result{} -define(`echo2', `$@') -dnl @result{} -define(`foo', `bar') -dnl @result{} -echo1(#foo'foo -foo) -dnl @result{}#foo'foo -dnl @result{}bar -echo2(#foo'foo -foo) -dnl @result{}#foobar -dnl @result{}bar' +echo(arg1, arg2, arg3 , arg4) +dnl @result{}arg1,arg2,arg3 ,arg4 diff -ruNp m4-1.4.6/checks/019.pseudo_arg m4-1.4.7/checks/019.pseudo_arg --- m4-1.4.6/checks/019.pseudo_arg 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/019.pseudo_arg 2006-09-23 22:33:20.000000000 -0600 @@ -1,10 +1,20 @@ -dnl @ ../doc/m4.texinfo:1394: Origin of test +dnl @ ../doc/m4.texinfo:1391: Origin of test dnl @ Copyright (C) 2006 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`foo', `$$$ hello $$$') +define(`echo1', `$*') dnl @result{} -foo -dnl @result{}$$$ hello $$$ +define(`echo2', `$@') +dnl @result{} +define(`foo', `This is macro `foo'.') +dnl @result{} +echo1(foo) +dnl @result{}This is macro This is macro foo.. +echo1(`foo') +dnl @result{}This is macro foo. +echo2(foo) +dnl @result{}This is macro foo. +echo2(`foo') +dnl @result{}foo diff -ruNp m4-1.4.6/checks/020.pseudo_arg m4-1.4.7/checks/020.pseudo_arg --- m4-1.4.6/checks/020.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/020.pseudo_arg 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:1413: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`echo1', `$*') +dnl @result{} +define(`echo2', `$@') +dnl @result{} +define(`foo', `bar') +dnl @result{} +echo1(#foo'foo +foo) +dnl @result{}#foo'foo +dnl @result{}bar +echo2(#foo'foo +foo) +dnl @result{}#foobar +dnl @result{}bar' diff -ruNp m4-1.4.6/checks/020.undefine m4-1.4.7/checks/020.undefine --- m4-1.4.6/checks/020.undefine 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/020.undefine 1969-12-31 17:00:00.000000000 -0700 @@ -1,20 +0,0 @@ -dnl @ ../doc/m4.texinfo:1421: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -foo bar blah -dnl @result{}foo bar blah -define(`foo', `some')define(`bar', `other')define(`blah', `text') -dnl @result{} -foo bar blah -dnl @result{}some other text -undefine(`foo') -dnl @result{} -foo bar blah -dnl @result{}foo other text -undefine(`bar', `blah') -dnl @result{} -foo bar blah -dnl @result{}foo bar blah diff -ruNp m4-1.4.6/checks/021.pseudo_arg m4-1.4.7/checks/021.pseudo_arg --- m4-1.4.6/checks/021.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/021.pseudo_arg 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:1434: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `$$$ hello $$$') +dnl @result{} +foo +dnl @result{}$$$ hello $$$ diff -ruNp m4-1.4.6/checks/021.undefine m4-1.4.7/checks/021.undefine --- m4-1.4.6/checks/021.undefine 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/021.undefine 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:1441: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`f', ``$0':$1') -dnl @result{} -f(f(f(undefine(`f')`hello world'))) -dnl @result{}f:f:f:hello world -f(`bye') -dnl @result{}f(bye) diff -ruNp m4-1.4.6/checks/022.defn m4-1.4.7/checks/022.defn --- m4-1.4.6/checks/022.defn 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/022.defn 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:1477: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`zap', defn(`undefine')) -dnl @result{} -zap(`undefine') -dnl @result{} -undefine(`zap') -dnl @result{}undefine(zap) diff -ruNp m4-1.4.6/checks/022.pseudo_arg m4-1.4.7/checks/022.pseudo_arg --- m4-1.4.6/checks/022.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/022.pseudo_arg 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,26 @@ +dnl @ ../doc/m4.texinfo:1447: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `no nested quote: $1') +dnl @result{} +foo(`arg') +dnl @result{}no nested quote: arg +define(`foo', `nested quote around $: `$'1') +dnl @result{} +foo(`arg') +dnl @result{}nested quote around $: $1 +define(`foo', `nested empty quote after $: $`'1') +dnl @result{} +foo(`arg') +dnl @result{}nested empty quote after $: $1 +define(`foo', `nested quote around next character: $`1'') +dnl @result{} +foo(`arg') +dnl @result{}nested quote around next character: $1 +define(`foo', `nested quote around both: `$1'') +dnl @result{} +foo(`arg') +dnl @result{}nested quote around both: arg diff -ruNp m4-1.4.6/checks/023.defn m4-1.4.7/checks/023.defn --- m4-1.4.6/checks/023.defn 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/023.defn 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:1494: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `This is `$0'') -dnl @result{} -define(`bar', defn(`foo')) -dnl @result{} -bar -dnl @result{}This is bar diff -ruNp m4-1.4.6/checks/023.undefine m4-1.4.7/checks/023.undefine --- m4-1.4.6/checks/023.undefine 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/023.undefine 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:1486: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +foo bar blah +dnl @result{}foo bar blah +define(`foo', `some')define(`bar', `other')define(`blah', `text') +dnl @result{} +foo bar blah +dnl @result{}some other text +undefine(`foo') +dnl @result{} +foo bar blah +dnl @result{}foo other text +undefine(`bar', `blah') +dnl @result{} +foo bar blah +dnl @result{}foo bar blah diff -ruNp m4-1.4.6/checks/024.defn m4-1.4.7/checks/024.defn --- m4-1.4.6/checks/024.defn 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/024.defn 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:1506: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`string', `The macro dnl is very useful -') -dnl @result{} -string -dnl @result{}The macro -defn(`string') -dnl @result{}The macro dnl is very useful -dnl @result{} diff -ruNp m4-1.4.6/checks/024.undefine m4-1.4.7/checks/024.undefine --- m4-1.4.6/checks/024.undefine 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/024.undefine 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1506: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`f', ``$0':$1') +dnl @result{} +f(f(f(undefine(`f')`hello world'))) +dnl @result{}f:f:f:hello world +f(`bye') +dnl @result{}f(bye) diff -ruNp m4-1.4.6/checks/025.defn m4-1.4.7/checks/025.defn --- m4-1.4.6/checks/025.defn 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/025.defn 2006-09-23 22:33:20.000000000 -0600 @@ -1,18 +1,12 @@ -dnl @ ../doc/m4.texinfo:1524: Origin of test +dnl @ ../doc/m4.texinfo:1543: Origin of test dnl @ Copyright (C) 2006 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`foo', a'a) +define(`zap', defn(`undefine')) dnl @result{} -define(`a', `A') +zap(`undefine') dnl @result{} -define(`echo', `$@') -dnl @result{} -foo -dnl @result{}A'A -defn(`foo') -dnl @result{}aA' -echo(foo) -dnl @result{}AA' +undefine(`zap') +dnl @result{}undefine(zap) diff -ruNp m4-1.4.6/checks/026.defn m4-1.4.7/checks/026.defn --- m4-1.4.6/checks/026.defn 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/026.defn 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1560: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `This is `$0'') +dnl @result{} +define(`bar', defn(`foo')) +dnl @result{} +bar +dnl @result{}This is bar diff -ruNp m4-1.4.6/checks/026.pushdef m4-1.4.7/checks/026.pushdef --- m4-1.4.6/checks/026.pushdef 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/026.pushdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,30 +0,0 @@ -dnl @ ../doc/m4.texinfo:1568: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Expansion one.') -dnl @result{} -foo -dnl @result{}Expansion one. -pushdef(`foo', `Expansion two.') -dnl @result{} -foo -dnl @result{}Expansion two. -pushdef(`foo', `Expansion three.') -dnl @result{} -pushdef(`foo', `Expansion four.') -dnl @result{} -popdef(`foo') -dnl @result{} -foo -dnl @result{}Expansion three. -popdef(`foo', `foo') -dnl @result{} -foo -dnl @result{}Expansion one. -popdef(`foo') -dnl @result{} -foo -dnl @result{}foo diff -ruNp m4-1.4.6/checks/027.defn m4-1.4.7/checks/027.defn --- m4-1.4.6/checks/027.defn 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/027.defn 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:1572: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`string', `The macro dnl is very useful +') +dnl @result{} +string +dnl @result{}The macro +defn(`string') +dnl @result{}The macro dnl is very useful +dnl @result{} diff -ruNp m4-1.4.6/checks/027.pushdef m4-1.4.7/checks/027.pushdef --- m4-1.4.6/checks/027.pushdef 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/027.pushdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,22 +0,0 @@ -dnl @ ../doc/m4.texinfo:1600: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Expansion one.') -dnl @result{} -foo -dnl @result{}Expansion one. -pushdef(`foo', `Expansion two.') -dnl @result{} -foo -dnl @result{}Expansion two. -define(`foo', `Second expansion two.') -dnl @result{} -foo -dnl @result{}Second expansion two. -undefine(`foo') -dnl @result{} -foo -dnl @result{}foo diff -ruNp m4-1.4.6/checks/028.defn m4-1.4.7/checks/028.defn --- m4-1.4.6/checks/028.defn 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/028.defn 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:1590: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', a'a) +dnl @result{} +define(`a', `A') +dnl @result{} +define(`echo', `$@') +dnl @result{} +foo +dnl @result{}A'A +defn(`foo') +dnl @result{}aA' +echo(foo) +dnl @result{}AA' diff -ruNp m4-1.4.6/checks/028.indir m4-1.4.7/checks/028.indir --- m4-1.4.6/checks/028.indir 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/028.indir 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:1649: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`$$internal$macro', `Internal macro (name `$0')') -dnl @result{} -$$internal$macro -dnl @result{}$$internal$macro -indir(`$$internal$macro') -dnl @result{}Internal macro (name $$internal$macro) diff -ruNp m4-1.4.6/checks/029.builtin m4-1.4.7/checks/029.builtin --- m4-1.4.6/checks/029.builtin 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/029.builtin 1969-12-31 17:00:00.000000000 -0700 @@ -1,26 +0,0 @@ -dnl @ ../doc/m4.texinfo:1683: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -pushdef(`define', `hidden') -dnl @result{} -undefine(`undefine') -dnl @result{} -define(`foo', `bar') -dnl @result{}hidden -foo -dnl @result{}foo -builtin(`define', `foo', `BAR') -dnl @result{} -foo -dnl @result{}BAR -undefine(`foo') -dnl @result{}undefine(foo) -foo -dnl @result{}BAR -builtin(`undefine', `foo') -dnl @result{} -foo -dnl @result{}foo diff -ruNp m4-1.4.6/checks/029.defn m4-1.4.7/checks/029.defn --- m4-1.4.6/checks/029.defn 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/029.defn 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:1609: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +defn(`defn') +dnl @result{} +define(defn(`divnum'), `cannot redefine a builtin token') +dnl @error{}m4:stdin:2: Warning: define: invalid macro name ignored +dnl @result{} +divnum +dnl @result{}0 diff -ruNp m4-1.4.6/checks/030.builtin m4-1.4.7/checks/030.builtin --- m4-1.4.6/checks/030.builtin 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/030.builtin 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:1710: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -builtin -dnl @result{}builtin -builtin() -dnl @error{}m4:stdin:2: undefined builtin `' -dnl @result{} -builtin(`builtin') -dnl @error{}m4:stdin:3: Warning: too few arguments to builtin `builtin' -dnl @result{} -builtin(`builtin',) -dnl @error{}m4:stdin:4: undefined builtin `' -dnl @result{} diff -ruNp m4-1.4.6/checks/030.pushdef m4-1.4.7/checks/030.pushdef --- m4-1.4.6/checks/030.pushdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/030.pushdef 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,30 @@ +dnl @ ../doc/m4.texinfo:1648: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Expansion one.') +dnl @result{} +foo +dnl @result{}Expansion one. +pushdef(`foo', `Expansion two.') +dnl @result{} +foo +dnl @result{}Expansion two. +pushdef(`foo', `Expansion three.') +dnl @result{} +pushdef(`foo', `Expansion four.') +dnl @result{} +popdef(`foo') +dnl @result{} +foo +dnl @result{}Expansion three. +popdef(`foo', `foo') +dnl @result{} +foo +dnl @result{}Expansion one. +popdef(`foo') +dnl @result{} +foo +dnl @result{}foo diff -ruNp m4-1.4.6/checks/031.ifdef m4-1.4.7/checks/031.ifdef --- m4-1.4.6/checks/031.ifdef 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/031.ifdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:1755: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`foo', ``foo' is defined', ``foo' is not defined') -dnl @result{}foo is not defined -define(`foo', `') -dnl @result{} -ifdef(`foo', ``foo' is defined', ``foo' is not defined') -dnl @result{}foo is defined -ifdef(`no_such_macro', `yes', `no', `extra argument') -dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `ifdef' ignored -dnl @result{}no diff -ruNp m4-1.4.6/checks/031.pushdef m4-1.4.7/checks/031.pushdef --- m4-1.4.6/checks/031.pushdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/031.pushdef 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:1680: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Expansion one.') +dnl @result{} +foo +dnl @result{}Expansion one. +pushdef(`foo', `Expansion two.') +dnl @result{} +foo +dnl @result{}Expansion two. +define(`foo', `Second expansion two.') +dnl @result{} +foo +dnl @result{}Second expansion two. +undefine(`foo') +dnl @result{} +foo +dnl @result{}foo diff -ruNp m4-1.4.6/checks/032.ifelse m4-1.4.7/checks/032.ifelse --- m4-1.4.6/checks/032.ifelse 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/032.ifelse 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:1800: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifelse(`some comments') -dnl @result{} -ifelse(`foo', `bar') -dnl @error{}m4:stdin:2: Warning: too few arguments to builtin `ifelse' -dnl @result{} diff -ruNp m4-1.4.6/checks/032.indir m4-1.4.7/checks/032.indir --- m4-1.4.6/checks/032.indir 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/032.indir 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1729: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`$$internal$macro', `Internal macro (name `$0')') +dnl @result{} +$$internal$macro +dnl @result{}$$internal$macro +indir(`$$internal$macro') +dnl @result{}Internal macro (name $$internal$macro) diff -ruNp m4-1.4.6/checks/033.ifelse m4-1.4.7/checks/033.ifelse --- m4-1.4.6/checks/033.ifelse 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/033.ifelse 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:1810: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifelse(`foo', `bar', `true') -dnl @result{} -ifelse(`foo', `foo', `true') -dnl @result{}true -define(`foo', `bar') -dnl @result{} -ifelse(foo, `bar', `true', `false') -dnl @result{}true -ifelse(foo, `foo', `true', `false') -dnl @result{}false diff -ruNp m4-1.4.6/checks/033.indir m4-1.4.7/checks/033.indir --- m4-1.4.6/checks/033.indir 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/033.indir 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:1749: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`f', `1') +dnl @result{} +f(define(`f', `2')) +dnl @result{}1 +indir(`f', define(`f', `3')) +dnl @result{}3 +indir(`f', undefine(`f')) +dnl @error{}m4:stdin:4: undefined macro `f' +dnl @result{} diff -ruNp m4-1.4.6/checks/034.builtin m4-1.4.7/checks/034.builtin --- m4-1.4.6/checks/034.builtin 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/034.builtin 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,26 @@ +dnl @ ../doc/m4.texinfo:1782: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +pushdef(`define', `hidden') +dnl @result{} +undefine(`undefine') +dnl @result{} +define(`foo', `bar') +dnl @result{}hidden +foo +dnl @result{}foo +builtin(`define', `foo', `BAR') +dnl @result{} +foo +dnl @result{}BAR +undefine(`foo') +dnl @result{}undefine(foo) +foo +dnl @result{}BAR +builtin(`undefine', `foo') +dnl @result{} +foo +dnl @result{}foo diff -ruNp m4-1.4.6/checks/034.ifelse m4-1.4.7/checks/034.ifelse --- m4-1.4.6/checks/034.ifelse 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/034.ifelse 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:1828: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `ifelse(`$#', `0', ``$0'', `arguments:$#')') -dnl @result{} -foo -dnl @result{}foo -foo() -dnl @result{}arguments:1 -foo(`a', `b', `c') -dnl @result{}arguments:3 diff -ruNp m4-1.4.6/checks/035.builtin m4-1.4.7/checks/035.builtin --- m4-1.4.6/checks/035.builtin 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/035.builtin 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:1814: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +builtin +dnl @result{}builtin +builtin() +dnl @error{}m4:stdin:2: undefined builtin `' +dnl @result{} +builtin(`builtin') +dnl @error{}m4:stdin:3: Warning: too few arguments to builtin `builtin' +dnl @result{} +builtin(`builtin',) +dnl @error{}m4:stdin:4: undefined builtin `' +dnl @result{} diff -ruNp m4-1.4.6/checks/035.ifelse m4-1.4.7/checks/035.ifelse --- m4-1.4.6/checks/035.ifelse 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/035.ifelse 1969-12-31 17:00:00.000000000 -0700 @@ -1,8 +0,0 @@ -dnl @ ../doc/m4.texinfo:1847: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth', `seventh') -dnl @result{}seventh diff -ruNp m4-1.4.6/checks/036.ifdef m4-1.4.7/checks/036.ifdef --- m4-1.4.6/checks/036.ifdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/036.ifdef 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:1859: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`foo', ``foo' is defined', ``foo' is not defined') +dnl @result{}foo is not defined +define(`foo', `') +dnl @result{} +ifdef(`foo', ``foo' is defined', ``foo' is not defined') +dnl @result{}foo is defined +ifdef(`no_such_macro', `yes', `no', `extra argument') +dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `ifdef' ignored +dnl @result{}no diff -ruNp m4-1.4.6/checks/036.loops m4-1.4.7/checks/036.loops --- m4-1.4.6/checks/036.loops 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/036.loops 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:1879: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -shift -dnl @result{}shift -shift(`bar') -dnl @result{} -shift(`foo', `bar', `baz') -dnl @result{}bar,baz diff -ruNp m4-1.4.6/checks/037.ifelse m4-1.4.7/checks/037.ifelse --- m4-1.4.6/checks/037.ifelse 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/037.ifelse 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:1905: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifelse(`some comments') +dnl @result{} +ifelse(`foo', `bar') +dnl @error{}m4:stdin:2: Warning: too few arguments to builtin `ifelse' +dnl @result{} diff -ruNp m4-1.4.6/checks/037.loops m4-1.4.7/checks/037.loops --- m4-1.4.6/checks/037.loops 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/037.loops 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:1896: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`reverse', `ifelse(`$#', `0', , `$#', `1', ``$1'', - `reverse(shift($@)), `$1'')') -dnl @result{} -reverse -dnl @result{} -reverse(`foo') -dnl @result{}foo -reverse(`foo', `bar', `gnats', `and gnus') -dnl @result{}and gnus, gnats, bar, foo diff -ruNp m4-1.4.6/checks/038.ifelse m4-1.4.7/checks/038.ifelse --- m4-1.4.6/checks/038.ifelse 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/038.ifelse 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:1915: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifelse(`foo', `bar', `true') +dnl @result{} +ifelse(`foo', `foo', `true') +dnl @result{}true +define(`foo', `bar') +dnl @result{} +ifelse(foo, `bar', `true', `false') +dnl @result{}true +ifelse(foo, `foo', `true', `false') +dnl @result{}false diff -ruNp m4-1.4.6/checks/038.loops m4-1.4.7/checks/038.loops --- m4-1.4.6/checks/038.loops 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/038.loops 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:1927: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`forloop.m4') -dnl @result{} -forloop(`i', `1', `8', `i ') -dnl @result{}1 2 3 4 5 6 7 8 diff -ruNp m4-1.4.6/checks/039.ifelse m4-1.4.7/checks/039.ifelse --- m4-1.4.6/checks/039.ifelse 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/039.ifelse 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:1933: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `ifelse(`$#', `0', ``$0'', `arguments:$#')') +dnl @result{} +foo +dnl @result{}foo +foo() +dnl @result{}arguments:1 +foo(`a', `b', `c') +dnl @result{}arguments:3 diff -ruNp m4-1.4.6/checks/039.loops m4-1.4.7/checks/039.loops --- m4-1.4.6/checks/039.loops 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/039.loops 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:1936: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`forloop.m4') -dnl @result{} -forloop(`i', `1', `4', `forloop(`j', `1', `8', ` (i, j)') -') -dnl @result{} (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (1, 8) -dnl @result{} (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (2, 8) -dnl @result{} (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, 7) (3, 8) -dnl @result{} (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, 7) (4, 8) -dnl @result{} diff -ruNp m4-1.4.6/checks/040.ifelse m4-1.4.7/checks/040.ifelse --- m4-1.4.6/checks/040.ifelse 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/040.ifelse 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:1952: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifelse(`foo', `bar', `third', `gnu', `gnats') +dnl @error{}m4:stdin:1: Warning: excess arguments to builtin `ifelse' ignored +dnl @result{}gnu +ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth') +dnl @result{} +ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth', `seventh') +dnl @result{}seventh +ifelse(`foo', `bar', `3', `gnu', `gnats', `6', `7', `8') +dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `ifelse' ignored +dnl @result{}7 diff -ruNp m4-1.4.6/checks/040.loops m4-1.4.7/checks/040.loops --- m4-1.4.6/checks/040.loops 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/040.loops 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:1962: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -undivert(`forloop.m4') -dnl @result{}divert(`-1') -dnl @result{}# forloop(var, from, to, stmt) -dnl @result{}define(`forloop', -dnl @result{} `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')') -dnl @result{}define(`_forloop', -dnl @result{} `$4`'ifelse($1, `$3', , -dnl @result{} `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')') -dnl @result{}divert`'dnl -dnl @result{} diff -ruNp m4-1.4.6/checks/041.dumpdef m4-1.4.7/checks/041.dumpdef --- m4-1.4.6/checks/041.dumpdef 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/041.dumpdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2018: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Hello world.') -dnl @result{} -dumpdef(`foo') -dnl @error{}foo: `Hello world.' -dnl @result{} -dumpdef(`define') -dnl @error{}define: -dnl @result{} diff -ruNp m4-1.4.6/checks/041.loops m4-1.4.7/checks/041.loops --- m4-1.4.6/checks/041.loops 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/041.loops 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1992: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +shift +dnl @result{}shift +shift(`bar') +dnl @result{} +shift(`foo', `bar', `baz') +dnl @result{}bar,baz diff -ruNp m4-1.4.6/checks/042.dumpdef m4-1.4.7/checks/042.dumpdef --- m4-1.4.6/checks/042.dumpdef 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/042.dumpdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2034: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -pushdef(`f', ``$0'1')pushdef(`f', ``$0'2') -dnl @result{} -f(popdef(`f')dumpdef(`f')) -dnl @error{}f: ``$0'1' -dnl @result{}f2 -f(popdef(`f')dumpdef(`f')) -dnl @error{}m4:stdin:3: undefined macro `f' -dnl @result{}f1 diff -ruNp m4-1.4.6/checks/042.loops m4-1.4.7/checks/042.loops --- m4-1.4.6/checks/042.loops 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/042.loops 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:2009: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`reverse', `ifelse(`$#', `0', , `$#', `1', ``$1'', + `reverse(shift($@)), `$1'')') +dnl @result{} +reverse +dnl @result{} +reverse(`foo') +dnl @result{}foo +reverse(`foo', `bar', `gnats', `and gnus') +dnl @result{}and gnus, gnats, bar, foo diff -ruNp m4-1.4.6/checks/043.loops m4-1.4.7/checks/043.loops --- m4-1.4.6/checks/043.loops 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/043.loops 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:2041: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`forloop.m4') +dnl @result{} +forloop(`i', `1', `8', `i ') +dnl @result{}1 2 3 4 5 6 7 8 diff -ruNp m4-1.4.6/checks/043.trace m4-1.4.7/checks/043.trace --- m4-1.4.6/checks/043.trace 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/043.trace 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:2072: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Hello World.') -dnl @result{} -define(`echo', `$@') -dnl @result{} -traceon(`foo', `echo') -dnl @result{} -foo -dnl @error{}m4trace: -1- foo -> `Hello World.' -dnl @result{}Hello World. -echo(gnus, and gnats) -dnl @error{}m4trace: -1- echo(`gnus', `and gnats') -> ``gnus',`and gnats'' -dnl @result{}gnus,and gnats diff -ruNp m4-1.4.6/checks/044.loops m4-1.4.7/checks/044.loops --- m4-1.4.6/checks/044.loops 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/044.loops 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:2050: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`forloop.m4') +dnl @result{} +forloop(`i', `1', `4', `forloop(`j', `1', `8', ` (i, j)') +') +dnl @result{} (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (1, 8) +dnl @result{} (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (2, 8) +dnl @result{} (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, 7) (3, 8) +dnl @result{} (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, 7) (4, 8) +dnl @result{} diff -ruNp m4-1.4.6/checks/044.trace m4-1.4.7/checks/044.trace --- m4-1.4.6/checks/044.trace 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/044.trace 1969-12-31 17:00:00.000000000 -0700 @@ -1,33 +0,0 @@ -dnl @ ../doc/m4.texinfo:2097: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -traceoff(`foo') -dnl @result{} -traceon(`foo') -dnl @result{} -foo -dnl @result{}foo -define(`foo', `bar') -dnl @result{} -foo -dnl @error{}m4trace: -1- foo -> `bar' -dnl @result{}bar -undefine(`foo') -dnl @result{} -ifdef(`foo', `yes', `no') -dnl @result{}no -indir(`foo') -dnl @error{}m4:stdin:8: undefined macro `foo' -dnl @result{} -define(`foo', `blah') -dnl @result{} -foo -dnl @error{}m4trace: -1- foo -> `blah' -dnl @result{}blah -traceoff -dnl @result{} -foo -dnl @result{}blah diff -ruNp m4-1.4.6/checks/045.loops m4-1.4.7/checks/045.loops --- m4-1.4.6/checks/045.loops 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/045.loops 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:2076: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +undivert(`forloop.m4') +dnl @result{}divert(`-1') +dnl @result{}# forloop(var, from, to, stmt) +dnl @result{}define(`forloop', +dnl @result{} `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')') +dnl @result{}define(`_forloop', +dnl @result{} `$4`'ifelse($1, `$3', , +dnl @result{} `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')') +dnl @result{}divert`'dnl +dnl @result{} diff -ruNp m4-1.4.6/checks/045.trace m4-1.4.7/checks/045.trace --- m4-1.4.6/checks/045.trace 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/045.trace 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:2130: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -traceon(`eval', `m4_divnum') -dnl @result{} -define(`m4_eval', defn(`eval')) -dnl @result{} -define(`m4_divnum', defn(`divnum')) -dnl @result{} -eval(divnum) -dnl @error{}m4trace: -1- eval(`0') -> `0' -dnl @result{}0 -m4_eval(m4_divnum) -dnl @error{}m4trace: -2- m4_divnum -> `0' -dnl @result{}0 diff -ruNp m4-1.4.6/checks/046.debug_leve m4-1.4.7/checks/046.debug_leve --- m4-1.4.6/checks/046.debug_leve 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/046.debug_leve 1969-12-31 17:00:00.000000000 -0700 @@ -1,25 +0,0 @@ -dnl @ ../doc/m4.texinfo:2225: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `FOO') -dnl @result{} -traceon(`foo') -dnl @result{} -debugmode() -dnl @result{} -foo -dnl @error{}m4trace: -1- foo -> `FOO' -dnl @result{}FOO -debugmode -dnl @result{} -foo -dnl @error{}m4trace: -1- foo -dnl @result{}FOO -debugmode(`+l') -dnl @result{} -foo -dnl @error{}m4trace:8: -1- foo -dnl @result{}FOO diff -ruNp m4-1.4.6/checks/046.dumpdef m4-1.4.7/checks/046.dumpdef --- m4-1.4.6/checks/046.dumpdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/046.dumpdef 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2132: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Hello world.') +dnl @result{} +dumpdef(`foo') +dnl @error{}foo: `Hello world.' +dnl @result{} +dumpdef(`define') +dnl @error{}define: +dnl @result{} diff -ruNp m4-1.4.6/checks/047.debug_outp m4-1.4.7/checks/047.debug_outp --- m4-1.4.6/checks/047.debug_outp 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/047.debug_outp 1969-12-31 17:00:00.000000000 -0700 @@ -1,22 +0,0 @@ -dnl @ ../doc/m4.texinfo:2270: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -traceon(`divnum') -dnl @result{} -divnum(`extra') -dnl @error{}m4:stdin:2: Warning: excess arguments to builtin `divnum' ignored -dnl @error{}m4trace: -1- divnum(`extra') -> `0' -dnl @result{}0 -debugfile() -dnl @result{} -divnum(`extra') -dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `divnum' ignored -dnl @result{}0 -debugfile -dnl @result{} -divnum -dnl @error{}m4trace: -1- divnum -> `0' -dnl @result{}0 diff -ruNp m4-1.4.6/checks/047.dumpdef m4-1.4.7/checks/047.dumpdef --- m4-1.4.6/checks/047.dumpdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/047.dumpdef 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2148: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +pushdef(`f', ``$0'1')pushdef(`f', ``$0'2') +dnl @result{} +f(popdef(`f')dumpdef(`f')) +dnl @error{}f: ``$0'1' +dnl @result{}f2 +f(popdef(`f')dumpdef(`f')) +dnl @error{}m4:stdin:3: undefined macro `f' +dnl @result{}f1 diff -ruNp m4-1.4.6/checks/048.dnl m4-1.4.7/checks/048.dnl --- m4-1.4.6/checks/048.dnl 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/048.dnl 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:2319: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Macro `foo'.')dnl A very simple macro, indeed. -foo -dnl @result{}Macro foo. diff -ruNp m4-1.4.6/checks/048.trace m4-1.4.7/checks/048.trace --- m4-1.4.6/checks/048.trace 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/048.trace 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2186: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Hello World.') +dnl @result{} +define(`echo', `$@') +dnl @result{} +traceon(`foo', `echo') +dnl @result{} +foo +dnl @error{}m4trace: -1- foo -> `Hello World.' +dnl @result{}Hello World. +echo(`gnus', `and gnats') +dnl @error{}m4trace: -1- echo(`gnus', `and gnats') -> ``gnus',`and gnats'' +dnl @result{}gnus,and gnats diff -ruNp m4-1.4.6/checks/049.dnl m4-1.4.7/checks/049.dnl --- m4-1.4.6/checks/049.dnl 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/049.dnl 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:2337: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -dnl(`args are ignored, but side effects occur', -define(`foo', `like this')) while this text is ignored: undefine(`foo') -dnl @error{}m4:stdin:2: Warning: excess arguments to builtin `dnl' ignored -See how `foo' was defined, foo? -dnl @result{}See how foo was defined, like this? diff -ruNp m4-1.4.6/checks/049.trace m4-1.4.7/checks/049.trace --- m4-1.4.6/checks/049.trace 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/049.trace 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,33 @@ +dnl @ ../doc/m4.texinfo:2211: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +traceoff(`foo') +dnl @result{} +traceon(`foo') +dnl @result{} +foo +dnl @result{}foo +define(`foo', `bar') +dnl @result{} +foo +dnl @error{}m4trace: -1- foo -> `bar' +dnl @result{}bar +undefine(`foo') +dnl @result{} +ifdef(`foo', `yes', `no') +dnl @result{}no +indir(`foo') +dnl @error{}m4:stdin:8: undefined macro `foo' +dnl @result{} +define(`foo', `blah') +dnl @result{} +foo +dnl @error{}m4trace: -1- foo -> `blah' +dnl @result{}blah +traceoff +dnl @result{} +foo +dnl @result{}blah diff -ruNp m4-1.4.6/checks/050.dnl m4-1.4.7/checks/050.dnl --- m4-1.4.6/checks/050.dnl 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/050.dnl 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:2348: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`hi', `HI') -dnl @result{} -m4wrap(`m4wrap(`2 hi -')0 hi dnl 1 hi') -dnl @result{} -dnl @error{}m4: Warning: end of file treated as newline -dnl @result{}0 HI 2 HI diff -ruNp m4-1.4.6/checks/050.trace m4-1.4.7/checks/050.trace --- m4-1.4.6/checks/050.trace 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/050.trace 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2244: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +traceon(`eval', `m4_divnum') +dnl @result{} +define(`m4_eval', defn(`eval')) +dnl @result{} +define(`m4_divnum', defn(`divnum')) +dnl @result{} +eval(divnum) +dnl @error{}m4trace: -1- eval(`0') -> `0' +dnl @result{}0 +m4_eval(m4_divnum) +dnl @error{}m4trace: -2- m4_divnum -> `0' +dnl @result{}0 diff -ruNp m4-1.4.6/checks/051.changequot m4-1.4.7/checks/051.changequot --- m4-1.4.6/checks/051.changequot 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/051.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:2377: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -changequote(`[', `]') -dnl @result{} -define([foo], [Macro [foo].]) -dnl @result{} -foo -dnl @result{}Macro foo. diff -ruNp m4-1.4.6/checks/051.debug_leve m4-1.4.7/checks/051.debug_leve --- m4-1.4.6/checks/051.debug_leve 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/051.debug_leve 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,25 @@ +dnl @ ../doc/m4.texinfo:2339: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `FOO') +dnl @result{} +traceon(`foo') +dnl @result{} +debugmode() +dnl @result{} +foo +dnl @error{}m4trace: -1- foo -> `FOO' +dnl @result{}FOO +debugmode +dnl @result{} +foo +dnl @error{}m4trace: -1- foo +dnl @result{}FOO +debugmode(`+l') +dnl @result{} +foo +dnl @error{}m4trace:8: -1- foo +dnl @result{}FOO diff -ruNp m4-1.4.6/checks/052.changequot m4-1.4.7/checks/052.changequot --- m4-1.4.6/checks/052.changequot 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/052.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2392: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`a', `b') -dnl @result{} -«a» -dnl @result{}«b» -changequote(`«', `»') -dnl @result{} -«a» -dnl @result{}a diff -ruNp m4-1.4.6/checks/052.debug_outp m4-1.4.7/checks/052.debug_outp --- m4-1.4.6/checks/052.debug_outp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/052.debug_outp 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:2384: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +traceon(`divnum') +dnl @result{} +divnum(`extra') +dnl @error{}m4:stdin:2: Warning: excess arguments to builtin `divnum' ignored +dnl @error{}m4trace: -1- divnum(`extra') -> `0' +dnl @result{}0 +debugfile() +dnl @result{} +divnum(`extra') +dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `divnum' ignored +dnl @result{}0 +debugfile +dnl @result{} +divnum +dnl @error{}m4trace: -1- divnum -> `0' +dnl @result{}0 diff -ruNp m4-1.4.6/checks/053.changequot m4-1.4.7/checks/053.changequot --- m4-1.4.6/checks/053.changequot 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/053.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:2406: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -changequote(`[[[', `]]]') -dnl @result{} -define([[[foo]]], [[[Macro [[[[[foo]]]]].]]]) -dnl @result{} -foo -dnl @result{}Macro [[foo]]. diff -ruNp m4-1.4.6/checks/053.dnl m4-1.4.7/checks/053.dnl --- m4-1.4.6/checks/053.dnl 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/053.dnl 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,9 @@ +dnl @ ../doc/m4.texinfo:2433: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Macro `foo'.')dnl A very simple macro, indeed. +foo +dnl @result{}Macro foo. diff -ruNp m4-1.4.6/checks/054.changequot m4-1.4.7/checks/054.changequot --- m4-1.4.6/checks/054.changequot 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/054.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2418: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Macro `FOO'.') -dnl @result{} -changequote(, ) -dnl @result{} -foo -dnl @result{}Macro `FOO'. -`foo' -dnl @result{}`Macro `FOO'.' diff -ruNp m4-1.4.6/checks/054.dnl m4-1.4.7/checks/054.dnl --- m4-1.4.6/checks/054.dnl 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/054.dnl 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:2451: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +dnl(`args are ignored, but side effects occur', +define(`foo', `like this')) while this text is ignored: undefine(`foo') +dnl @error{}m4:stdin:2: Warning: excess arguments to builtin `dnl' ignored +See how `foo' was defined, foo? +dnl @result{}See how foo was defined, like this? diff -ruNp m4-1.4.6/checks/055.changequot m4-1.4.7/checks/055.changequot --- m4-1.4.6/checks/055.changequot 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/055.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:2444: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`hi', `HI') -dnl @result{} -changequote(`q', `Q') -dnl @result{} -q hi Q hi -dnl @result{}q HI Q HI -changequote -dnl @result{} -changequote(`-', `EOF') -dnl @result{} -- hi EOF hi -dnl @result{} hi HI diff -ruNp m4-1.4.6/checks/055.dnl m4-1.4.7/checks/055.dnl --- m4-1.4.6/checks/055.dnl 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/055.dnl 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:2462: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`hi', `HI') +dnl @result{} +m4wrap(`m4wrap(`2 hi +')0 hi dnl 1 hi') +dnl @result{} +dnl @error{}m4: Warning: end of file treated as newline +dnl @result{}0 HI 2 HI diff -ruNp m4-1.4.6/checks/056.changequot m4-1.4.7/checks/056.changequot --- m4-1.4.6/checks/056.changequot 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/056.changequot 2006-09-23 22:33:20.000000000 -0600 @@ -1,28 +1,12 @@ -dnl @ ../doc/m4.texinfo:2465: Origin of test +dnl @ ../doc/m4.texinfo:2491: Origin of test dnl @ Copyright (C) 2006 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`echo', `$#:$@:') +changequote(`[', `]') dnl @result{} -define(`hi', `HI') +define([foo], [Macro [foo].]) dnl @result{} -changequote(`(',`)') -dnl @result{} -echo(hi) -dnl @result{}0::hi -changequote -dnl @result{} -changequote(`((', `))') -dnl @result{} -echo(hi) -dnl @result{}1:HI: -echo((hi)) -dnl @result{}0::hi -changequote -dnl @result{} -changequote(`,', `)') -dnl @result{} -echo(hi,hi)bye) -dnl @result{}1:HIhibye: +foo +dnl @result{}Macro foo. diff -ruNp m4-1.4.6/checks/057.changequot m4-1.4.7/checks/057.changequot --- m4-1.4.6/checks/057.changequot 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/057.changequot 2006-09-23 22:33:20.000000000 -0600 @@ -1,24 +1,14 @@ -dnl @ ../doc/m4.texinfo:2497: Origin of test +dnl @ ../doc/m4.texinfo:2506: Origin of test dnl @ Copyright (C) 2006 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`hi', `HI') +define(`a', `b') dnl @result{} -changequote(`""', `"') +«a» +dnl @result{}«b» +changequote(`«', `»') dnl @result{} -""hi"""hi" -dnl @result{}hihi -""hi" ""hi" -dnl @result{}hi hi -""hi"" "hi" -dnl @result{}hi" "HI" -changequote -dnl @result{} -`hi`hi'hi' -dnl @result{}hi`hi'hi -changequote(`"', `"') -dnl @result{} -"hi"hi"hi" -dnl @result{}hiHIhi +«a» +dnl @result{}a diff -ruNp m4-1.4.6/checks/058.changequot m4-1.4.7/checks/058.changequot --- m4-1.4.6/checks/058.changequot 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/058.changequot 2006-09-23 22:33:20.000000000 -0600 @@ -4,5 +4,9 @@ dnl @ This file is free software; the Fr dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -`dangling quote -dnl @error{}m4:stdin:1: ERROR: end of file in string +changequote(`[[[', `]]]') +dnl @result{} +define([[[foo]]], [[[Macro [[[[[foo]]]]].]]]) +dnl @result{} +foo +dnl @result{}Macro [[foo]]. diff -ruNp m4-1.4.6/checks/059.changecom m4-1.4.7/checks/059.changecom --- m4-1.4.6/checks/059.changecom 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/059.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:2544: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`comment', `COMMENT') -dnl @result{} -# A normal comment -dnl @result{}# A normal comment -changecom(`/*', `*/') -dnl @result{} -# Not a comment anymore -dnl @result{}# Not a COMMENT anymore -But: /* this is a comment now */ while this is not a comment -dnl @result{}But: /* this is a comment now */ while this is not a COMMENT diff -ruNp m4-1.4.6/checks/059.changequot m4-1.4.7/checks/059.changequot --- m4-1.4.6/checks/059.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/059.changequot 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2532: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Macro `FOO'.') +dnl @result{} +changequote(, ) +dnl @result{} +foo +dnl @result{}Macro `FOO'. +`foo' +dnl @result{}`Macro `FOO'.' diff -ruNp m4-1.4.6/checks/060.changecom m4-1.4.7/checks/060.changecom --- m4-1.4.6/checks/060.changecom 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/060.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:2567: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`comment', `COMMENT') -dnl @result{} -changecom -dnl @result{} -# Not a comment anymore -dnl @result{}# Not a COMMENT anymore -changecom(`#') -dnl @result{} -# comment again -dnl @result{}# comment again diff -ruNp m4-1.4.6/checks/060.changequot m4-1.4.7/checks/060.changequot --- m4-1.4.6/checks/060.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/060.changequot 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2558: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`hi', `HI') +dnl @result{} +changequote(`q', `Q') +dnl @result{} +q hi Q hi +dnl @result{}q HI Q HI +changequote +dnl @result{} +changequote(`-', `EOF') +dnl @result{} +- hi EOF hi +dnl @result{} hi HI diff -ruNp m4-1.4.6/checks/061.changecom m4-1.4.7/checks/061.changecom --- m4-1.4.6/checks/061.changecom 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/061.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2586: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`a', `b') -dnl @result{} -«a» -dnl @result{}«b» -changecom(`«', `»') -dnl @result{} -«a» -dnl @result{}«a» diff -ruNp m4-1.4.6/checks/061.changequot m4-1.4.7/checks/061.changequot --- m4-1.4.6/checks/061.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/061.changequot 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,28 @@ +dnl @ ../doc/m4.texinfo:2579: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`echo', `$#:$@:') +dnl @result{} +define(`hi', `HI') +dnl @result{} +changequote(`(',`)') +dnl @result{} +echo(hi) +dnl @result{}0::hi +changequote +dnl @result{} +changequote(`((', `))') +dnl @result{} +echo(hi) +dnl @result{}1:HI: +echo((hi)) +dnl @result{}0::hi +changequote +dnl @result{} +changequote(`,', `)') +dnl @result{} +echo(hi,hi)bye) +dnl @result{}1:HIhibye: diff -ruNp m4-1.4.6/checks/062.changecom m4-1.4.7/checks/062.changecom --- m4-1.4.6/checks/062.changecom 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/062.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:2605: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`hi', `HI') -dnl @result{} -changecom(`q', `Q') -dnl @result{} -q hi Q hi -dnl @result{}q hi Q HI diff -ruNp m4-1.4.6/checks/062.changequot m4-1.4.7/checks/062.changequot --- m4-1.4.6/checks/062.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/062.changequot 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,24 @@ +dnl @ ../doc/m4.texinfo:2611: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`hi', `HI') +dnl @result{} +changequote(`""', `"') +dnl @result{} +""hi"""hi" +dnl @result{}hihi +""hi" ""hi" +dnl @result{}hi hi +""hi"" "hi" +dnl @result{}hi" "HI" +changequote +dnl @result{} +`hi`hi'hi' +dnl @result{}hi`hi'hi +changequote(`"', `"') +dnl @result{} +"hi"hi"hi" +dnl @result{}hiHIhi diff -ruNp m4-1.4.6/checks/063.changecom m4-1.4.7/checks/063.changecom --- m4-1.4.6/checks/063.changecom 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/063.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,26 +0,0 @@ -dnl @ ../doc/m4.texinfo:2620: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`echo', `$#:$@:') -dnl @result{} -define(`hi', `HI') -dnl @result{} -changecom(`(',`)') -dnl @result{} -echo(hi) -dnl @result{}0::(hi) -changecom -dnl @result{} -changecom(`((', `))') -dnl @result{} -echo(hi) -dnl @result{}1:HI: -echo((hi)) -dnl @result{}0::((hi)) -changecom(`,', `)') -dnl @result{} -echo(hi,hi)bye) -dnl @result{}1:HI,hi)bye: diff -ruNp m4-1.4.6/checks/063.changequot m4-1.4.7/checks/063.changequot --- m4-1.4.6/checks/063.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/063.changequot 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,8 @@ +dnl @ ../doc/m4.texinfo:2634: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +`dangling quote +dnl @error{}m4:stdin:1: ERROR: end of file in string diff -ruNp m4-1.4.6/checks/064.changecom m4-1.4.7/checks/064.changecom --- m4-1.4.6/checks/064.changecom 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/064.changecom 2006-09-23 22:33:20.000000000 -0600 @@ -1,10 +1,16 @@ -dnl @ ../doc/m4.texinfo:2645: Origin of test +dnl @ ../doc/m4.texinfo:2658: Origin of test dnl @ Copyright (C) 2006 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. +define(`comment', `COMMENT') +dnl @result{} +# A normal comment +dnl @result{}# A normal comment changecom(`/*', `*/') dnl @result{} -/*dangling comment -dnl @error{}m4:stdin:1: ERROR: end of file in comment +# Not a comment anymore +dnl @result{}# Not a COMMENT anymore +But: /* this is a comment now */ while this is not a comment +dnl @result{}But: /* this is a comment now */ while this is not a COMMENT diff -ruNp m4-1.4.6/checks/065.changecom m4-1.4.7/checks/065.changecom --- m4-1.4.6/checks/065.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/065.changecom 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:2681: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`comment', `COMMENT') +dnl @result{} +changecom +dnl @result{} +# Not a comment anymore +dnl @result{}# Not a COMMENT anymore +changecom(`#') +dnl @result{} +# comment again +dnl @result{}# comment again diff -ruNp m4-1.4.6/checks/065.changeword m4-1.4.7/checks/065.changeword --- m4-1.4.6/checks/065.changeword 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/065.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:2695: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`changeword', `', `errprint(` skipping: no changeword support -')m4exit(`77')')dnl -changeword(`[_a-zA-Z0-9]+') -dnl @result{} -define(`1', `0')1 -dnl @result{}0 diff -ruNp m4-1.4.6/checks/066.changecom m4-1.4.7/checks/066.changecom --- m4-1.4.6/checks/066.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/066.changecom 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2700: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`a', `b') +dnl @result{} +«a» +dnl @result{}«b» +changecom(`«', `»') +dnl @result{} +«a» +dnl @result{}«a» diff -ruNp m4-1.4.6/checks/066.changeword m4-1.4.7/checks/066.changeword --- m4-1.4.6/checks/066.changeword 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/066.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:2708: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`changeword', `', `errprint(` skipping: no changeword support -')m4exit(`77')')dnl -define(`_indir', defn(`indir')) -dnl @result{} -changeword(`_[_a-zA-Z0-9]*') -dnl @result{} -esyscmd(`foo') -dnl @result{}esyscmd(foo) -_indir(`esyscmd', `echo hi') -dnl @result{}hi -dnl @result{} diff -ruNp m4-1.4.6/checks/067.changecom m4-1.4.7/checks/067.changecom --- m4-1.4.6/checks/067.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/067.changecom 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:2719: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`hi', `HI') +dnl @result{} +changecom(`q', `Q') +dnl @result{} +q hi Q hi +dnl @result{}q hi Q HI diff -ruNp m4-1.4.6/checks/067.changeword m4-1.4.7/checks/067.changeword --- m4-1.4.6/checks/067.changeword 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/067.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:2731: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`changeword', `', `errprint(` skipping: no changeword support -')m4exit(`77')')dnl -changecom(`/*', `*/')dnl -define(`foo', `bar')dnl -changeword(`#\([_a-zA-Z0-9]*\)') -dnl @result{} -#esyscmd(`echo foo \#foo') -dnl @result{}foo bar -dnl @result{} diff -ruNp m4-1.4.6/checks/068.changecom m4-1.4.7/checks/068.changecom --- m4-1.4.6/checks/068.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/068.changecom 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,26 @@ +dnl @ ../doc/m4.texinfo:2734: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`echo', `$#:$@:') +dnl @result{} +define(`hi', `HI') +dnl @result{} +changecom(`(',`)') +dnl @result{} +echo(hi) +dnl @result{}0::(hi) +changecom +dnl @result{} +changecom(`((', `))') +dnl @result{} +echo(hi) +dnl @result{}1:HI: +echo((hi)) +dnl @result{}0::((hi)) +changecom(`,', `)') +dnl @result{} +echo(hi,hi)bye) +dnl @result{}1:HI,hi)bye: diff -ruNp m4-1.4.6/checks/068.changeword m4-1.4.7/checks/068.changeword --- m4-1.4.6/checks/068.changeword 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/068.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:2765: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`changeword', `', `errprint(` skipping: no changeword support -')m4exit(`77')')dnl -define(`a', `errprint(`Hello')')dnl -changeword(`@\([_a-zA-Z0-9]*\)') -dnl @result{} -@a -dnl @result{}errprint(Hello) diff -ruNp m4-1.4.6/checks/069.changecom m4-1.4.7/checks/069.changecom --- m4-1.4.6/checks/069.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/069.changecom 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:2759: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +changecom(`/*', `*/') +dnl @result{} +/*dangling comment +dnl @error{}m4:stdin:1: ERROR: end of file in comment diff -ruNp m4-1.4.6/checks/069.m4wrap m4-1.4.7/checks/069.m4wrap --- m4-1.4.6/checks/069.m4wrap 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/069.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2816: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`cleanup', `This is the `cleanup' action. -') -dnl @result{} -m4wrap(`cleanup') -dnl @result{} -This is the first and last normal input line. -dnl @result{}This is the first and last normal input line. -dnl @result{}This is the cleanup action. diff -ruNp m4-1.4.6/checks/070.changeword m4-1.4.7/checks/070.changeword --- m4-1.4.6/checks/070.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/070.changeword 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:2809: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +changeword(`[_a-zA-Z0-9]+') +dnl @result{} +define(`1', `0')1 +dnl @result{}0 diff -ruNp m4-1.4.6/checks/070.m4wrap m4-1.4.7/checks/070.m4wrap --- m4-1.4.6/checks/070.m4wrap 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/070.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:2845: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`f', `ifelse(`$1', `0', `Answer: 0!=1 -', eval(`$1>1'), `0', `Answer: $2$1=eval(`$2$1') -', `m4wrap(`f(decr(`$1'), `$2$1*')')')') -dnl @result{} -f(`10') -dnl @result{} -dnl @result{}Answer: 10*9*8*7*6*5*4*3*2*1=3628800 diff -ruNp m4-1.4.6/checks/071.changeword m4-1.4.7/checks/071.changeword --- m4-1.4.6/checks/071.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/071.changeword 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:2822: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +define(`_indir', defn(`indir')) +dnl @result{} +changeword(`_[_a-zA-Z0-9]*') +dnl @result{} +esyscmd(`foo') +dnl @result{}esyscmd(foo) +_indir(`esyscmd', `echo hi') +dnl @result{}hi +dnl @result{} diff -ruNp m4-1.4.6/checks/071.m4wrap m4-1.4.7/checks/071.m4wrap --- m4-1.4.6/checks/071.m4wrap 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/071.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:2859: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`aa', `AA -') -dnl @result{} -m4wrap(`a')m4wrap(`a') -dnl @result{} -dnl @result{}AA diff -ruNp m4-1.4.6/checks/072.changeword m4-1.4.7/checks/072.changeword --- m4-1.4.6/checks/072.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/072.changeword 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,38 @@ +dnl @ ../doc/m4.texinfo:2841: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +define(`foo +', `bar +') +dnl @result{} +dnl This example wants to recognize changeword, dnl, and `foo\n'. +dnl First, we check that our regexp will match. +regexp(`changeword', `[cd][a-z]*\|foo[ +]') +dnl @result{}0 +regexp(`foo +', `[cd][a-z]*\|foo[ +]') +dnl @result{}0 +regexp(`f', `[cd][a-z]*\|foo[ +]') +dnl @result{}-1 +foo +dnl @result{}foo +changeword(`[cd][a-z]*\|foo[ +]') +dnl @result{} +dnl Even though `foo\n' matches, we forgot to allow `f'. +foo +dnl @result{}foo +changeword(`[cd][a-z]*\|fo*[ +]?') +dnl @result{} +dnl Now we can call `foo\n'. +foo +dnl @result{}bar diff -ruNp m4-1.4.6/checks/072.m4wrap m4-1.4.7/checks/072.m4wrap --- m4-1.4.6/checks/072.m4wrap 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/072.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:2873: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -m4wrap(`m4wrap(`)')len(abc') -dnl @result{} -dnl @error{}m4: ERROR: end of file in argument list diff -ruNp m4-1.4.6/checks/073.changeword m4-1.4.7/checks/073.changeword --- m4-1.4.6/checks/073.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/073.changeword 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2880: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +changecom(`/*', `*/')dnl +define(`foo', `bar')dnl +changeword(`#\([_a-zA-Z0-9]*\)') +dnl @result{} +#esyscmd(`echo foo \#foo') +dnl @result{}foo bar +dnl @result{} diff -ruNp m4-1.4.6/checks/073.include m4-1.4.7/checks/073.include --- m4-1.4.6/checks/073.include 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/073.include 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:2915: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`none') -dnl @result{} -dnl @error{}m4:stdin:1: cannot open `none': No such file or directory -include() -dnl @result{} -dnl @error{}m4:stdin:2: cannot open `': No such file or directory -sinclude(`none') -dnl @result{} -sinclude() -dnl @result{} diff -ruNp m4-1.4.6/checks/074.changeword m4-1.4.7/checks/074.changeword --- m4-1.4.6/checks/074.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/074.changeword 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:2917: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +define(`a', `errprint(`Hello')')dnl +changeword(`@\([_a-zA-Z0-9]*\)') +dnl @result{} +@a +dnl @result{}errprint(Hello) diff -ruNp m4-1.4.6/checks/074.include m4-1.4.7/checks/074.include --- m4-1.4.6/checks/074.include 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/074.include 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:2943: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `FOO') -dnl @result{} -include(`incl.m4') -dnl @result{}Include file start -dnl @result{}FOO -dnl @result{}Include file end -dnl @result{} diff -ruNp m4-1.4.6/checks/075.include m4-1.4.7/checks/075.include --- m4-1.4.6/checks/075.include 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/075.include 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:2958: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`bar', include(`incl.m4')) -dnl @result{} -This is `bar': >>bar<< -dnl @result{}This is bar: >>Include file start -dnl @result{}foo -dnl @result{}Include file end -dnl @result{}<< diff -ruNp m4-1.4.6/checks/075.m4wrap m4-1.4.7/checks/075.m4wrap --- m4-1.4.6/checks/075.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/075.m4wrap 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2968: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`cleanup', `This is the `cleanup' action. +') +dnl @result{} +m4wrap(`cleanup') +dnl @result{} +This is the first and last normal input line. +dnl @result{}This is the first and last normal input line. +dnl @result{}This is the cleanup action. diff -ruNp m4-1.4.6/checks/076.divert m4-1.4.7/checks/076.divert --- m4-1.4.6/checks/076.divert 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/076.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3045: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1') -This text is diverted. -divert -dnl @result{} -This text is not diverted. -dnl @result{}This text is not diverted. -dnl @result{} -dnl @result{}This text is diverted. diff -ruNp m4-1.4.6/checks/076.m4wrap m4-1.4.7/checks/076.m4wrap --- m4-1.4.6/checks/076.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/076.m4wrap 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:2997: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`f', `ifelse(`$1', `0', `Answer: 0!=1 +', eval(`$1>1'), `0', `Answer: $2$1=eval(`$2$1') +', `m4wrap(`f(decr(`$1'), `$2$1*')')')') +dnl @result{} +f(`10') +dnl @result{} +dnl @result{}Answer: 10*9*8*7*6*5*4*3*2*1=3628800 diff -ruNp m4-1.4.6/checks/077.divert m4-1.4.7/checks/077.divert --- m4-1.4.6/checks/077.divert 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/077.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3061: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`text', `TEXT') -dnl @result{} -divert(`1')`diverted text.' -divert -dnl @result{} -m4wrap(`Wrapped text preceeds ') -dnl @result{} -dnl @result{}Wrapped TEXT preceeds diverted text. diff -ruNp m4-1.4.6/checks/077.m4wrap m4-1.4.7/checks/077.m4wrap --- m4-1.4.6/checks/077.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/077.m4wrap 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:3011: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`aa', `AA +') +dnl @result{} +m4wrap(`a')m4wrap(`a') +dnl @result{} +dnl @result{}AA diff -ruNp m4-1.4.6/checks/078.divert m4-1.4.7/checks/078.divert --- m4-1.4.6/checks/078.divert 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/078.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:3078: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`-1') -define(`foo', `Macro `foo'.') -define(`bar', `Macro `bar'.') -divert -dnl @result{} diff -ruNp m4-1.4.6/checks/078.m4wrap m4-1.4.7/checks/078.m4wrap --- m4-1.4.6/checks/078.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/078.m4wrap 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,9 @@ +dnl @ ../doc/m4.texinfo:3025: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +m4wrap(`m4wrap(`)')len(abc') +dnl @result{} +dnl @error{}m4: ERROR: end of file in argument list diff -ruNp m4-1.4.6/checks/079.divert m4-1.4.7/checks/079.divert --- m4-1.4.6/checks/079.divert 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/079.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:3095: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -We decided to divert the stream for irrigation. -dnl @result{}We decided to the stream for irrigation. -define(`divert', `ifelse(`$#', `0', ``$0'', `builtin(`$0', $@)')') -dnl @result{} -divert(-1) -Ignored text. -divert(0) -dnl @result{} -We decided to divert the stream for irrigation. -dnl @result{}We decided to divert the stream for irrigation. diff -ruNp m4-1.4.6/checks/079.include m4-1.4.7/checks/079.include --- m4-1.4.6/checks/079.include 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/079.include 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3067: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`none') +dnl @result{} +dnl @error{}m4:stdin:1: cannot open `none': No such file or directory +include() +dnl @result{} +dnl @error{}m4:stdin:2: cannot open `': No such file or directory +sinclude(`none') +dnl @result{} +sinclude() +dnl @result{} diff -ruNp m4-1.4.6/checks/080.include m4-1.4.7/checks/080.include --- m4-1.4.6/checks/080.include 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/080.include 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:3095: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `FOO') +dnl @result{} +include(`incl.m4') +dnl @result{}Include file start +dnl @result{}FOO +dnl @result{}Include file end +dnl @result{} diff -ruNp m4-1.4.6/checks/080.undivert m4-1.4.7/checks/080.undivert --- m4-1.4.6/checks/080.undivert 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/080.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:3123: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1') -This text is diverted. -divert -dnl @result{} -This text is not diverted. -dnl @result{}This text is not diverted. -undivert(`1') -dnl @result{} -dnl @result{}This text is diverted. -dnl @result{} diff -ruNp m4-1.4.6/checks/081.include m4-1.4.7/checks/081.include --- m4-1.4.6/checks/081.include 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/081.include 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:3110: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`bar', include(`incl.m4')) +dnl @result{} +This is `bar': >>bar<< +dnl @result{}This is bar: >>Include file start +dnl @result{}foo +dnl @result{}Include file end +dnl @result{}<< diff -ruNp m4-1.4.6/checks/081.undivert m4-1.4.7/checks/081.undivert --- m4-1.4.6/checks/081.undivert 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/081.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:3146: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1')diverted text -divert -dnl @result{} -undivert() -dnl @result{} -undivert(`0') -dnl @result{} -undivert -dnl @result{}diverted text -dnl @result{} diff -ruNp m4-1.4.6/checks/082.divert m4-1.4.7/checks/082.divert --- m4-1.4.6/checks/082.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/082.divert 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3197: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`1') +This text is diverted. +divert +dnl @result{} +This text is not diverted. +dnl @result{}This text is not diverted. +dnl @result{} +dnl @result{}This text is diverted. diff -ruNp m4-1.4.6/checks/082.undivert m4-1.4.7/checks/082.undivert --- m4-1.4.6/checks/082.undivert 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/082.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:3162: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1') -This text is diverted first. -divert(`0')undivert(`1')dnl -dnl @result{} -dnl @result{}This text is diverted first. -undivert(`1') -dnl @result{} -divert(`1') -This text is also diverted but not appended. -divert(`0')undivert(`1')dnl -dnl @result{} -dnl @result{}This text is also diverted but not appended. diff -ruNp m4-1.4.6/checks/083.divert m4-1.4.7/checks/083.divert --- m4-1.4.6/checks/083.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/083.divert 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3213: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`text', `TEXT') +dnl @result{} +divert(`1')`diverted text.' +divert +dnl @result{} +m4wrap(`Wrapped text preceeds ') +dnl @result{} +dnl @result{}Wrapped TEXT preceeds diverted text. diff -ruNp m4-1.4.6/checks/083.undivert m4-1.4.7/checks/083.undivert --- m4-1.4.6/checks/083.undivert 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/083.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3181: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1')one -divert(`2')two -divert(`3')three -divert(`2')undivert`'dnl -divert`'undivert`'dnl -dnl @result{}two -dnl @result{}one -dnl @result{}three diff -ruNp m4-1.4.6/checks/084.divert m4-1.4.7/checks/084.divert --- m4-1.4.6/checks/084.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/084.divert 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:3230: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`-1') +define(`foo', `Macro `foo'.') +define(`bar', `Macro `bar'.') +divert +dnl @result{} diff -ruNp m4-1.4.6/checks/084.undivert m4-1.4.7/checks/084.undivert --- m4-1.4.6/checks/084.undivert 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/084.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3202: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`bar', `BAR') -dnl @result{} -undivert(`foo') -dnl @result{}bar -dnl @result{} -include(`foo') -dnl @result{}BAR -dnl @result{} diff -ruNp m4-1.4.6/checks/085.divert m4-1.4.7/checks/085.divert --- m4-1.4.6/checks/085.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/085.divert 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3247: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +We decided to divert the stream for irrigation. +dnl @result{}We decided to the stream for irrigation. +define(`divert', `ifelse(`$#', `0', ``$0'', `builtin(`$0', $@)')') +dnl @result{} +divert(-1) +Ignored text. +divert(0) +dnl @result{} +We decided to divert the stream for irrigation. +dnl @result{}We decided to divert the stream for irrigation. diff -ruNp m4-1.4.6/checks/085.divnum m4-1.4.7/checks/085.divnum --- m4-1.4.6/checks/085.divnum 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/085.divnum 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:3226: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -Initial divnum -dnl @result{}Initial 0 -divert(`1') -Diversion one: divnum -divert(`2') -Diversion two: divnum -dnl @result{} -dnl @result{}Diversion one: 1 -dnl @result{} -dnl @result{}Diversion two: 2 diff -ruNp m4-1.4.6/checks/086.cleardiv m4-1.4.7/checks/086.cleardiv --- m4-1.4.6/checks/086.cleardiv 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/086.cleardiv 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:3252: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1') -Diversion one: divnum -divert(`2') -Diversion two: divnum -divert(`-1') -undivert diff -ruNp m4-1.4.6/checks/086.undivert m4-1.4.7/checks/086.undivert --- m4-1.4.6/checks/086.undivert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/086.undivert 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3275: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`1') +This text is diverted. +divert +dnl @result{} +This text is not diverted. +dnl @result{}This text is not diverted. +undivert(`1') +dnl @result{} +dnl @result{}This text is diverted. +dnl @result{} diff -ruNp m4-1.4.6/checks/087.cleardiv m4-1.4.7/checks/087.cleardiv --- m4-1.4.6/checks/087.cleardiv 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/087.cleardiv 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:3271: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`cleardivert', -`pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') -dnl @result{} diff -ruNp m4-1.4.6/checks/087.undivert m4-1.4.7/checks/087.undivert --- m4-1.4.6/checks/087.undivert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/087.undivert 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3298: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`1')diverted text +divert +dnl @result{} +undivert() +dnl @result{} +undivert(`0') +dnl @result{} +undivert +dnl @result{}diverted text +dnl @result{} diff -ruNp m4-1.4.6/checks/088.len m4-1.4.7/checks/088.len --- m4-1.4.6/checks/088.len 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/088.len 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:3310: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -len() -dnl @result{}0 -len(`abcdef') -dnl @result{}6 diff -ruNp m4-1.4.6/checks/088.undivert m4-1.4.7/checks/088.undivert --- m4-1.4.6/checks/088.undivert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/088.undivert 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:3314: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`1') +This text is diverted first. +divert(`0')undivert(`1')dnl +dnl @result{} +dnl @result{}This text is diverted first. +undivert(`1') +dnl @result{} +divert(`1') +This text is also diverted but not appended. +divert(`0')undivert(`1')dnl +dnl @result{} +dnl @result{}This text is also diverted but not appended. diff -ruNp m4-1.4.6/checks/089.index_macr m4-1.4.7/checks/089.index_macr --- m4-1.4.6/checks/089.index_macr 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/089.index_macr 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:3331: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -index(`gnus, gnats, and armadillos', `nat') -dnl @result{}7 -index(`gnus, gnats, and armadillos', `dag') -dnl @result{}-1 diff -ruNp m4-1.4.6/checks/089.undivert m4-1.4.7/checks/089.undivert --- m4-1.4.6/checks/089.undivert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/089.undivert 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3333: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`1')one +divert(`2')two +divert(`3')three +divert(`2')undivert`'dnl +divert`'undivert`'dnl +dnl @result{}two +dnl @result{}one +dnl @result{}three diff -ruNp m4-1.4.6/checks/090.index_macr m4-1.4.7/checks/090.index_macr --- m4-1.4.6/checks/090.index_macr 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/090.index_macr 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:3340: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -index(`abc') -dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `index' -dnl @result{}0 diff -ruNp m4-1.4.6/checks/090.undivert m4-1.4.7/checks/090.undivert --- m4-1.4.6/checks/090.undivert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/090.undivert 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3354: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`bar', `BAR') +dnl @result{} +undivert(`foo') +dnl @result{}bar +dnl @result{} +include(`foo') +dnl @result{}BAR +dnl @result{} diff -ruNp m4-1.4.6/checks/091.divnum m4-1.4.7/checks/091.divnum --- m4-1.4.6/checks/091.divnum 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/091.divnum 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3378: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +Initial divnum +dnl @result{}Initial 0 +divert(`1') +Diversion one: divnum +divert(`2') +Diversion two: divnum +dnl @result{} +dnl @result{}Diversion one: 1 +dnl @result{} +dnl @result{}Diversion two: 2 diff -ruNp m4-1.4.6/checks/091.regexp m4-1.4.7/checks/091.regexp --- m4-1.4.6/checks/091.regexp 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/091.regexp 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3384: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -regexp(`GNUs not Unix', `\<[a-z]\w+') -dnl @result{}5 -regexp(`GNUs not Unix', `\= 0) -dnl @result{}1 -eval(`0r1:0111 + 0b100 + 0r3:12') -dnl @result{}12 -define(`square', `eval(`('$1`)**2')') -dnl @result{} -square(`9') -dnl @result{}81 -square(square(`5')`+1') -dnl @result{}676 -define(`foo', `666') -dnl @result{} -eval(`foo/6') -dnl @error{}m4:stdin:8: bad expression in eval: foo/6 -dnl @result{} -eval(foo/6) -dnl @result{}111 diff -ruNp m4-1.4.6/checks/105.patsubst m4-1.4.7/checks/105.patsubst --- m4-1.4.6/checks/105.patsubst 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/105.patsubst 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:3724: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`upcase', `translit(`$*', `a-z', `A-Z')')dnl +define(`downcase', `translit(`$*', `A-Z', `a-z')')dnl +define(`capitalize1', + `regexp(`$1', `^\(\w\)\(\w*\)', + `upcase(`\1')`'downcase(`\2')')')dnl +define(`capitalize', + `patsubst(`$1', `\w+', `capitalize1(`\&')')')dnl +capitalize(`GNUs not Unix') +dnl @result{}Gnus Not Unix diff -ruNp m4-1.4.6/checks/106.eval m4-1.4.7/checks/106.eval --- m4-1.4.6/checks/106.eval 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/106.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:3830: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -eval(0x80000000 / -1) -dnl @result{}-2147483648 -eval(0x80000000 % -1) -dnl @result{}0 -eval(0x7fffffff) -dnl @result{}2147483647 -incr(eval(0x7fffffff)) -dnl @result{}-2147483648 -eval(-4 >> 33) -dnl @result{}-2 diff -ruNp m4-1.4.6/checks/106.patsubst m4-1.4.7/checks/106.patsubst --- m4-1.4.6/checks/106.patsubst 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/106.patsubst 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:3740: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`patreg', +`patsubst($@) +regexp($@)')dnl +patreg(`bar foo baz Foo', `foo\|Foo', `FOO') +dnl @result{}bar FOO baz FOO +dnl @result{}FOO +patreg(`aba abb 121', `\(.\)\(.\)\1', `\2\1\2') +dnl @result{}bab abb 212 +dnl @result{}bab diff -ruNp m4-1.4.6/checks/107.eval m4-1.4.7/checks/107.eval --- m4-1.4.6/checks/107.eval 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/107.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,22 +0,0 @@ -dnl @ ../doc/m4.texinfo:3854: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -eval(`666', `10') -dnl @result{}666 -eval(`666', `11') -dnl @result{}556 -eval(`666', `6') -dnl @result{}3030 -eval(`666', `6', `10') -dnl @result{}0000003030 -eval(`-666', `6', `10') -dnl @result{}-0000003030 -eval(`10', `', `0') -dnl @result{}10 -`0r1:'eval(`10', `1', `11') -dnl @result{}0r1:01111111111 -eval(`10', `16') -dnl @result{}a diff -ruNp m4-1.4.6/checks/107.patsubst m4-1.4.7/checks/107.patsubst --- m4-1.4.6/checks/107.patsubst 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/107.patsubst 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,9 @@ +dnl @ ../doc/m4.texinfo:3754: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +patsubst(`abc') +dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `patsubst' +dnl @result{}abc diff -ruNp m4-1.4.6/checks/108.format m4-1.4.7/checks/108.format --- m4-1.4.6/checks/108.format 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/108.format 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3779: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `The brown fox jumped over the lazy dog') +dnl @result{} +format(`The string "%s" uses %d characters', foo, len(foo)) +dnl @result{}The string "The brown fox jumped over the lazy dog" uses 38 characters +format(`%.0f', `56789.9876') +dnl @result{}56790 +len(format(`%-*X', `300', `1')) +dnl @result{}300 diff -ruNp m4-1.4.6/checks/108.platform_m m4-1.4.7/checks/108.platform_m --- m4-1.4.6/checks/108.platform_m 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/108.platform_m 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:3927: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -__gnu__ -dnl @result{} -ifdef(`__gnu__', `Extensions are active') -dnl @result{}Extensions are active diff -ruNp m4-1.4.6/checks/109.format m4-1.4.7/checks/109.format --- m4-1.4.6/checks/109.format 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/109.format 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,21 @@ +dnl @ ../doc/m4.texinfo:3793: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`forloop.m4') +dnl @result{} +forloop(`i', `1', `10', `format(`%6d squared is %10d +', i, eval(i**2))') +dnl @result{} 1 squared is 1 +dnl @result{} 2 squared is 4 +dnl @result{} 3 squared is 9 +dnl @result{} 4 squared is 16 +dnl @result{} 5 squared is 25 +dnl @result{} 6 squared is 36 +dnl @result{} 7 squared is 49 +dnl @result{} 8 squared is 64 +dnl @result{} 9 squared is 81 +dnl @result{} 10 squared is 100 +dnl @result{} diff -ruNp m4-1.4.6/checks/109.platform_m m4-1.4.7/checks/109.platform_m --- m4-1.4.6/checks/109.platform_m 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/109.platform_m 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:3948: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`provided', `0') -dnl @result{} -ifdef(`__unix__', `define(`provided', incr(provided))') -dnl @result{} -ifdef(`__windows__', `define(`provided', incr(provided))') -dnl @result{} -ifdef(`__os2__', `define(`provided', incr(provided))') -dnl @result{} -provided -dnl @result{}1 diff -ruNp m4-1.4.6/checks/110.incr m4-1.4.7/checks/110.incr --- m4-1.4.6/checks/110.incr 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/110.incr 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3857: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +incr(`4') +dnl @result{}5 +decr(`7') +dnl @result{}6 +incr() +dnl @error{}m4:stdin:3: empty string treated as 0 in builtin `incr' +dnl @result{}1 +decr() +dnl @error{}m4:stdin:4: empty string treated as 0 in builtin `decr' +dnl @result{}-1 diff -ruNp m4-1.4.6/checks/110.syscmd m4-1.4.7/checks/110.syscmd --- m4-1.4.6/checks/110.syscmd 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/110.syscmd 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:3981: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `FOO') -dnl @result{} -syscmd(`echo foo') -dnl @result{}foo -dnl @result{} diff -ruNp m4-1.4.6/checks/111.esyscmd m4-1.4.7/checks/111.esyscmd --- m4-1.4.6/checks/111.esyscmd 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/111.esyscmd 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:4012: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `FOO') -dnl @result{} -esyscmd(`echo foo') -dnl @result{}FOO -dnl @result{} diff -ruNp m4-1.4.6/checks/111.eval m4-1.4.7/checks/111.eval --- m4-1.4.6/checks/111.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/111.eval 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,25 @@ +dnl @ ../doc/m4.texinfo:3949: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +eval(`-3 * 5') +dnl @result{}-15 +eval(index(`Hello world', `llo') >= 0) +dnl @result{}1 +eval(`0r1:0111 + 0b100 + 0r3:12') +dnl @result{}12 +define(`square', `eval(`('$1`)**2')') +dnl @result{} +square(`9') +dnl @result{}81 +square(square(`5')`+1') +dnl @result{}676 +define(`foo', `666') +dnl @result{} +eval(`foo/6') +dnl @error{}m4:stdin:8: bad expression in eval: foo/6 +dnl @result{} +eval(foo/6) +dnl @result{}111 diff -ruNp m4-1.4.6/checks/112.eval m4-1.4.7/checks/112.eval --- m4-1.4.6/checks/112.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/112.eval 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3982: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +eval(0x80000000 / -1) +dnl @result{}-2147483648 +eval(0x80000000 % -1) +dnl @result{}0 +eval(0x7fffffff) +dnl @result{}2147483647 +incr(eval(0x7fffffff)) +dnl @result{}-2147483648 +eval(-4 >> 33) +dnl @result{}-2 diff -ruNp m4-1.4.6/checks/112.sysval m4-1.4.7/checks/112.sysval --- m4-1.4.6/checks/112.sysval 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/112.sysval 1969-12-31 17:00:00.000000000 -0700 @@ -1,30 +0,0 @@ -dnl @ ../doc/m4.texinfo:4039: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -syscmd(`false') -dnl @result{} -ifelse(sysval, `0', `zero', `non-zero') -dnl @result{}non-zero -syscmd(`exit 2') -dnl @result{} -sysval -dnl @result{}2 -syscmd(`true') -dnl @result{} -sysval -dnl @result{}0 -esyscmd(`false') -dnl @result{} -ifelse(sysval, `0', `zero', `non-zero') -dnl @result{}non-zero -esyscmd(`exit 2') -dnl @result{} -sysval -dnl @result{}2 -esyscmd(`true') -dnl @result{} -sysval -dnl @result{}0 diff -ruNp m4-1.4.6/checks/113.eval m4-1.4.7/checks/113.eval --- m4-1.4.6/checks/113.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/113.eval 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:4006: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +eval(`666', `10') +dnl @result{}666 +eval(`666', `11') +dnl @result{}556 +eval(`666', `6') +dnl @result{}3030 +eval(`666', `6', `10') +dnl @result{}0000003030 +eval(`-666', `6', `10') +dnl @result{}-0000003030 +eval(`10', `', `0') +dnl @result{}10 +`0r1:'eval(`10', `1', `11') +dnl @result{}0r1:01111111111 +eval(`10', `16') +dnl @result{}a diff -ruNp m4-1.4.6/checks/113.sysval m4-1.4.7/checks/113.sysval --- m4-1.4.6/checks/113.sysval 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/113.sysval 1969-12-31 17:00:00.000000000 -0700 @@ -1,19 +0,0 @@ -dnl @ ../doc/m4.texinfo:4085: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -dnl This test assumes kill is a shell builtin, and that signals are -dnl recognizable. -ifdef(`__unix__', , - `errprint(` skipping: syscmd does not have unix semantics -')m4exit(`77')')dnl -syscmd(`kill -13 $$') -dnl @result{} -sysval -dnl @result{}3328 -esyscmd(`kill -9 $$') -dnl @result{} -sysval -dnl @result{}2304 diff -ruNp m4-1.4.6/checks/114.maketemp m4-1.4.7/checks/114.maketemp --- m4-1.4.6/checks/114.maketemp 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/114.maketemp 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:4134: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -dnl This test assumes /tmp is a valid directory name, which is not true -dnl for native Windows. -ifdef(`__unix__', , `errprint(` skipping: not sure /tmp exists -')m4exit(`77')')dnl -define(`file1', maketemp(`/tmp/fooXXXXXX'))dnl -define(`file2', maketemp(`/tmp/fooXXXXXX'))dnl -ifelse(file1, file2, `same', `different') -dnl @result{}different -syscmd(`rm 'file1 file2) -dnl @result{} -sysval -dnl @result{}0 diff -ruNp m4-1.4.6/checks/114.platform_m m4-1.4.7/checks/114.platform_m --- m4-1.4.6/checks/114.platform_m 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/114.platform_m 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:4079: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +__gnu__ +dnl @result{} +ifdef(`__gnu__', `Extensions are active') +dnl @result{}Extensions are active diff -ruNp m4-1.4.6/checks/115.errprint m4-1.4.7/checks/115.errprint --- m4-1.4.6/checks/115.errprint 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/115.errprint 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:4178: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -errprint(`Invalid arguments to forloop -') -dnl @error{}Invalid arguments to forloop -dnl @result{} diff -ruNp m4-1.4.6/checks/115.platform_m m4-1.4.7/checks/115.platform_m --- m4-1.4.6/checks/115.platform_m 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/115.platform_m 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:4100: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`provided', `0') +dnl @result{} +ifdef(`__unix__', `define(`provided', incr(provided))') +dnl @result{} +ifdef(`__windows__', `define(`provided', incr(provided))') +dnl @result{} +ifdef(`__os2__', `define(`provided', incr(provided))') +dnl @result{} +provided +dnl @result{}1 diff -ruNp m4-1.4.6/checks/116.location m4-1.4.7/checks/116.location --- m4-1.4.6/checks/116.location 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/116.location 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:4205: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -errprint(__program__:__file__:__line__: `input error -') -dnl @error{}m4:stdin:1: input error -dnl @result{} diff -ruNp m4-1.4.6/checks/116.syscmd m4-1.4.7/checks/116.syscmd --- m4-1.4.6/checks/116.syscmd 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/116.syscmd 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:4133: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `FOO') +dnl @result{} +syscmd(`echo foo') +dnl @result{}foo +dnl @result{} diff -ruNp m4-1.4.6/checks/117.location m4-1.4.7/checks/117.location --- m4-1.4.6/checks/117.location 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/117.location 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:4224: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', ``$0' called at __file__:__line__') -dnl @result{} -foo -dnl @result{}foo called at stdin:2 -include(`incl.m4') -dnl @result{}Include file start -dnl @result{}foo called at ../examples/incl.m4:2 -dnl @result{}Include file end -dnl @result{} diff -ruNp m4-1.4.6/checks/117.syscmd m4-1.4.7/checks/117.syscmd --- m4-1.4.6/checks/117.syscmd 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/117.syscmd 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,8 @@ +dnl @ ../doc/m4.texinfo:4167: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +m4wrap(`syscmd(`cat')') +dnl @result{} diff -ruNp m4-1.4.6/checks/118.esyscmd m4-1.4.7/checks/118.esyscmd --- m4-1.4.6/checks/118.esyscmd 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/118.esyscmd 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:4194: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `FOO') +dnl @result{} +esyscmd(`echo foo') +dnl @result{}FOO +dnl @result{} diff -ruNp m4-1.4.6/checks/118.m4exit m4-1.4.7/checks/118.m4exit --- m4-1.4.6/checks/118.m4exit 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/118.m4exit 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:4274: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`fatal_error', - `errprint(__program__:__file__:__line__`: fatal error: $* -')m4exit(`1')') -dnl @result{} -fatal_error(`this is a BAD one, buster') -dnl @error{}m4:stdin:4: fatal error: this is a BAD one, buster diff -ruNp m4-1.4.6/checks/119.m4exit m4-1.4.7/checks/119.m4exit --- m4-1.4.6/checks/119.m4exit 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/119.m4exit 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:4290: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -m4wrap(`This text is lost to `m4exit'.') -dnl @result{} -divert(`1') And so is this. -divert -dnl @result{} -m4exit diff -ruNp m4-1.4.6/checks/119.sysval m4-1.4.7/checks/119.sysval --- m4-1.4.6/checks/119.sysval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/119.sysval 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,30 @@ +dnl @ ../doc/m4.texinfo:4224: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +syscmd(`false') +dnl @result{} +ifelse(sysval, `0', `zero', `non-zero') +dnl @result{}non-zero +syscmd(`exit 2') +dnl @result{} +sysval +dnl @result{}2 +syscmd(`true') +dnl @result{} +sysval +dnl @result{}0 +esyscmd(`false') +dnl @result{} +ifelse(sysval, `0', `zero', `non-zero') +dnl @result{}non-zero +esyscmd(`exit 2') +dnl @result{} +sysval +dnl @result{}2 +esyscmd(`true') +dnl @result{} +sysval +dnl @result{}0 diff -ruNp m4-1.4.6/checks/120.extensions m4-1.4.7/checks/120.extensions --- m4-1.4.6/checks/120.extensions 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/120.extensions 1969-12-31 17:00:00.000000000 -0700 @@ -1,23 +0,0 @@ -dnl @ ../doc/m4.texinfo:4528: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`a1', `A1') -dnl @result{} -dnl First argument, concatenated with 1 -define(`_1', `$1')define(`first1', `_1($@)1') -dnl @result{} -dnl Eleventh argument, portable -define(`_9', `$9')define(`eleventh', `_9(shift(shift($@)))') -dnl @result{} -dnl Eleventh argument, GNU style -define(`Eleventh', `$11') -dnl @result{} -first1(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') -dnl @result{}A1 -eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') -dnl @result{}k -Eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') -dnl @result{}k diff -ruNp m4-1.4.6/checks/120.sysval m4-1.4.7/checks/120.sysval --- m4-1.4.6/checks/120.sysval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/120.sysval 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,19 @@ +dnl @ ../doc/m4.texinfo:4270: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +dnl This test assumes kill is a shell builtin, and that signals are +dnl recognizable. +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +syscmd(`kill -13 $$') +dnl @result{} +sysval +dnl @result{}3328 +esyscmd(`kill -9 $$') +dnl @result{} +sysval +dnl @result{}2304 diff -ruNp m4-1.4.6/checks/121.incompatib m4-1.4.7/checks/121.incompatib --- m4-1.4.6/checks/121.incompatib 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/121.incompatib 1969-12-31 17:00:00.000000000 -0700 @@ -1,23 +0,0 @@ -dnl @ ../doc/m4.texinfo:4641: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -undivert(`wrapfifo.m4')dnl -dnl @result{}dnl Redefine m4wrap to have FIFO semantics. -dnl @result{}define(`_m4wrap_level', `0')dnl -dnl @result{}define(`m4wrap', -dnl @result{}`ifdef(`m4wrap'_m4wrap_level, -dnl @result{} `define(`m4wrap'_m4wrap_level, -dnl @result{} defn(`m4wrap'_m4wrap_level)`$1')', -dnl @result{} `builtin(`m4wrap', `define(`_m4wrap_level', -dnl @result{} incr(_m4wrap_level))dnl -dnl @result{}m4wrap'_m4wrap_level)dnl -dnl @result{}define(`m4wrap'_m4wrap_level, `$1')')')dnl -include(`wrapfifo.m4') -dnl @result{} -m4wrap(`a`'m4wrap(`c -', `d')')m4wrap(`b') -dnl @result{} -dnl @result{}abc diff -ruNp m4-1.4.6/checks/121.maketemp m4-1.4.7/checks/121.maketemp --- m4-1.4.6/checks/121.maketemp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/121.maketemp 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:4322: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +dnl This test assumes /tmp is a valid directory name, which is not true +dnl for native Windows. +ifdef(`__unix__', , `errprint(` skipping: not sure /tmp exists +')m4exit(`77')')dnl +define(`file1', maketemp(`/tmp/fooXXXXXX'))dnl +define(`file2', maketemp(`/tmp/fooXXXXXX'))dnl +ifelse(file1, file2, `same', `different') +dnl @result{}different +syscmd(`rm 'file1 file2) +dnl @result{} +sysval +dnl @result{}0 diff -ruNp m4-1.4.6/checks/122.answers m4-1.4.7/checks/122.answers --- m4-1.4.6/checks/122.answers 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/122.answers 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:4825: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`exch', ``$2', `$1'') -dnl @result{} -define(exch(`expansion text', `macro')) -dnl @result{} -macro -dnl @result{}expansion text diff -ruNp m4-1.4.6/checks/122.errprint m4-1.4.7/checks/122.errprint --- m4-1.4.6/checks/122.errprint 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/122.errprint 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:4366: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +errprint(`Invalid arguments to forloop +') +dnl @error{}Invalid arguments to forloop +dnl @result{} diff -ruNp m4-1.4.6/checks/123.answers m4-1.4.7/checks/123.answers --- m4-1.4.6/checks/123.answers 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/123.answers 1969-12-31 17:00:00.000000000 -0700 @@ -1,28 +0,0 @@ -dnl @ ../doc/m4.texinfo:4840: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`cleardivert', - `pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') -dnl @result{} -divert(`1')one -divert -dnl @result{} -cleardivert -dnl @result{} -undivert -dnl @result{}one -dnl @result{} -define(`cleardivert', - `pushdef(`_num', divnum)divert(`-1')ifelse(`$#', `0', - `undivert`'', `undivert($@)')divert(_num)popdef(`_num')') -dnl @result{} -divert(`2')two -divert -dnl @result{} -cleardivert -dnl @result{} -undivert -dnl @result{} diff -ruNp m4-1.4.6/checks/123.location m4-1.4.7/checks/123.location --- m4-1.4.6/checks/123.location 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/123.location 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:4393: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +errprint(__program__:__file__:__line__: `input error +') +dnl @error{}m4:stdin:1: input error +dnl @result{} diff -ruNp m4-1.4.6/checks/124.answers m4-1.4.7/checks/124.answers --- m4-1.4.6/checks/124.answers 2006-08-24 12:08:26.000000000 -0600 +++ m4-1.4.7/checks/124.answers 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:4873: Origin of test -dnl @ Copyright (C) 2006 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`fatal_error', - `errprint(__program__:ifelse(__line__, `0', `', - `__file__:__line__:')` fatal error: $* -')m4exit(`1')') -dnl @result{} -m4wrap(`divnum(`demo of internal message') -fatal_error(`inside wrapped text')') -dnl @result{} -dnl @error{}m4: Warning: excess arguments to builtin `divnum' ignored -dnl @result{}0 -dnl @error{}m4: fatal error: inside wrapped text diff -ruNp m4-1.4.6/checks/124.location m4-1.4.7/checks/124.location --- m4-1.4.6/checks/124.location 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/124.location 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:4412: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', ``$0' called at __file__:__line__') +dnl @result{} +foo +dnl @result{}foo called at stdin:2 +include(`incl.m4') +dnl @result{}Include file start +dnl @result{}foo called at ../examples/incl.m4:2 +dnl @result{}Include file end +dnl @result{} diff -ruNp m4-1.4.6/checks/125.m4exit m4-1.4.7/checks/125.m4exit --- m4-1.4.6/checks/125.m4exit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/125.m4exit 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:4462: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`fatal_error', + `errprint(__program__:__file__:__line__`: fatal error: $* +')m4exit(`1')') +dnl @result{} +fatal_error(`this is a BAD one, buster') +dnl @error{}m4:stdin:4: fatal error: this is a BAD one, buster diff -ruNp m4-1.4.6/checks/126.m4exit m4-1.4.7/checks/126.m4exit --- m4-1.4.6/checks/126.m4exit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/126.m4exit 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:4478: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +m4wrap(`This text is lost to `m4exit'.') +dnl @result{} +divert(`1') And so is this. +divert +dnl @result{} +m4exit diff -ruNp m4-1.4.6/checks/127.extensions m4-1.4.7/checks/127.extensions --- m4-1.4.6/checks/127.extensions 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/127.extensions 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,23 @@ +dnl @ ../doc/m4.texinfo:4721: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`a1', `A1') +dnl @result{} +dnl First argument, concatenated with 1 +define(`_1', `$1')define(`first1', `_1($@)1') +dnl @result{} +dnl Eleventh argument, portable +define(`_9', `$9')define(`eleventh', `_9(shift(shift($@)))') +dnl @result{} +dnl Eleventh argument, GNU style +define(`Eleventh', `$11') +dnl @result{} +first1(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') +dnl @result{}A1 +eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') +dnl @result{}k +Eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') +dnl @result{}k diff -ruNp m4-1.4.6/checks/128.incompatib m4-1.4.7/checks/128.incompatib --- m4-1.4.6/checks/128.incompatib 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/128.incompatib 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,23 @@ +dnl @ ../doc/m4.texinfo:4839: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +undivert(`wrapfifo.m4')dnl +dnl @result{}dnl Redefine m4wrap to have FIFO semantics. +dnl @result{}define(`_m4wrap_level', `0')dnl +dnl @result{}define(`m4wrap', +dnl @result{}`ifdef(`m4wrap'_m4wrap_level, +dnl @result{} `define(`m4wrap'_m4wrap_level, +dnl @result{} defn(`m4wrap'_m4wrap_level)`$1')', +dnl @result{} `builtin(`m4wrap', `define(`_m4wrap_level', +dnl @result{} incr(_m4wrap_level))dnl +dnl @result{}m4wrap'_m4wrap_level)dnl +dnl @result{}define(`m4wrap'_m4wrap_level, `$1')')')dnl +include(`wrapfifo.m4') +dnl @result{} +m4wrap(`a`'m4wrap(`c +', `d')')m4wrap(`b') +dnl @result{} +dnl @result{}abc diff -ruNp m4-1.4.6/checks/129.answers m4-1.4.7/checks/129.answers --- m4-1.4.6/checks/129.answers 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/129.answers 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:5023: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`exch', ``$2', `$1'') +dnl @result{} +define(exch(`expansion text', `macro')) +dnl @result{} +macro +dnl @result{}expansion text diff -ruNp m4-1.4.6/checks/130.answers m4-1.4.7/checks/130.answers --- m4-1.4.6/checks/130.answers 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/130.answers 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,28 @@ +dnl @ ../doc/m4.texinfo:5038: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`cleardivert', + `pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') +dnl @result{} +divert(`1')one +divert +dnl @result{} +cleardivert +dnl @result{} +undivert +dnl @result{}one +dnl @result{} +define(`cleardivert', + `pushdef(`_num', divnum)divert(`-1')ifelse(`$#', `0', + `undivert`'', `undivert($@)')divert(_num)popdef(`_num')') +dnl @result{} +divert(`2')two +divert +dnl @result{} +cleardivert +dnl @result{} +undivert +dnl @result{} diff -ruNp m4-1.4.6/checks/131.answers m4-1.4.7/checks/131.answers --- m4-1.4.6/checks/131.answers 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/checks/131.answers 2006-09-23 22:33:20.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:5071: Origin of test +dnl @ Copyright (C) 2006 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`fatal_error', + `errprint(__program__:ifelse(__line__, `0', `', + `__file__:__line__:')` fatal error: $* +')m4exit(`1')') +dnl @result{} +m4wrap(`divnum(`demo of internal message') +fatal_error(`inside wrapped text')') +dnl @result{} +dnl @error{}m4: Warning: excess arguments to builtin `divnum' ignored +dnl @result{}0 +dnl @error{}m4: fatal error: inside wrapped text diff -ruNp m4-1.4.6/checks/check-them m4-1.4.7/checks/check-them --- m4-1.4.6/checks/check-them 2006-08-22 12:07:42.000000000 -0600 +++ m4-1.4.7/checks/check-them 2006-09-07 07:08:54.000000000 -0600 @@ -8,7 +8,7 @@ m4 --version # Clean up temp files on exit pwd=`pwd` tmp=m4-tmp.$$ -trap 'stat=$?; cd $pwd; rm -rf $tmp && exit $stat' 0 +trap 'stat=$?; cd "$pwd"; rm -rf $tmp && exit $stat' 0 trap '(exit $?); exit $?' 1 2 13 15 # Create scratch dir @@ -26,11 +26,22 @@ xout=$tmp/m4-xout xerr=$tmp/m4-xerr failed= skipped= +strip_needed=false # Find out how the executable prints argv[0] m4=`m4 --help | sed -e 's/Usage: \(.*\) \[OPTION.*/\1/' \ -e 's/\\\\/\\\\\\\\/g' -e 1q` +# Find out if we should strip \r in the output +m4 --version > $out +m4 --version | tr -d '\015' > $xout +if cmp -s $out $xout; then + : +else + echo "Ignoring carriage returns" + strip_needed=: +fi + # Find out where the examples live. examples=. if test "x$1" = x-I ; then @@ -57,6 +68,19 @@ do sed -e '/^dnl @result{}/!d' -e 's///' -e "s|\.\./examples|$examples|" \ "$file" > $xout + sed -e '/^dnl @error{}/!d' -e 's///' -e "s|^m4:|$m4:|" "$file" > $xerr + + # For the benefit of mingw, normalize \r\n line endings + if $strip_needed ; then + tr -d '\015' < $out > $out.t + mv $out.t $out + tr -d '\015' < $xout > $xout.t + mv $xout.t $xout + tr -d '\015' < $err > $err.t + mv $err.t $err + tr -d '\015' < $xerr > $xerr.t + mv $xerr.t $xerr + fi if cmp -s $out $xout; then : @@ -67,8 +91,6 @@ do diff $xout $out fi - sed -e '/^dnl @error{}/!d' -e 's///' -e "s|^m4:|$m4:|" "$file" > $xerr - if cmp -s $err $xerr; then : else diff -ruNp m4-1.4.6/config-h.in m4-1.4.7/config-h.in --- m4-1.4.6/config-h.in 2006-08-24 11:47:26.000000000 -0600 +++ m4-1.4.7/config-h.in 2006-09-25 06:07:51.000000000 -0600 @@ -193,9 +193,6 @@ /* Define to 1 if you have the `mempcpy' function. */ #undef HAVE_MEMPCPY -/* Define to 1 if you have the `mkstemp' function. */ -#undef HAVE_MKSTEMP - /* Define to 1 if libc includes obstacks. */ #undef HAVE_OBSTACK @@ -427,11 +424,17 @@ # undef _ALL_SOURCE #endif +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + /* Define to 1 if on MINIX. */ #undef _MINIX @@ -457,6 +460,9 @@ used. */ #undef __GETOPT_PREFIX +/* Define to rpl_ if the mkstemp replacement function should be used. */ +#undef __MKSTEMP_PREFIX + /* Define to rpl_free if the replacement function should be used. */ #undef free @@ -478,9 +484,6 @@ /* Define to a type if does not define. */ #undef mbstate_t -/* Define to rpl_mkstemp if the replacement function should be used. */ -#undef mkstemp - /* Define to rpl_re_comp if the replacement should be used. */ #undef re_comp diff -ruNp m4-1.4.6/config.sub m4-1.4.7/config.sub --- m4-1.4.6/config.sub 2006-08-24 11:47:48.000000000 -0600 +++ m4-1.4.7/config.sub 2006-09-25 06:08:01.000000000 -0600 @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. -timestamp='2006-08-14' +timestamp='2006-09-20' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -276,6 +276,7 @@ case $basic_machine in | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ + | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ @@ -1370,6 +1371,9 @@ else # system, and we'll never get to this point. case $basic_machine in + score-*) + os=-elf + ;; spu-*) os=-elf ;; diff -ruNp m4-1.4.6/configure m4-1.4.7/configure --- m4-1.4.6/configure 2006-08-24 11:47:17.000000000 -0600 +++ m4-1.4.7/configure 2006-09-25 06:07:43.000000000 -0600 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.60 for GNU M4 1.4.6. +# Generated by GNU Autoconf 2.60 for GNU M4 1.4.7. # # Report bugs to . # @@ -559,8 +559,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='GNU M4' PACKAGE_TARNAME='m4' -PACKAGE_VERSION='1.4.6' -PACKAGE_STRING='GNU M4 1.4.6' +PACKAGE_VERSION='1.4.7' +PACKAGE_STRING='GNU M4 1.4.7' PACKAGE_BUGREPORT='bug-m4@gnu.org' ac_unique_file="src/m4.h" @@ -722,6 +722,8 @@ ABSOLUTE_SYS_STAT_H SYS_STAT_H UNISTD_H EOVERFLOW +LIBM4_LIBDEPS +LIBM4_LTLIBDEPS STACKOVF_TRUE STACKOVF_FALSE LTLIBOBJS' @@ -1236,7 +1238,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures GNU M4 1.4.6 to adapt to many kinds of systems. +\`configure' configures GNU M4 1.4.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1306,7 +1308,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of GNU M4 1.4.6:";; + short | recursive ) echo "Configuration of GNU M4 1.4.7:";; esac cat <<\_ACEOF @@ -1315,6 +1317,7 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors + --disable-largefile omit support for large files --enable-changeword enable -W and changeword() builtin Optional Packages: @@ -1400,7 +1403,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -GNU M4 configure 1.4.6 +GNU M4 configure 1.4.7 generated by GNU Autoconf 2.60 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1414,7 +1417,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by GNU M4 $as_me 1.4.6, which was +It was created by GNU M4 $as_me 1.4.7, which was generated by GNU Autoconf 2.60. Invocation command line was $ $0 $@ @@ -2106,7 +2109,7 @@ fi # Define the identity of the package. PACKAGE='m4' - VERSION='1.4.6' + VERSION='1.4.7' cat >>confdefs.h <<_ACEOF @@ -6839,6 +6842,456 @@ _ACEOF fi +# Check whether --enable-largefile was given. +if test "${enable_largefile+set}" = set; then + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5 +echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6; } +if test "${ac_cv_sys_largefile_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + CC="$CC -n32" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_largefile_CC=' -n32'; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5 +echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6; } +if test "${ac_cv_sys_file_offset_bits+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + while :; do + ac_cv_sys_file_offset_bits=no + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_file_offset_bits=64; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + break +done +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5 +echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6; } +if test "$ac_cv_sys_file_offset_bits" != no; then + +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +_ACEOF + +fi +rm -f conftest* + { echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5 +echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6; } +if test "${ac_cv_sys_large_files+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + while :; do + ac_cv_sys_large_files=no + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_large_files=1; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + break +done +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5 +echo "${ECHO_T}$ac_cv_sys_large_files" >&6; } +if test "$ac_cv_sys_large_files" != no; then + +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF + +fi +rm -f conftest* +fi + + + { echo "$as_me:$LINENO: checking for C/C++ restrict keyword" >&5 @@ -6949,7 +7402,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -char* cs = nl_langinfo(CODESET); +char* cs = nl_langinfo(CODESET); return !cs; ; return 0; } @@ -7018,8 +7471,6 @@ _ACEOF - - { echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5 echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6; } if test "${ac_cv_header_stat_broken+set}" = set; then @@ -9105,7 +9556,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -signed char x; +signed char x; return !x; ; return 0; } @@ -9674,6 +10125,10 @@ else GL_COND_LIBTOOL_FALSE= fi + gl_cond_libtool=false + gl_libdeps= + gl_ltlibdeps= + gl_source_base='lib' @@ -11145,161 +11600,46 @@ done fi -for ac_func in mkstemp -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + + + { echo "$as_me:$LINENO: checking for working mkstemp" >&5 +echo $ECHO_N "checking for working mkstemp... $ECHO_C" >&6; } +if test "${gl_cv_func_working_mkstemp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + + mkdir conftest.mkstemp + if test "$cross_compiling" = yes; then + gl_cv_func_working_mkstemp=no +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - +$ac_includes_default int main () { -return $ac_func (); +int i; + off_t large = (off_t) 4294967295u; + if (large < 0) + large = 2147483647; + for (i = 0; i < 70; i++) + { + char template[] = "conftest.mkstemp/coXXXXXX"; + int (*mkstemp_function) (char *) = mkstemp; + int fd = mkstemp_function (template); + if (fd < 0 || lseek (fd, large, SEEK_SET) != large) + return 1; + close (fd); + } + return 0; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi - -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -else - case " $LIBOBJS " in - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" - ;; -esac - -fi -done - - - if test $ac_cv_func_mkstemp = no; then - gl_cv_func_mkstemp_limitations=yes - else - { echo "$as_me:$LINENO: checking for mkstemp limitations" >&5 -echo $ECHO_N "checking for mkstemp limitations... $ECHO_C" >&6; } -if test "${gl_cv_func_mkstemp_limitations+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - mkdir conftest.mkstemp - if test "$cross_compiling" = yes; then - gl_cv_func_mkstemp_limitations=yes - -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -# include -# include - int main () - { - int i; - for (i = 0; i < 70; i++) - { - char template[] = "conftest.mkstemp/coXXXXXX"; - int fd = mkstemp (template); - if (fd == -1) - exit (1); - close (fd); - } - exit (0); - } - -_ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in @@ -11320,28 +11660,31 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_mkstemp_limitations=no + gl_cv_func_working_mkstemp=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_mkstemp_limitations=yes +gl_cv_func_working_mkstemp=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - rm -rf conftest.mkstemp - + rm -rf conftest.mkstemp fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_mkstemp_limitations" >&5 -echo "${ECHO_T}$gl_cv_func_mkstemp_limitations" >&6; } - fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_working_mkstemp" >&5 +echo "${ECHO_T}$gl_cv_func_working_mkstemp" >&6; } + + if test $gl_cv_func_working_mkstemp != yes; then + +cat >>confdefs.h <<\_ACEOF +#define __MKSTEMP_PREFIX rpl_ +_ACEOF - if test $gl_cv_func_mkstemp_limitations = yes; then case " $LIBOBJS " in *" mkstemp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" @@ -11355,11 +11698,6 @@ esac esac -cat >>confdefs.h <<\_ACEOF -#define mkstemp rpl_mkstemp -_ACEOF - - @@ -11566,6 +11904,13 @@ fi + + + + + + + # Check whether --with-included-regex was given. if test "${with_included_regex+set}" = set; then withval=$with_included_regex; @@ -11596,6 +11941,9 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + #if HAVE_LOCALE_H + #include + #endif #include #include @@ -11607,6 +11955,33 @@ static struct re_pattern_buffer regex; int i; const char *s; struct re_registers regs; + + #if HAVE_LOCALE_H + /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html + This test needs valgrind to catch the bug on Debian + GNU/Linux 3.1 x86, but it might catch the bug better + on other platforms and it shouldn't hurt to try the + test here. */ + if (setlocale (LC_ALL, "en_US.UTF-8")) + { + static char const pat[] = "insert into"; + static char const data[] = + "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK"; + re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE + | RE_ICASE); + memset (®ex, 0, sizeof regex); + s = re_compile_pattern (pat, sizeof pat - 1, ®ex); + if (s) + return 1; + if (re_search (®ex, data, sizeof data - 1, + 0, sizeof data - 1, ®s) + != -1) + return 1; + if (! setlocale (LC_ALL, "C")) + return 1; + } + #endif + re_set_syntax (RE_SYNTAX_POSIX_EGREP); memset (®ex, 0, sizeof (regex)); for (i = 0; i <= UCHAR_MAX; i++) @@ -11831,8 +12206,6 @@ esac - - { echo "$as_me:$LINENO: checking whether isblank is declared" >&5 echo $ECHO_N "checking whether isblank is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_isblank+set}" = set; then @@ -15758,6 +16131,9 @@ esac + + + fi @@ -16074,6 +16450,10 @@ done + LIBM4_LIBDEPS="$gl_libdeps" + + LIBM4_LTLIBDEPS="$gl_ltlibdeps" + # Code from Jim Avera . @@ -17034,7 +17414,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by GNU M4 $as_me 1.4.6, which was +This file was extended by GNU M4 $as_me 1.4.7, which was generated by GNU Autoconf 2.60. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17087,7 +17467,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -GNU M4 config.status 1.4.6 +GNU M4 config.status 1.4.7 configured by $0, generated by GNU Autoconf 2.60, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -17432,12 +17812,14 @@ ABSOLUTE_SYS_STAT_H!$ABSOLUTE_SYS_STAT_H SYS_STAT_H!$SYS_STAT_H$ac_delim UNISTD_H!$UNISTD_H$ac_delim EOVERFLOW!$EOVERFLOW$ac_delim +LIBM4_LIBDEPS!$LIBM4_LIBDEPS$ac_delim +LIBM4_LTLIBDEPS!$LIBM4_LTLIBDEPS$ac_delim STACKOVF_TRUE!$STACKOVF_TRUE$ac_delim STACKOVF_FALSE!$STACKOVF_FALSE$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 26; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 28; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff -ruNp m4-1.4.6/configure.ac m4-1.4.7/configure.ac --- m4-1.4.6/configure.ac 2006-08-24 08:47:02.000000000 -0600 +++ m4-1.4.7/configure.ac 2006-09-25 06:04:42.000000000 -0600 @@ -18,7 +18,7 @@ # 02110-1301 USA AC_PREREQ([2.60]) -AC_INIT([GNU M4], [1.4.6], [bug-m4@gnu.org]) +AC_INIT([GNU M4], [1.4.7], [bug-m4@gnu.org]) AM_INIT_AUTOMAKE([1.9.6 dist-bzip2 gnu]) PACKAGE=$PACKAGE_TARNAME; AC_SUBST([PACKAGE]) VERSION=$PACKAGE_VERSION; AC_SUBST([VERSION]) diff -ruNp m4-1.4.6/doc/Makefile.in m4-1.4.7/doc/Makefile.in --- m4-1.4.6/doc/Makefile.in 2006-08-24 11:47:42.000000000 -0600 +++ m4-1.4.7/doc/Makefile.in 2006-09-25 06:07:58.000000000 -0600 @@ -141,6 +141,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIBM4_LIBDEPS = @LIBM4_LIBDEPS@ +LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ diff -ruNp m4-1.4.6/doc/fdl.texi m4-1.4.7/doc/fdl.texi --- m4-1.4.6/doc/fdl.texi 2006-08-24 11:35:59.000000000 -0600 +++ m4-1.4.7/doc/fdl.texi 2006-09-23 22:28:32.000000000 -0600 @@ -408,7 +408,7 @@ as a draft) by the Free Software Foundat @end enumerate @page -@appendixsubsec ADDENDUM: How to use this License for your documents +@heading ADDENDUM: How to use this License for your documents To use this License in a document you have written, include a copy of the License in the document and put the following copyright and diff -ruNp m4-1.4.6/doc/m4.1 m4-1.4.7/doc/m4.1 --- m4-1.4.6/doc/m4.1 2006-08-24 12:20:43.000000000 -0600 +++ m4-1.4.7/doc/m4.1 2006-09-25 06:10:11.000000000 -0600 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35. -.TH M4 "1" "August 2006" "FSF" "User Commands" +.TH M4 "1" "September 2006" "FSF" "User Commands" .SH NAME M4 \- macro processor .SH SYNOPSIS @@ -22,7 +22,7 @@ output version information and exit \fB\-E\fR, \fB\-\-fatal\-warnings\fR stop execution after first warning .TP -\fB\-e\fR, \fB\-\-interactive\fR +\fB\-i\fR, \fB\-\-interactive\fR unbuffer output, ignore interrupts .TP \fB\-P\fR, \fB\-\-prefix\-builtins\fR @@ -33,7 +33,7 @@ suppress some warnings for builtins .SS "Preprocessor features:" .TP \fB\-D\fR, \fB\-\-define=NAME\fR[=\fIVALUE\fR] -define NAME has having VALUE, or empty +define NAME as having VALUE, or empty .TP \fB\-I\fR, \fB\-\-include\fR=\fIDIRECTORY\fR append DIRECTORY to include path @@ -65,14 +65,14 @@ reload a frozen state from FILE at start \fB\-d\fR, \fB\-\-debug\fR[=\fIFLAGS\fR] set debug level (no FLAGS implies `aeq') .TP +\fB\-\-debugfile\fR=\fIFILE\fR +redirect debug and trace output +.TP \fB\-l\fR, \fB\-\-arglength\fR=\fINUM\fR restrict macro tracing size .TP -\fB\-o\fR, \fB\-\-error\-output\fR=\fIFILE\fR -redirect debug and trace output -.TP \fB\-t\fR, \fB\-\-trace\fR=\fINAME\fR -trace NAME when it will be defined +trace NAME when it is defined .SS "FLAGS is any of:" .TP a diff -ruNp m4-1.4.6/doc/m4.info m4-1.4.7/doc/m4.info --- m4-1.4.6/doc/m4.info 2006-08-24 21:29:24.000000000 -0600 +++ m4-1.4.7/doc/m4.info 2006-09-25 06:10:42.000000000 -0600 @@ -1,8 +1,7 @@ -This is m4.info, produced by makeinfo version 4.8 from -/home/eblake/m4-patch/doc/m4.texinfo. +This is m4.info, produced by makeinfo version 4.8 from m4.texinfo. - This manual is for GNU M4 (version 1.4.6, 24 August 2006), a package -containing an implementation of the m4 macro language. + This manual is for GNU M4 (version 1.4.7, 23 September 2006), a +package containing an implementation of the m4 macro language. Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006 Free Software Foundation, Inc. @@ -25,7 +24,7 @@ File: m4.info, Node: Top, Next: Prelim GNU M4 ****** -This manual is for GNU M4 (version 1.4.6, 24 August 2006), a package +This manual is for GNU M4 (version 1.4.7, 23 September 2006), a package containing an implementation of the m4 macro language. Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006 @@ -50,7 +49,7 @@ changes by Franc,ois Pinard and other vo names and email addresses can be found in the files `AUTHORS' and `THANKS' from the GNU M4 distribution. - This is release 1.4.6. It is now considered stable: future + This is release 1.4.7. It is now considered stable: future releases in the 1.4.x series are only meant to fix bugs, increase speed, or improve documentation. However... @@ -84,7 +83,7 @@ will go away and _you should not count o * Miscellaneous:: Miscellaneous builtin macros * Frozen files:: Fast loading of frozen state -* Compatibility:: Compatibility with other versions of m4 +* Compatibility:: Compatibility with other versions of `m4' * Answers:: Correct version of some examples * Copying This Manual:: How to make copies of this manual * Indices:: Indices of concepts and macros @@ -102,10 +101,10 @@ Introduction and preliminaries Lexical and syntactic conventions * Names:: Macro names -* Quoted strings:: Quoting input to m4 -* Comments:: Comments in m4 input +* Quoted strings:: Quoting input to `m4' +* Comments:: Comments in `m4' input * Other tokens:: Other kinds of input tokens -* Input processing:: How m4 copies input to output +* Input processing:: How `m4' copies input to output How to invoke macros @@ -119,7 +118,7 @@ How to define new macros * Define:: Defining a new macro * Arguments:: Arguments to macros -* Pseudo Arguments:: Pseudo arguments to macros +* Pseudo Arguments:: Special arguments to macros * Undefine:: Deleting a macro * Defn:: Renaming macros * Pushdef:: Temporarily redefining macros @@ -146,7 +145,7 @@ Input control * Changequote:: Changing the quote characters * Changecom:: Changing the comment delimiters * Changeword:: Changing the lexical structure of words -* M4wrap:: Saving input until end of input +* M4wrap:: Saving text until end of input File inclusion @@ -175,19 +174,19 @@ Macros for doing arithmetic * Incr:: Decrement and increment operators * Eval:: Evaluating integer expressions -Running shell commands +Macros for running shell commands * Platform macros:: Determining the platform * Syscmd:: Executing simple commands * Esyscmd:: Reading the output of commands * Sysval:: Exit status -* Maketemp:: Making names for temporary files +* Maketemp:: Making temporary files Miscellaneous builtin macros * Errprint:: Printing error messages * Location:: Printing current location -* M4exit:: Exiting from m4 +* M4exit:: Exiting from `m4' Fast loading of frozen state @@ -200,14 +199,14 @@ Compatibility with other versions of `m4 * Incompatibilities:: Facilities in System V m4 not in GNU M4 * Other Incompatibilities:: Other incompatibilities -Copying This Manual +How to make copies of this manual * GNU Free Documentation License:: License for copying this manual -Indices +Indices of concepts and macros * Concept index:: Index for many concepts -* Macro index:: Index for all m4 macros +* Macro index:: Index for all `m4' macros  File: m4.info, Node: Preliminaries, Next: Syntax, Prev: Top, Up: Top @@ -314,7 +313,7 @@ addressed some long standing bugs in the in 2005 Gary V. Vaughan collected together the many patches to GNU `m4' 1.4 that were floating around the net and released 1.4.3 and 1.4.4. And in 2006, Eric Blake joined the team and prepared patches for the -release of 1.4.5 and 1.4.6. +release of 1.4.5, 1.4.6, and 1.4.7. Meanwhile, development has continued on new features for `m4', such as dynamic module loading and additional builtins. When complete, GNU @@ -330,13 +329,32 @@ The format of the `m4' command is: `m4' [OPTION...] [FILE...] - All options begin with `-', or if long option names are used, with a + All options begin with `-', or if long option names are used, with `--'. A long option name need not be written completely, any -unambiguous prefix is sufficient. Options may be intermixed with files, -use `--' as a marker to denote the end of options. `m4' understands -the following options, grouped by functionality. +unambiguous prefix is sufficient. Unless `POSIXLY_CORRECT' is set in +the environment, options may be intermixed with files. The argument +`--' is a marker to denote the end of options. + + With short options, options that do not take arguments may be +combined into a single command line argument with subsequent options, +options with mandatory arguments may be provided either as a single +command line argument or as two arguments, and options with optional +arguments must be provided as a single argument. In other words, +without `POSIXLY_CORRECT', `m4 -QPDfoo -d a -d+f' is equivalent to `m4 +-Q -P -D foo -d -d+f -- a', although the latter form is considered +canonical. (With `POSIXLY_CORRECT', it is equivalent to `m4 -Q -P -D +foo -d -- a ./-d+f'). + + With long options, options with mandatory arguments may be provided +with an equal sign (`=') in a single argument, or as two arguments, and +options with optional arguments must be provided as a single argument. +In other words, `m4 --def foo --debug a' is equivalent to `m4 +--define=foo --debug= -- a', although the latter form is considered +canonical (not to mention more robust, in case a future version of `m4' +introduces an option named `--default'). - Several options control the overall operation of `m4': + `m4' understands the following options, grouped by functionality. +Several options control the overall operation of `m4': `--help' Print a help summary on standard output, then immediately exit @@ -351,10 +369,14 @@ the following options, grouped by functi Stop execution and exit `m4' once the first warning has been issued, considering all of them to be fatal. -`-e' +`-i' `--interactive' +`-e' Makes this invocation of `m4' interactive. This means that all - output will be unbuffered, and interrupts will be ignored. + output will be unbuffered, and interrupts will be ignored. The + spelling `-e' exists for compatibility with other `m4' + implementations, and issues a warning because it may be withdrawn + in a future version of GNU M4. `-P' `--prefix-builtins' @@ -467,14 +489,16 @@ only by your hardware constraints) in GN `-S NUM' `-T NUM' These options are present for compatibility with System V `m4', but - do nothing in this implementation. + do nothing in this implementation. They may disappear in future + releases, and issue a warning to that effect. `-N NUM' `--diversions=NUM' These options are present only for compatibility with previous versions of GNU `m4', and were controlling the number of possible diversions which could be used at the same time. They do nothing, - because there is no fixed limit anymore. + because there is no fixed limit anymore. They may disappear in + future releases, and issue a warning to that effect. GNU `m4' comes with a feature of freezing internal state (*note Frozen files::). This can be used to speed up `m4' execution when @@ -504,19 +528,24 @@ scripts. the format and meaning of FLAGS. If omitted, FLAGS defaults to `aeq'. -`-l NUM' -`--arglength=NUM' - Restrict the size of the output generated by macro tracing to NUM - characters per trace line. If unspecified or zero, output is - unlimited. *Note Debug Levels::, for more details. - +`--debugfile=FILE' `-o FILE' `--error-output=FILE' Redirect `dumpdef' output, debug messages, and trace output to the named FILE. Warnings, error messages, and `errprint' output are still printed to standard error. If unspecified, debug output goes to standard error; if empty, debug output is discarded. *Note - Debug Output::, for more details. + Debug Output::, for more details. The spellings `-o' and + `--error-output' are misleading and inconsistent with other GNU + tools; for now they are silently accepted as synonyms of + `--debugfile', but in a future version of M4, using them will + cause a warning to be issued. + +`-l NUM' +`--arglength=NUM' + Restrict the size of the output generated by macro tracing to NUM + characters per trace line. If unspecified or zero, output is + unlimited. *Note Debug Levels::, for more details. `-t NAME' `--trace=NAME' @@ -530,10 +559,12 @@ file names. If no names are present, th file name of `-' is taken to mean the standard input. It is conventional, but not required, for input files to end in `.m4'. - The input files are read in the sequence given. The standard input -can only be read once, so the file name `-' should only appear once on -the command line. It is an error if an input file ends in the middle of -argument collection, a comment, or a quoted string. + The input files are read in the sequence given. Standard input can +be read more than once, so the file name `-' may appear multiple times +on the command line; this makes a difference when input is from a +terminal or other special file type. It is an error if an input file +ends in the middle of argument collection, a comment, or a quoted +string. If none of the input files invoked `m4exit' (*note M4exit::), the exit status of `m4' will be 0 for success, 1 for general failure (such @@ -652,16 +683,16 @@ eight-bit clean, so you can use non-ASCI * Menu: * Names:: Macro names -* Quoted strings:: Quoting input to m4 -* Comments:: Comments in m4 input +* Quoted strings:: Quoting input to `m4' +* Comments:: Comments in `m4' input * Other tokens:: Other kinds of input tokens -* Input processing:: How m4 copies input to output +* Input processing:: How `m4' copies input to output  File: m4.info, Node: Names, Next: Quoted strings, Up: Syntax -2.1 Names -========= +2.1 Macro names +=============== A name is any sequence of letters, digits, and the character `_' (underscore), where the first character is not a digit. `m4' will use @@ -674,8 +705,8 @@ Names are case-sensitive.  File: m4.info, Node: Quoted strings, Next: Comments, Prev: Names, Up: Syntax -2.2 Quoted strings -================== +2.2 Quoting input to `m4' +========================= A quoted string is a sequence of characters surrounded by quote strings, defaulting to ``' and `'', where the nested begin and end @@ -696,8 +727,8 @@ macro `changequote'. *Note Changequote:  File: m4.info, Node: Comments, Next: Other tokens, Prev: Quoted strings, Up: Syntax -2.3 Comments -============ +2.3 Comments in `m4' input +========================== Comments in `m4' are normally delimited by the characters `#' and newline. All characters between the comment delimiters are ignored, @@ -720,8 +751,8 @@ information.  File: m4.info, Node: Other tokens, Next: Input processing, Prev: Comments, Up: Syntax -2.4 Other tokens -================ +2.4 Other kinds of input tokens +=============================== Any character, that is neither a part of a name, nor of a quoted string, nor a comment, is a token by itself. When not in the context of macro @@ -733,8 +764,8 @@ comma (`,'), and dollar (`$') have addit  File: m4.info, Node: Input processing, Prev: Other tokens, Up: Syntax -2.5 Input Processing -==================== +2.5 How `m4' copies input to output +=================================== As `m4' reads the input token by token, it will copy each token directly to the output immediately. @@ -844,10 +875,11 @@ call is not triggered. This solves the is recognized only with parameters" refers to this specific provision. There is also a command line option (`--prefix-builtins', or `-P', -*note Invoking m4::) which requires all builtin macro names to be -prefixed by `m4_' for them to be recognized. The option has no effect -whatsoever on user defined macros. For example, with this option, one -has to write `m4_dnl' and even `m4_m4exit'. +*note Invoking m4::) that renames all builtin macro with a prefix of +`m4_' at startup. The option has no effect whatsoever on user defined +macros. For example, with this option, one has to write `m4_dnl' and +even `m4_m4exit'. It also has no effect on whether a macro requires +parameters. Another alternative is to redefine problematic macros to a name less likely to cause conflicts, *Note Definitions::. @@ -941,8 +973,9 @@ leading whitespace is stripped off all a Normally `m4' will issue warnings if a builtin macro is called with an inappropriate number of arguments, but it can be suppressed with the -`-Q' command line option (*note Invoking m4::). For user defined -macros, there is no check of the number of arguments given. +`--quiet' command line option (or `--silent', or `-Q', *note Invoking +m4::). For user defined macros, there is no check of the number of +arguments given. Macros are expanded normally during argument collection, and whatever commas, quotes and parentheses that might show up in the resulting @@ -976,8 +1009,8 @@ effect at the time the opening `(' was s  File: m4.info, Node: Quoting Arguments, Next: Macro expansion, Prev: Macro Arguments, Up: Macros -3.4 Quoting macro arguments -=========================== +3.4 On Quoting Arguments to macros +================================== Each argument has leading unquoted whitespace removed. Within each argument, all unquoted parentheses must match. For example, if FOO is @@ -1001,7 +1034,8 @@ just makes life a bit harder, if you are this manual follows the rule of thumb that each layer of parentheses introduces another layer of single quoting, except when showing the consequences of quoting rules. This is done even when the quoted string -cannot be a macro, such as with integers. +cannot be a macro, such as with integers when you have not changed the +syntax via `changeword' (*note Changeword::).  File: m4.info, Node: Macro expansion, Prev: Quoting Arguments, Up: Macros @@ -1037,7 +1071,7 @@ value, and bring back the original value * Define:: Defining a new macro * Arguments:: Arguments to macros -* Pseudo Arguments:: Pseudo arguments to macros +* Pseudo Arguments:: Special arguments to macros * Undefine:: Deleting a macro * Defn:: Renaming macros * Pushdef:: Temporarily redefining macros @@ -1086,10 +1120,15 @@ redefine `one': one =>two + GNU `m4' normally replaces only the _topmost_ definition of a macro +if it has several definitions from `pushdef' (*note Pushdef::). Some +other implementations of `m4' replace all definitions of a macro with +`define'. *Note Incompatibilities::, for more details. + As a GNU extension, the first argument to `define' does not have to be a simple word. It can be any text string, even the empty string. A macro with a non-standard name cannot be invoked in the normal way, as -the name is not recognised. It can only be referenced by the builtins +the name is not recognized. It can only be referenced by the builtins *Note Indir:: and *Note Defn::. Arrays and associative arrays can be simulated by using this trick. @@ -1138,8 +1177,8 @@ to be reversed. =>expansion text *Note Quoting Arguments::, for an explanation of the double quotes. -(You should try and improve this example so that clients of exch do not -have to double quote. *note Answers::) +(You should try and improve this example so that clients of `exch' do +not have to double quote. *note Answers::) GNU `m4' allows the number following the `$' to consist of one or more digits, allowing macros to have any number of arguments. This is @@ -1234,7 +1273,7 @@ untouched to the macro, and that quoting define(`echo1', `$*') => - define(`echo2', `$)' + define(`echo2', `$@') => define(`foo', `bar') => @@ -1256,9 +1295,32 @@ text is. foo =>$$$ hello $$$ - If you want a macro to expand to something like `$12', put a pair of -quotes after the `$'. This will prevent `m4' from interpreting the `$' -sign as a reference to an argument. + If you want a macro to expand to something like `$12', the judicious +use of nested quoting can put a safe character between the `$' and the +next character, relying on the rescanning to remove the nested quote. +This will prevent `m4' from interpreting the `$' sign as a reference to +an argument. + + define(`foo', `no nested quote: $1') + => + foo(`arg') + =>no nested quote: arg + define(`foo', `nested quote around $: `$'1') + => + foo(`arg') + =>nested quote around $: $1 + define(`foo', `nested empty quote after $: $`'1') + => + foo(`arg') + =>nested empty quote after $: $1 + define(`foo', `nested quote around next character: $`1'') + => + foo(`arg') + =>nested quote around next character: $1 + define(`foo', `nested quote around both: `$1'') + => + foo(`arg') + =>nested quote around both: arg  File: m4.info, Node: Undefine, Next: Defn, Prev: Pseudo Arguments, Up: Definitions @@ -1320,8 +1382,8 @@ the builtin `defn': the quoted expansion text. If, instead, NAME is a builtin, the expansion is a special token, which points to the builtin's internal definition. This token is only meaningful as the second - argument to `define' (and `pushdef'), and is ignored in any other - context. + argument to `define' (and `pushdef'), and is silently converted to + an empty string in most other contexts. The macro `defn' is recognized only with parameters. @@ -1372,7 +1434,7 @@ end-quotes in macro definitions or argum => define(`a', `A') => - define(`echo', `$)' + define(`echo', `$@') => foo =>A'A @@ -1381,6 +1443,18 @@ end-quotes in macro definitions or argum echo(foo) =>AA' + Using `defn' to generate special tokens for builtin macros outside +of expected contexts can sometimes trigger warnings. But most of the +time, such tokens are silently converted to the empty string. + + defn(`defn') + => + define(defn(`divnum'), `cannot redefine a builtin token') + error-->m4:stdin:2: Warning: define: invalid macro name ignored + => + divnum + =>0 +  File: m4.info, Node: Pushdef, Next: Indir, Prev: Defn, Up: Definitions @@ -1479,8 +1553,8 @@ Any macro can be called indirectly with The macro `indir' is recognized only with parameters. - This can be used to call macros with "invalid" names (`define' -allows such names to be defined): + This can be used to call macros with computed or "invalid" names +(`define' allows such names to be defined): define(`$$internal$macro', `Internal macro (name `$0')') => @@ -1493,6 +1567,22 @@ allows such names to be defined): macros defined, that will not be called by accident. They can _only_ be called through the builtin `indir'. + One other point to observe is that argument collection occurs before +`indir' invokes NAME, so if argument collection changes the value of +NAME, that will be reflected in the final expansion. This is different +than the behavior when invoking macros directly, where the definition +that was in effect before argument collection is used. + + define(`f', `1') + => + f(define(`f', `2')) + =>1 + indir(`f', define(`f', `3')) + =>3 + indir(`f', undefine(`f')) + error-->m4:stdin:4: undefined macro `f' + => +  File: m4.info, Node: Builtin, Prev: Indir, Up: Definitions @@ -1533,9 +1623,15 @@ the builtin. foo =>foo - Note that this can be used to invoke builtins without arguments, even -when they normally require parameters to be recognized; but it will -provoke a warning, and result in a void expansion. + The NAME argument only matches the original name of the builtin, +even when the `--prefix-builtins' option (or `-P', *note Invoking m4::) +is in effect. This is different from `indir', which only tracks +current macro names. + + Note that `indir' and `builtin' can be used to invoke builtins +without arguments, even when they normally require parameters to be +recognized; but it will provoke a warning, and result in a void +expansion. builtin =>builtin @@ -1571,8 +1667,8 @@ true.  File: m4.info, Node: Ifdef, Next: Ifelse, Up: Conditionals -5.1 Testing macro definitions -============================= +5.1 Testing if a macro is defined +================================= There are two different builtin conditionals in `m4'. The first is `ifdef': @@ -1597,8 +1693,8 @@ There are two different builtin conditio  File: m4.info, Node: Ifelse, Next: Loops, Prev: Ifdef, Up: Conditionals -5.2 Comparing strings -===================== +5.2 If-else construct, or multibranch +===================================== The other conditional, `ifelse', is much more powerful. It can be used as a way to introduce a long comment, as an if-else construct, or as a @@ -1613,11 +1709,12 @@ multibranch, depending on the number of If called with three or four arguments, `ifelse' expands into EQUAL, if STRING-1 and STRING-2 are equal (character for - character), otherwise it expands to NOT-EQUAL. + character), otherwise it expands to NOT-EQUAL. A final fifth + argument is ignored, after triggering a warning. If called with six or more arguments, and STRING-1 and STRING-2 - are equal, `ifelse' expands into EQUAL, otherwise the first three - arguments are discarded and the processing starts again. + are equal, `ifelse' expands into EQUAL-1, otherwise the first + three arguments are discarded and the processing starts again. The macro `ifelse' is recognized only with parameters. @@ -1666,8 +1763,16 @@ equal, `ifelse' expands into EQUAL-1, ot repeated with the first three arguments discarded. This calls for an example: + ifelse(`foo', `bar', `third', `gnu', `gnats') + error-->m4:stdin:1: Warning: excess arguments to builtin `ifelse' ignored + =>gnu + ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth') + => ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth', `seventh') =>seventh + ifelse(`foo', `bar', `3', `gnu', `gnats', `6', `7', `8') + error-->m4:stdin:4: Warning: excess arguments to builtin `ifelse' ignored + =>7 Naturally, the normal case will be slightly more advanced than these examples. A common use of `ifelse' is in macros implementing loops of @@ -1689,9 +1794,9 @@ described previously. There is a builtin macro, `shift', which can, among other things, be used for iterating through the actual arguments to a macro: - -- Builtin: shift (...) - Takes any number of arguments, and expands to all but the first - argument, separated by commas, with each argument quoted. + -- Builtin: shift (ARG1, ...) + Takes any number of arguments, and expands to all its arguments + except ARG1, separated by commas, with each argument quoted. The macro `shift' is recognized only with parameters. @@ -1720,7 +1825,8 @@ used for iterating through the actual ar =>and gnus, gnats, bar, foo While not a very interesting macro, it does show how simple loops -can be made with `shift', `ifelse' and recursion. +can be made with `shift', `ifelse' and recursion. It also shows that +`shift' is usually used with `$@'. Here is an example of a loop macro that implements a simple for loop. @@ -1879,7 +1985,7 @@ is printed to the current debug file (us foo error-->m4trace: -1- foo -> `Hello World.' =>Hello World. - echo(gnus, and gnats) + echo(`gnus', `and gnats') error-->m4trace: -1- echo(`gnus', `and gnats') -> ``gnus',`and gnats'' =>gnus,and gnats @@ -2039,8 +2145,8 @@ File: m4.info, Node: Debug Output, Pre =========================== Debug and tracing output can be redirected to files using either the -`-o' option to `m4' (*note Invoking m4::), or with the builtin macro -`debugfile': +`--debugfile' option to `m4' (*note Invoking m4::), or with the builtin +macro `debugfile': -- Builtin: debugfile ([FILE]) Sends all further debug and trace output to FILE. If FILE is @@ -2084,7 +2190,7 @@ to `m4'. * Changequote:: Changing the quote characters * Changecom:: Changing the comment delimiters * Changeword:: Changing the lexical structure of words -* M4wrap:: Saving input until end of input +* M4wrap:: Saving text until end of input  File: m4.info, Node: Dnl, Next: Changequote, Up: Input Control @@ -2216,7 +2322,7 @@ effectively disabled. For portability w is a good idea to avoid `(', `,', and `)' as the first character in START. - define(`echo', `$#:$') + define(`echo', `$#:$@:') => define(`hi', `HI') => @@ -2274,8 +2380,8 @@ very often.  File: m4.info, Node: Changecom, Next: Changeword, Prev: Changequote, Up: Input Control -7.3 Changing comment delimiters -=============================== +7.3 Changing the comment delimiters +=================================== The default comment delimiters can be changed with the builtin macro `changecom': @@ -2342,7 +2448,7 @@ effectively disabled. For portability w is a good idea to avoid `(', `,', and `)' as the first character in START. - define(`echo', `$#:$') + define(`echo', `$#:$@:') => define(`hi', `HI') => @@ -2436,12 +2542,48 @@ restriction on the regular expressions t `changeword'. This is that if your regular expression accepts `foo', it must also accept `f' and `fo'. + ifdef(`changeword', `', `errprint(` skipping: no changeword support + ')m4exit(`77')')dnl + define(`foo + ', `bar + ') + => + dnl This example wants to recognize changeword, dnl, and `foo\n'. + dnl First, we check that our regexp will match. + regexp(`changeword', `[cd][a-z]*\|foo[ + ]') + =>0 + regexp(`foo + ', `[cd][a-z]*\|foo[ + ]') + =>0 + regexp(`f', `[cd][a-z]*\|foo[ + ]') + =>-1 + foo + =>foo + changeword(`[cd][a-z]*\|foo[ + ]') + => + dnl Even though `foo\n' matches, we forgot to allow `f'. + foo + =>foo + changeword(`[cd][a-z]*\|fo*[ + ]?') + => + dnl Now we can call `foo\n'. + foo + =>bar + `changeword' has another function. If the regular expression supplied contains any grouped subexpressions, then text outside the first of these is discarded before symbol lookup. So: ifdef(`changeword', `', `errprint(` skipping: no changeword support ')m4exit(`77')')dnl + ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics + ')m4exit(`77')')dnl changecom(`/*', `*/')dnl define(`foo', `bar')dnl changeword(`#\([_a-zA-Z0-9]*\)') @@ -2497,8 +2639,8 @@ speed.  File: m4.info, Node: M4wrap, Prev: Changeword, Up: Input Control -7.5 Saving input -================ +7.5 Saving text until end of input +================================== It is possible to `save' some text until the end of the normal input has been seen. Text can be saved, to be read again by `m4' when the normal @@ -2507,7 +2649,7 @@ cleanup actions before normal exit, e.g. To save input text, use the builtin `m4wrap': - -- Builtin: m4wrap ([STRING], ...) + -- Builtin: m4wrap (STRING, ...) Stores STRING in a safe place, to be reread when end of input is reached. As a GNU extension, additional arguments are concatenated with a space to the STRING. @@ -3472,8 +3614,8 @@ width is negative. On error, the expans  File: m4.info, Node: Shell commands, Next: Miscellaneous, Prev: Arithmetic, Up: Top -12 Running shell commands -************************* +12 Macros for running shell commands +************************************ There are a few builtin macros in `m4' that allow you to run shell commands from within `m4'. @@ -3491,7 +3633,7 @@ value if this is not the case. * Syscmd:: Executing simple commands * Esyscmd:: Reading the output of commands * Sysval:: Exit status -* Maketemp:: Making names for temporary files +* Maketemp:: Making temporary files  File: m4.info, Node: Platform macros, Next: Syscmd, Up: Shell commands @@ -3563,9 +3705,9 @@ Any shell command can be executed, using not read by `m4'. *Note Esyscmd::, if you need to process the command output. - Prior to executing the command, `m4' flushes its output buffers. - The default standard input, output and error of SHELL-COMMAND are - the same as those of `m4'. + Prior to executing the command, `m4' flushes its buffers. The + default standard input, output and error of SHELL-COMMAND are the + same as those of `m4'. The macro `syscmd' is recognized only with parameters. @@ -3578,6 +3720,19 @@ Any shell command can be executed, using Note how the expansion of `syscmd' keeps the trailing newline of the command, as well as using the newline that appeared after the macro. + As an example of SHELL-COMMAND using the same standard input as +`m4', the command line `echo "m4wrap(\`syscmd(\`cat')')" | m4' will +tell `m4' to read all of its input before executing the wrapped text, +then hand a valid (albeit emptied) pipe as standard input for the `cat' +subcommand. Therefore, you should be careful when using standard input +(either by specifying no files, or by passing `-' as a file name on the +command line, *note Invoking m4::), and also invoking subcommands via +`syscmd' or `esyscmd' that consume data from standard input. When +standard input is a seekable file, the subprocess will pick up with the +next character not yet processed by `m4'; when it is a pipe or other +non-seekable file, there is no guarantee how much data will already be +buffered by `m4' and thus unavailable to the child. +  File: m4.info, Node: Esyscmd, Next: Sysval, Prev: Syscmd, Up: Shell commands @@ -3589,11 +3744,11 @@ If you want `m4' to read the output of a -- Builtin: esyscmd (SHELL-COMMAND) Expands to the standard output of the shell command SHELL-COMMAND. - Prior to executing the command, `m4' flushes its output buffers. - The default standard input and error output of SHELL-COMMAND are - the same as those of `m4'. The error output of SHELL-COMMAND is - not a part of the expansion: it will appear along with the error - output of `m4'. + Prior to executing the command, `m4' flushes its buffers. The + default standard input and error output of SHELL-COMMAND are the + same as those of `m4'. The error output of SHELL-COMMAND is not a + part of the expansion: it will appear along with the error output + of `m4'. The macro `esyscmd' is recognized only with parameters. @@ -3606,6 +3761,9 @@ If you want `m4' to read the output of a Note how the expansion of `esyscmd' keeps the trailing newline of the command, as well as using the newline that appeared after the macro. + Just as with `syscmd', care must be exercised when sharing standard +input between `m4' and the child process of `esyscmd'. +  File: m4.info, Node: Sysval, Next: Maketemp, Prev: Esyscmd, Up: Shell commands @@ -3671,8 +3829,8 @@ result is the signal number shifted left  File: m4.info, Node: Maketemp, Prev: Sysval, Up: Shell commands -12.5 Making names for temporary files -===================================== +12.5 Making temporary files +=========================== Commands specified to `syscmd' or `esyscmd' might need a temporary file, for output or for some other purpose. There is a builtin macro, @@ -3689,6 +3847,13 @@ file, for output or for some other purpo maketemp(`/tmp/fooXXXXXX') =>/tmp/fooa07346 + Traditional implementations of `m4' replaced the trailing `X' +sequence with the process id, without creating the file; meaning you +only get one result no matter how many times you use maketemp on the +same string. As of this release, POSIX is considering the addition of +a new macro `mkstemp' that behaves like GNU `maketemp', so a future +version of GNU M4 may have changes in this area. +  File: m4.info, Node: Miscellaneous, Next: Frozen files, Prev: Shell commands, Up: Top @@ -3702,7 +3867,7 @@ any of the previous chapters. * Errprint:: Printing error messages * Location:: Printing current location -* M4exit:: Exiting from m4 +* M4exit:: Exiting from `m4'  File: m4.info, Node: Errprint, Next: Location, Up: Miscellaneous @@ -3832,6 +3997,11 @@ than what was requested by `m4exit'. If such as a write error on standard out, the exit status will be non-zero even if `m4exit' requested zero. + If standard input is seekable, then the file will be positioned at +the next unread character. If it is a pipe or other non-seekable file, +then there are no guarantees how much data `m4' might have read into +buffers, and thus discarded. +  File: m4.info, Node: Frozen files, Next: Compatibility, Prev: Miscellaneous, Up: Top @@ -3991,7 +4161,7 @@ characters. The directives are: the same name, and its order, along with `F', is important. `V NUMBER ' - Confirms the format of the file. `m4' 1.4.6 only creates and + Confirms the format of the file. `m4' 1.4.7 only creates and understands frozen files where NUMBER is 1. This directive must be the first non-comment in the file, and may not appear more than once. @@ -4094,8 +4264,8 @@ other command line options. In addition to the above extensions, GNU `m4' implements the following command line options: `-F', `-G', `-I', `-L', `-R', `-V', -`-W', `-d', `-l', `-o' and `-t'. *Note Invoking m4::, for a -description of these options. +`-W', `-d', `-i', `-l', `--debugfile' and `-t'. *Note Invoking m4::, +for a description of these options. Also, the debugging and tracing facilities in GNU `m4' are much more extensive than in most other versions of `m4'. @@ -4124,6 +4294,10 @@ behaviors is non-portable, as a future r cannot be parsed, or using `m4exit' (*note M4exit::) with a non-numeric argument). + * Some traditional implementations only allow reading standard input + once, but GNU `m4' correctly handles multiple instances of `-' on + the command line. + * POSIX requires `m4wrap' (*note M4wrap::) to act in FIFO (first-in, first-out) order, but GNU `m4' currently uses LIFO order. Furthermore, POSIX states that only the first argument to `m4wrap' @@ -4355,8 +4529,8 @@ equivalently, when the current line is 0  File: m4.info, Node: Copying This Manual, Next: Indices, Prev: Answers, Up: Top -Appendix A Copying This Manual -****************************** +Appendix A How to make copies of this manual +******************************************** * Menu: @@ -4763,8 +4937,8 @@ A.1 GNU Free Documentation License you may choose any version ever published (not as a draft) by the Free Software Foundation. -A.1.1 ADDENDUM: How to use this License for your documents ----------------------------------------------------------- +ADDENDUM: How to use this License for your documents +==================================================== To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license @@ -4797,19 +4971,19 @@ permit their use in free software.  File: m4.info, Node: Indices, Prev: Copying This Manual, Up: Top -Appendix B Indices -****************** +Appendix B Indices of concepts and macros +***************************************** * Menu: * Concept index:: Index for many concepts -* Macro index:: Index for all m4 macros +* Macro index:: Index for all `m4' macros  File: m4.info, Node: Concept index, Next: Macro index, Up: Indices -B.1 Concept index -================= +B.1 Index for many concepts +=========================== [index] * Menu: @@ -4819,15 +4993,15 @@ B.1 Concept index * arguments to macros, special: Pseudo Arguments. (line 6) * arguments, quoted macro: Quoting Arguments. (line 6) * arithmetic: Arithmetic. (line 6) -* arrays: Define. (line 47) +* arrays: Define. (line 52) * builtins, indirect call of: Builtin. (line 6) * call of builtins, indirect: Builtin. (line 6) * call of macros, indirect: Indir. (line 6) * changing comment delimiters: Changecom. (line 6) * changing the quote delimiters: Changequote. (line 6) * characters, translating: Translit. (line 6) -* command line, file names on the: Invoking m4. (line 205) -* command line, macro definitions on the: Invoking m4. (line 55) +* command line, file names on the: Invoking m4. (line 235) +* command line, macro definitions on the: Invoking m4. (line 78) * command line, options: Invoking m4. (line 10) * commands, exit status from shell: Sysval. (line 6) * commands, running shell: Shell commands. (line 6) @@ -4839,7 +5013,7 @@ B.1 Concept index * compatibility: Compatibility. (line 6) * conditionals: Ifdef. (line 6) * controlling debugging output: Debug Levels. (line 6) -* counting loops: Loops. (line 49) +* counting loops: Loops. (line 50) * debugging output, controlling: Debug Levels. (line 6) * debugging output, saving: Debug Output. (line 6) * decrement operator: Incr. (line 6) @@ -4867,27 +5041,28 @@ B.1 Concept index * FDL, GNU Free Documentation License: GNU Free Documentation License. (line 6) * file format, frozen file: Frozen file format. (line 6) -* file inclusion <1>: File Inclusion. (line 6) -* file inclusion: Undivert. (line 77) -* file names, on the command line: Invoking m4. (line 205) +* file inclusion <1>: Undivert. (line 77) +* file inclusion: File Inclusion. (line 6) +* file names, on the command line: Invoking m4. (line 235) * files, diverting output to: Divert. (line 6) * files, names of temporary: Maketemp. (line 6) -* for loops: Loops. (line 49) +* for loops: Loops. (line 50) * formatted output: Format. (line 6) * frozen file format: Frozen file format. (line 6) * frozen files for fast loading: Using frozen files. (line 6) -* GNU extensions <1>: Esyscmd. (line 6) -* GNU extensions <2>: Extensions. (line 6) -* GNU extensions <3>: Regexp. (line 6) -* GNU extensions <4>: Using frozen files. (line 6) -* GNU extensions <5>: Undivert. (line 77) -* GNU extensions <6>: Patsubst. (line 6) -* GNU extensions <7>: Search Path. (line 6) -* GNU extensions <8>: Arguments. (line 32) -* GNU extensions <9>: Format. (line 6) -* GNU extensions <10>: Indir. (line 6) -* GNU extensions <11>: Debug Output. (line 6) -* GNU extensions <12>: Builtin. (line 6) +* GNU extensions <1>: Builtin. (line 6) +* GNU extensions <2>: Undivert. (line 77) +* GNU extensions <3>: Extensions. (line 6) +* GNU extensions <4>: Patsubst. (line 6) +* GNU extensions <5>: Search Path. (line 6) +* GNU extensions <6>: Esyscmd. (line 6) +* GNU extensions <7>: Using frozen files. (line 6) +* GNU extensions <8>: Debug Output. (line 6) +* GNU extensions <9>: Regexp. (line 6) +* GNU extensions <10>: Arguments. (line 32) +* GNU extensions <11>: Format. (line 6) +* GNU extensions <12>: Indir. (line 6) +* GNU extensions <13>: Define. (line 41) * GNU extensions: Debug Levels. (line 59) * included files, search path for: Search Path. (line 6) * inclusion, of files <1>: Undivert. (line 77) @@ -4905,8 +5080,8 @@ B.1 Concept index * License: Copying This Manual. (line 6) * local variables: Pushdef. (line 75) * loops: Loops. (line 10) -* loops, counting: Loops. (line 49) -* macro definitions, on the command line: Invoking m4. (line 55) +* loops, counting: Loops. (line 50) +* macro definitions, on the command line: Invoking m4. (line 78) * macro expansion, tracing: Trace. (line 6) * macro invocation: Invocation. (line 6) * macros, arguments to <1>: Arguments. (line 6) @@ -4922,7 +5097,7 @@ B.1 Concept index * macros, special arguments to: Pseudo Arguments. (line 6) * macros, temporary redefinition of: Pushdef. (line 6) * messages, printing error: Errprint. (line 6) -* multibranches: Ifelse. (line 65) +* multibranches: Ifelse. (line 66) * names: Names. (line 6) * options, command line: Invoking m4. (line 10) * output, diverting to files: Divert. (line 6) @@ -4931,14 +5106,15 @@ B.1 Concept index * pattern substitution: Patsubst. (line 6) * platform macro: Platform macros. (line 31) * platform macros: Platform macros. (line 6) +* POSIXLY_CORRECT: Invoking m4. (line 10) * printing error messages: Errprint. (line 6) * quote delimiters, changing the: Changequote. (line 6) * quoted macro arguments: Quoting Arguments. (line 6) * quoted string: Quoted strings. (line 6) * recursive macros: Loops. (line 6) * redefinition of macros, temporary: Pushdef. (line 6) -* regular expressions <1>: Patsubst. (line 6) -* regular expressions: Regexp. (line 6) +* regular expressions <1>: Regexp. (line 6) +* regular expressions: Patsubst. (line 6) * reloading a frozen file: Using frozen files. (line 6) * renaming macros: Defn. (line 6) * running shell commands: Shell commands. (line 6) @@ -4968,8 +5144,8 @@ B.1 Concept index  File: m4.info, Node: Macro index, Prev: Concept index, Up: Indices -B.2 Macro index -=============== +B.2 Index for all `m4' macros +============================= References are exclusively to the places where a builtin is introduced the first time. @@ -5005,7 +5181,7 @@ the first time. * eval: Eval. (line 9) * example: Manual. (line 32) * fatal_error: M4exit. (line 18) -* forloop: Loops. (line 52) +* forloop: Loops. (line 53) * format: Format. (line 9) * ifdef: Ifdef. (line 10) * ifelse: Ifelse. (line 12) @@ -5040,90 +5216,90 @@ the first time.  Tag Table: -Node: Top864 -Node: Preliminaries8278 -Node: Intro9005 -Node: History10637 -Node: Invoking m413261 -Node: Bugs22389 -Node: Manual23655 -Node: Syntax26587 -Node: Names27584 -Node: Quoted strings28034 -Node: Comments28669 -Node: Other tokens29508 -Node: Input processing30056 -Node: Macros31905 -Node: Invocation32399 -Node: Inhibiting Invocation33200 -Node: Macro Arguments36715 -Node: Quoting Arguments38613 -Node: Macro expansion39845 -Node: Definitions40513 -Node: Define41297 -Node: Arguments43216 -Node: Pseudo Arguments44945 -Node: Undefine47475 -Node: Defn48605 -Node: Pushdef50908 -Node: Indir53242 -Node: Builtin54170 -Node: Conditionals55589 -Node: Ifdef56303 -Node: Ifelse57158 -Node: Loops59915 -Node: Debugging63787 -Node: Dumpdef64372 -Node: Trace65749 -Node: Debug Levels68365 -Node: Debug Output71153 -Node: Input Control72334 -Node: Dnl72872 -Node: Changequote74682 -Node: Changecom78157 -Node: Changeword81088 -Node: M4wrap85705 -Node: File Inclusion87924 -Node: Include88241 -Node: Search Path90687 -Node: Diversions91499 -Node: Divert92737 -Node: Undivert94932 -Node: Divnum97656 -Node: Cleardiv98115 -Node: Text handling99274 -Node: Len99997 -Node: Index macro100382 -Node: Regexp101153 -Node: Substr103402 -Node: Translit104453 -Node: Patsubst106142 -Node: Format109676 -Node: Arithmetic111734 -Node: Incr112183 -Node: Eval112958 -Node: Shell commands117367 -Node: Platform macros118277 -Node: Syscmd120006 -Node: Esyscmd120975 -Node: Sysval121900 -Node: Maketemp123456 -Node: Miscellaneous124172 -Node: Errprint124603 -Node: Location125403 -Node: M4exit127601 -Node: Frozen files129381 -Node: Using frozen files130162 -Node: Frozen file format133402 -Node: Compatibility136465 -Node: Extensions137080 -Node: Incompatibilities140562 -Node: Other Incompatibilities147468 -Node: Answers149396 -Node: Copying This Manual151742 -Node: GNU Free Documentation License151970 -Node: Indices174376 -Node: Concept index174608 -Node: Macro index185690 +Node: Top841 +Node: Preliminaries8308 +Node: Intro9035 +Node: History10667 +Node: Invoking m413299 +Node: Bugs24213 +Node: Manual25479 +Node: Syntax28411 +Node: Names29414 +Node: Quoted strings29876 +Node: Comments30525 +Node: Other tokens31392 +Node: Input processing31970 +Node: Macros33849 +Node: Invocation34343 +Node: Inhibiting Invocation35144 +Node: Macro Arguments38698 +Node: Quoting Arguments40625 +Node: Macro expansion41946 +Node: Definitions42614 +Node: Define43399 +Node: Arguments45586 +Node: Pseudo Arguments47317 +Node: Undefine50532 +Node: Defn51662 +Node: Pushdef54389 +Node: Indir56723 +Node: Builtin58194 +Node: Conditionals59857 +Node: Ifdef60571 +Node: Ifelse61434 +Node: Loops64653 +Node: Debugging68589 +Node: Dumpdef69174 +Node: Trace70551 +Node: Debug Levels73171 +Node: Debug Output75959 +Node: Input Control77149 +Node: Dnl77686 +Node: Changequote79496 +Node: Changecom82973 +Node: Changeword85914 +Node: M4wrap91355 +Node: File Inclusion93608 +Node: Include93925 +Node: Search Path96371 +Node: Diversions97183 +Node: Divert98421 +Node: Undivert100616 +Node: Divnum103340 +Node: Cleardiv103799 +Node: Text handling104958 +Node: Len105681 +Node: Index macro106066 +Node: Regexp106837 +Node: Substr109086 +Node: Translit110137 +Node: Patsubst111826 +Node: Format115360 +Node: Arithmetic117418 +Node: Incr117867 +Node: Eval118642 +Node: Shell commands123051 +Node: Platform macros123973 +Node: Syscmd125702 +Node: Esyscmd127488 +Node: Sysval128534 +Node: Maketemp130090 +Node: Miscellaneous131178 +Node: Errprint131611 +Node: Location132411 +Node: M4exit134609 +Node: Frozen files136630 +Node: Using frozen files137411 +Node: Frozen file format140651 +Node: Compatibility143714 +Node: Extensions144329 +Node: Incompatibilities147826 +Node: Other Incompatibilities154899 +Node: Answers156827 +Node: Copying This Manual159173 +Node: GNU Free Documentation License159429 +Node: Indices181823 +Node: Concept index182103 +Node: Macro index193351  End Tag Table diff -ruNp m4-1.4.6/doc/m4.texinfo m4-1.4.7/doc/m4.texinfo --- m4-1.4.6/doc/m4.texinfo 2006-08-24 08:15:09.000000000 -0600 +++ m4-1.4.7/doc/m4.texinfo 2006-09-23 22:28:02.000000000 -0600 @@ -131,7 +131,7 @@ changeword will go away and @emph{you sh * Miscellaneous:: Miscellaneous builtin macros * Frozen files:: Fast loading of frozen state -* Compatibility:: Compatibility with other versions of m4 +* Compatibility:: Compatibility with other versions of @code{m4} * Answers:: Correct version of some examples * Copying This Manual:: How to make copies of this manual * Indices:: Indices of concepts and macros @@ -150,10 +150,10 @@ Introduction and preliminaries Lexical and syntactic conventions * Names:: Macro names -* Quoted strings:: Quoting input to m4 -* Comments:: Comments in m4 input +* Quoted strings:: Quoting input to @code{m4} +* Comments:: Comments in @code{m4} input * Other tokens:: Other kinds of input tokens -* Input processing:: How m4 copies input to output +* Input processing:: How @code{m4} copies input to output How to invoke macros @@ -167,7 +167,7 @@ How to define new macros * Define:: Defining a new macro * Arguments:: Arguments to macros -* Pseudo Arguments:: Pseudo arguments to macros +* Pseudo Arguments:: Special arguments to macros * Undefine:: Deleting a macro * Defn:: Renaming macros * Pushdef:: Temporarily redefining macros @@ -194,7 +194,7 @@ Input control * Changequote:: Changing the quote characters * Changecom:: Changing the comment delimiters * Changeword:: Changing the lexical structure of words -* M4wrap:: Saving input until end of input +* M4wrap:: Saving text until end of input File inclusion @@ -223,19 +223,19 @@ Macros for doing arithmetic * Incr:: Decrement and increment operators * Eval:: Evaluating integer expressions -Running shell commands +Macros for running shell commands * Platform macros:: Determining the platform * Syscmd:: Executing simple commands * Esyscmd:: Reading the output of commands * Sysval:: Exit status -* Maketemp:: Making names for temporary files +* Maketemp:: Making temporary files Miscellaneous builtin macros * Errprint:: Printing error messages * Location:: Printing current location -* M4exit:: Exiting from m4 +* M4exit:: Exiting from @code{m4} Fast loading of frozen state @@ -248,14 +248,14 @@ Compatibility with other versions of @co * Incompatibilities:: Facilities in System V m4 not in GNU M4 * Other Incompatibilities:: Other incompatibilities -Copying This Manual +How to make copies of this manual * GNU Free Documentation License:: License for copying this manual -Indices +Indices of concepts and macros * Concept index:: Index for many concepts -* Macro index:: Index for all m4 macros +* Macro index:: Index for all @code{m4} macros @end detailmenu @end menu @@ -360,7 +360,7 @@ addressed some long standing bugs in the Then in 2005 Gary V. Vaughan collected together the many patches to @acronym{GNU} @code{m4} 1.4 that were floating around the net and released 1.4.3 and 1.4.4. And in 2006, Eric Blake joined the team and -prepared patches for the release of 1.4.5 and 1.4.6. +prepared patches for the release of 1.4.5, 1.4.6, and 1.4.7. Meanwhile, development has continued on new features for @code{m4}, such as dynamic module loading and additional builtins. When complete, @@ -378,12 +378,32 @@ The format of the @code{m4} command is: @cindex command line, options @cindex options, command line +@cindex @env{POSIXLY_CORRECT} All options begin with @samp{-}, or if long option names are used, with -a @samp{--}. A long option name need not be written completely, any -unambiguous prefix is sufficient. Options may be intermixed with files, -use @option{--} as a marker to denote the end of options. @code{m4} -understands the following options, grouped by functionality. +@samp{--}. A long option name need not be written completely, any +unambiguous prefix is sufficient. Unless @env{POSIXLY_CORRECT} is set +in the environment, options may be intermixed with files. The argument +@option{--} is a marker to denote the end of options. + +With short options, options that do not take arguments may be combined +into a single command line argument with subsequent options, options +with mandatory arguments may be provided either as a single command line +argument or as two arguments, and options with optional arguments must +be provided as a single argument. In other words, without +@env{POSIXLY_CORRECT}, @kbd{m4 -QPDfoo -d a -d+f} is equivalent to +@kbd{m4 -Q -P -D foo -d -d+f -- a}, although the latter form is +considered canonical. (With @env{POSIXLY_CORRECT}, it is equivalent to +@kbd{m4 -Q -P -D foo -d -- a ./-d+f}). + +With long options, options with mandatory arguments may be provided with +an equal sign (@samp{=}) in a single argument, or as two arguments, and +options with optional arguments must be provided as a single argument. +In other words, @kbd{m4 --def foo --debug a} is equivalent to +@kbd{m4 --define=foo --debug= -- a}, although the latter form is +considered canonical (not to mention more robust, in case a future +version of @code{m4} introduces an option named @option{--default}). +@code{m4} understands the following options, grouped by functionality. Several options control the overall operation of @code{m4}: @table @code @@ -400,10 +420,14 @@ immediately exit @code{m4} without readi Stop execution and exit @code{m4} once the first warning has been issued, considering all of them to be fatal. -@item -e +@item -i @itemx --interactive +@itemx -e Makes this invocation of @code{m4} interactive. This means that all -output will be unbuffered, and interrupts will be ignored. +output will be unbuffered, and interrupts will be ignored. The +spelling @option{-e} exists for compatibility with other @code{m4} +implementations, and issues a warning because it may be withdrawn in a +future version of @acronym{GNU} M4. @item -P @itemx --prefix-builtins @@ -519,14 +543,16 @@ problem in general, if not undecidable! @itemx -S @var{NUM} @itemx -T @var{NUM} These options are present for compatibility with System V @code{m4}, but -do nothing in this implementation. +do nothing in this implementation. They may disappear in future +releases, and issue a warning to that effect. @item -N @var{NUM} @itemx --diversions=@var{NUM} These options are present only for compatibility with previous versions of @acronym{GNU} @code{m4}, and were controlling the number of possible diversions which could be used at the same time. They do nothing, -because there is no fixed limit anymore. +because there is no fixed limit anymore. They may disappear in future +releases, and issue a warning to that effect. @end table @acronym{GNU} @code{m4} comes with a feature of freezing internal state @@ -559,19 +585,24 @@ controls the format and amount of inform functions. @xref{Debug Levels}, for more details on the format and meaning of @var{FLAGS}. If omitted, @var{FLAGS} defaults to @samp{aeq}. -@item -l @var{NUM} -@itemx --arglength=@var{NUM} -Restrict the size of the output generated by macro tracing to @var{NUM} -characters per trace line. If unspecified or zero, output is -unlimited. @xref{Debug Levels}, for more details. - -@item -o @var{FILE} +@item --debugfile=@var{FILE} +@itemx -o @var{FILE} @itemx --error-output=@var{FILE} Redirect @code{dumpdef} output, debug messages, and trace output to the named @var{FILE}. Warnings, error messages, and @code{errprint} output are still printed to standard error. If unspecified, debug output goes to standard error; if empty, debug output is discarded. @xref{Debug -Output}, for more details. +Output}, for more details. The spellings @option{-o} and +@option{--error-output} are misleading and inconsistent with other +@acronym{GNU} tools; for now they are silently accepted as synonyms of +@option{--debugfile}, but in a future version of M4, using them will +cause a warning to be issued. + +@item -l @var{NUM} +@itemx --arglength=@var{NUM} +Restrict the size of the output generated by macro tracing to @var{NUM} +characters per trace line. If unspecified or zero, output is +unlimited. @xref{Debug Levels}, for more details. @item -t @var{NAME} @itemx --trace=@var{NAME} @@ -587,10 +618,12 @@ names. If no names are present, the sta name of @file{-} is taken to mean the standard input. It is conventional, but not required, for input files to end in @samp{.m4}. -The input files are read in the sequence given. The standard input can -only be read once, so the file name @file{-} should only appear once on -the command line. It is an error if an input file ends in the middle of -argument collection, a comment, or a quoted string. +The input files are read in the sequence given. Standard input can be +read more than once, so the file name @file{-} may appear multiple times +on the command line; this makes a difference when input is from a +terminal or other special file type. It is an error if an input file +ends in the middle of argument collection, a comment, or a quoted +string. If none of the input files invoked @code{m4exit} (@pxref{M4exit}), the exit status of @code{m4} will be 0 for success, 1 for general failure @@ -712,14 +745,14 @@ exception of the @sc{nul} character (the @menu * Names:: Macro names -* Quoted strings:: Quoting input to m4 -* Comments:: Comments in m4 input +* Quoted strings:: Quoting input to @code{m4} +* Comments:: Comments in @code{m4} input * Other tokens:: Other kinds of input tokens -* Input processing:: How m4 copies input to output +* Input processing:: How @code{m4} copies input to output @end menu @node Names -@section Names +@section Macro names @cindex names A name is any sequence of letters, digits, and the character @kbd{_} @@ -731,7 +764,7 @@ macro definition, it will be subject to Examples of legal names are: @samp{foo}, @samp{_tmp}, and @samp{name01}. @node Quoted strings -@section Quoted strings +@section Quoting input to @code{m4} @cindex quoted string A quoted string is a sequence of characters surrounded by quote @@ -759,7 +792,7 @@ The quote characters can be changed at a @code{changequote}. @xref{Changequote}, for more information. @node Comments -@section Comments +@section Comments in @code{m4} input @cindex comments Comments in @code{m4} are normally delimited by the characters @samp{#} @@ -783,7 +816,7 @@ the builtin macro @code{changecom}. @xr information. @node Other tokens -@section Other tokens +@section Other kinds of input tokens Any character, that is neither a part of a name, nor of a quoted string, nor a comment, is a token by itself. When not in the context of macro @@ -794,7 +827,7 @@ formfeed, carriage return, vertical tab) roles, explained later. @node Input processing -@section Input Processing +@section How @code{m4} copies input to output As @code{m4} reads the input token by token, it will copy each token directly to the output immediately. @@ -923,11 +956,11 @@ call is not triggered. This solves the specific provision. There is also a command line option (@option{--prefix-builtins}, or -@option{-P}, @pxref{Invoking m4}) which requires all builtin macro names -to be prefixed -by @samp{m4_} for them to be recognized. The option has no effect +@option{-P}, @pxref{Invoking m4}) that renames all builtin macro with a +prefix of @samp{m4_} at startup. The option has no effect whatsoever on user defined macros. For example, with this option, -one has to write @code{m4_dnl} and even @code{m4_m4exit}. +one has to write @code{m4_dnl} and even @code{m4_m4exit}. It also has +no effect on whether a macro requires parameters. Another alternative is to redefine problematic macros to a name less likely to cause conflicts, @xref{Definitions}. @@ -948,7 +981,6 @@ that the unquoted portions are not also to quote the empty string, but this works only @emph{inside} the name. For example: -@comment ignore @example `divert' @result{}divert @@ -963,7 +995,6 @@ div`'ert @noindent all yield the string @samp{divert}. While in both: -@comment ignore @example `'divert @result{} @@ -1035,7 +1066,8 @@ Unquoted leading whitespace is stripped Normally @code{m4} will issue warnings if a builtin macro is called with an inappropriate number of arguments, but it can be suppressed with -the @option{-Q} command line option (@pxref{Invoking m4}). For user +the @option{--quiet} command line option (or @option{--silent}, or +@option{-Q}, @pxref{Invoking m4}). For user defined macros, there is no check of the number of arguments given. Macros are expanded normally during argument collection, and whatever @@ -1076,7 +1108,7 @@ define( @end example @node Quoting Arguments -@section Quoting macro arguments +@section On Quoting Arguments to macros @cindex quoted macro arguments @cindex macros, quoted arguments to @@ -1111,7 +1143,8 @@ just makes life a bit harder, if you are this manual follows the rule of thumb that each layer of parentheses introduces another layer of single quoting, except when showing the consequences of quoting rules. This is done even when the quoted string -cannot be a macro, such as with integers. +cannot be a macro, such as with integers when you have not changed the +syntax via @code{changeword} (@pxref{Changeword}). @node Macro expansion @section Macro expansion @@ -1148,7 +1181,7 @@ value, and bring back the original value @menu * Define:: Defining a new macro * Arguments:: Arguments to macros -* Pseudo Arguments:: Pseudo arguments to macros +* Pseudo Arguments:: Special arguments to macros * Undefine:: Deleting a macro * Defn:: Renaming macros * Pushdef:: Temporarily redefining macros @@ -1200,11 +1233,18 @@ one @result{}two @end example +@cindex @acronym{GNU} extensions +@acronym{GNU} @code{m4} normally replaces only the @emph{topmost} +definition of a macro if it has several definitions from @code{pushdef} +(@pxref{Pushdef}). Some other implementations of @code{m4} replace all +definitions of a macro with @code{define}. @xref{Incompatibilities}, +for more details. + As a @acronym{GNU} extension, the first argument to @code{define} does not have to be a simple word. It can be any text string, even the empty string. A macro with a non-standard name cannot be invoked in the normal way, as the name is -not recognised. It can only be referenced by the builtins @ref{Indir} +not recognized. It can only be referenced by the builtins @ref{Indir} and @ref{Defn}. @cindex arrays @@ -1259,8 +1299,8 @@ macro @end example @xref{Quoting Arguments}, for an explanation of the double quotes. -(You should try and improve this example so that clients of exch do not -have to double quote. @pxref{Answers}) +(You should try and improve this example so that clients of @code{exch} +do not have to double quote. @pxref{Answers}) @cindex @acronym{GNU} extensions @acronym{GNU} @code{m4} allows the number following the @samp{$} to @@ -1373,7 +1413,7 @@ untouched to the macro, and that quoting @example define(`echo1', `$*') @result{} -define(`echo2', `$@') +define(`echo2', `$@@') @result{} define(`foo', `bar') @result{} @@ -1398,9 +1438,34 @@ foo @result{}$$$ hello $$$ @end example -If you want a macro to expand to something like @samp{$12}, put a pair -of quotes after the @code{$}. This will prevent @code{m4} from -interpreting the @code{$} sign as a reference to an argument. +If you want a macro to expand to something like @samp{$12}, the +judicious use of nested quoting can put a safe character between the +@code{$} and the next character, relying on the rescanning to remove the +nested quote. This will prevent @code{m4} from interpreting the +@code{$} sign as a reference to an argument. + +@example +define(`foo', `no nested quote: $1') +@result{} +foo(`arg') +@result{}no nested quote: arg +define(`foo', `nested quote around $: `$'1') +@result{} +foo(`arg') +@result{}nested quote around $: $1 +define(`foo', `nested empty quote after $: $`'1') +@result{} +foo(`arg') +@result{}nested empty quote after $: $1 +define(`foo', `nested quote around next character: $`1'') +@result{} +foo(`arg') +@result{}nested quote around next character: $1 +define(`foo', `nested quote around both: `$1'') +@result{} +foo(`arg') +@result{}nested quote around both: arg +@end example @node Undefine @section Deleting a macro @@ -1466,7 +1531,8 @@ If @var{name} is a user-defined macro, t the quoted expansion text. If, instead, @var{name} is a builtin, the expansion is a special token, which points to the builtin's internal definition. This token is only meaningful as the second argument to -@code{define} (and @code{pushdef}), and is ignored in any other context. +@code{define} (and @code{pushdef}), and is silently converted to an +empty string in most other contexts. The macro @code{defn} is recognized only with parameters. @end deffn @@ -1526,7 +1592,7 @@ define(`foo', a'a) @result{} define(`a', `A') @result{} -define(`echo', `$@') +define(`echo', `$@@') @result{} foo @result{}A'A @@ -1536,6 +1602,20 @@ echo(foo) @result{}AA' @end example +Using @code{defn} to generate special tokens for builtin macros outside +of expected contexts can sometimes trigger warnings. But most of the +time, such tokens are silently converted to the empty string. + +@example +defn(`defn') +@result{} +define(defn(`divnum'), `cannot redefine a builtin token') +@error{}m4:stdin:2: Warning: define: invalid macro name ignored +@result{} +divnum +@result{}0 +@end example + @node Pushdef @section Temporarily redefining macros @@ -1643,7 +1723,7 @@ is printed, and the expansion is void. The macro @code{indir} is recognized only with parameters. @end deffn -This can be used to call macros with ``invalid'' +This can be used to call macros with computed or ``invalid'' names (@code{define} allows such names to be defined): @example @@ -1659,6 +1739,25 @@ The point is, here, that larger macro pa defined, that will not be called by accident. They can @emph{only} be called through the builtin @code{indir}. +One other point to observe is that argument collection occurs before +@code{indir} invokes @var{name}, so if argument collection changes the +value of @var{name}, that will be reflected in the final expansion. +This is different than the behavior when invoking macros directly, +where the definition that was in effect before argument collection is +used. + +@example +define(`f', `1') +@result{} +f(define(`f', `2')) +@result{}1 +indir(`f', define(`f', `3')) +@result{}3 +indir(`f', undefine(`f')) +@error{}m4:stdin:4: undefined macro `f' +@result{} +@end example + @node Builtin @section Indirect call of builtins @@ -1703,9 +1802,14 @@ foo @result{}foo @end example -Note that this can be used to invoke builtins without arguments, even -when they normally require parameters to be recognized; but it will -provoke a warning, and result in a void expansion. +The @var{name} argument only matches the original name of the builtin, +even when the @option{--prefix-builtins} option (or @option{-P}, +@pxref{Invoking m4}) is in effect. This is different from @code{indir}, +which only tracks current macro names. + +Note that @code{indir} and @code{builtin} can be used to invoke builtins +without arguments, even when they normally require parameters to be +recognized; but it will provoke a warning, and result in a void expansion. @example builtin @@ -1737,7 +1841,7 @@ something a number of times, or while so @end menu @node Ifdef -@section Testing macro definitions +@section Testing if a macro is defined @cindex conditionals There are two different builtin conditionals in @code{m4}. The first is @@ -1765,7 +1869,7 @@ ifdef(`no_such_macro', `yes', `no', `ext @end example @node Ifelse -@section Comparing strings +@section If-else construct, or multibranch @cindex comparing strings The other conditional, @code{ifelse}, is much more powerful. It can be @@ -1782,10 +1886,11 @@ produces no output. If called with three or four arguments, @code{ifelse} expands into @var{equal}, if @var{string-1} and @var{string-2} are equal (character -for character), otherwise it expands to @var{not-equal}. +for character), otherwise it expands to @var{not-equal}. A final fifth +argument is ignored, after triggering a warning. If called with six or more arguments, and @var{string-1} and -@var{string-2} are equal, @code{ifelse} expands into @var{equal}, +@var{string-2} are equal, @code{ifelse} expands into @var{equal-1}, otherwise the first three arguments are discarded and the processing starts again. @@ -1845,8 +1950,16 @@ the procedure is repeated with the first calls for an example: @example +ifelse(`foo', `bar', `third', `gnu', `gnats') +@error{}m4:stdin:1: Warning: excess arguments to builtin `ifelse' ignored +@result{}gnu +ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth') +@result{} ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth', `seventh') @result{}seventh +ifelse(`foo', `bar', `3', `gnu', `gnats', `6', `7', `8') +@error{}m4:stdin:4: Warning: excess arguments to builtin `ifelse' ignored +@result{}7 @end example Naturally, the normal case will be slightly more advanced than these @@ -1869,9 +1982,9 @@ previously. There is a builtin macro, @code{shift}, which can, among other things, be used for iterating through the actual arguments to a macro: -@deffn Builtin shift (@dots{}) -Takes any number of arguments, and expands to all but the first -argument, separated by commas, with each argument quoted. +@deffn Builtin shift (@var{arg1}, @dots{}) +Takes any number of arguments, and expands to all its arguments except +@var{arg1}, separated by commas, with each argument quoted. The macro @code{shift} is recognized only with parameters. @end deffn @@ -1906,7 +2019,8 @@ reverse(`foo', `bar', `gnats', `and gnus @end example While not a very interesting macro, it does show how simple loops can be -made with @code{shift}, @code{ifelse} and recursion. +made with @code{shift}, @code{ifelse} and recursion. It also shows +that @code{shift} is usually used with @samp{$@@}. @cindex for loops @cindex loops, counting @@ -2079,7 +2193,7 @@ traceon(`foo', `echo') foo @error{}m4trace: -1- foo -> `Hello World.' @result{}Hello World. -echo(gnus, and gnats) +echo(`gnus', `and gnats') @error{}m4trace: -1- echo(`gnus', `and gnats') -> ``gnus',`and gnats'' @result{}gnus,and gnats @end example @@ -2252,7 +2366,7 @@ foo @cindex output, saving debugging @cindex @acronym{GNU} extensions Debug and tracing output can be redirected to files using either the -@option{-o} option to @code{m4} (@pxref{Invoking m4}), or with the +@option{--debugfile} option to @code{m4} (@pxref{Invoking m4}), or with the builtin macro @code{debugfile}: @deffn Builtin debugfile (@ovar{file}) @@ -2297,7 +2411,7 @@ to @code{m4}. * Changequote:: Changing the quote characters * Changecom:: Changing the comment delimiters * Changeword:: Changing the lexical structure of words -* M4wrap:: Saving input until end of input +* M4wrap:: Saving text until end of input @end menu @node Dnl @@ -2463,7 +2577,7 @@ implementations, it is a good idea to av @samp{)} as the first character in @var{start}. @example -define(`echo', `$#:$@:') +define(`echo', `$#:$@@:') @result{} define(`hi', `HI') @result{} @@ -2524,7 +2638,7 @@ It is an error if the end of file occurs @end example @node Changecom -@section Changing comment delimiters +@section Changing the comment delimiters @cindex changing comment delimiters @cindex comment delimiters, changing @@ -2618,7 +2732,7 @@ implementations, it is a good idea to av @samp{)} as the first character in @var{start}. @example -define(`echo', `$#:$@:') +define(`echo', `$#:$@@:') @result{} define(`hi', `HI') @result{} @@ -2724,6 +2838,41 @@ is a restriction on the regular expressi @code{changeword}. This is that if your regular expression accepts @samp{foo}, it must also accept @samp{f} and @samp{fo}. +@example +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +define(`foo +', `bar +') +@result{} +dnl This example wants to recognize changeword, dnl, and `foo\n'. +dnl First, we check that our regexp will match. +regexp(`changeword', `[cd][a-z]*\|foo[ +]') +@result{}0 +regexp(`foo +', `[cd][a-z]*\|foo[ +]') +@result{}0 +regexp(`f', `[cd][a-z]*\|foo[ +]') +@result{}-1 +foo +@result{}foo +changeword(`[cd][a-z]*\|foo[ +]') +@result{} +dnl Even though `foo\n' matches, we forgot to allow `f'. +foo +@result{}foo +changeword(`[cd][a-z]*\|fo*[ +]?') +@result{} +dnl Now we can call `foo\n'. +foo +@result{}bar +@end example + @code{changeword} has another function. If the regular expression supplied contains any grouped subexpressions, then text outside the first of these is discarded before symbol lookup. So: @@ -2731,6 +2880,9 @@ the first of these is discarded before s @example ifdef(`changeword', `', `errprint(` skipping: no changeword support ')m4exit(`77')')dnl +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl changecom(`/*', `*/')dnl define(`foo', `bar')dnl changeword(`#\([_a-zA-Z0-9]*\)') @@ -2792,7 +2944,7 @@ with the empty string to restore the def the parsing speed. @node M4wrap -@section Saving input +@section Saving text until end of input @cindex saving input @cindex input, saving @@ -2804,7 +2956,7 @@ files. To save input text, use the builtin @code{m4wrap}: -@deffn Builtin m4wrap (@ovar{string}, @dots{}) +@deffn Builtin m4wrap (@var{string}, @dots{}) Stores @var{string} in a safe place, to be reread when end of input is reached. As a @acronym{GNU} extension, additional arguments are concatenated with a space to the @var{string}. @@ -3871,7 +4023,7 @@ eval(`10', `16') @end example @node Shell commands -@chapter Running shell commands +@chapter Macros for running shell commands @cindex executing UNIX commands @cindex running UNIX commands @@ -3896,7 +4048,7 @@ exit value if this is not the case. * Syscmd:: Executing simple commands * Esyscmd:: Reading the output of commands * Sysval:: Exit status -* Maketemp:: Making names for temporary files +* Maketemp:: Making temporary files @end menu @node Platform macros @@ -3971,7 +4123,7 @@ The expansion of @code{syscmd} is void, are not read by @code{m4}. @xref{Esyscmd}, if you need to process the command output. -Prior to executing the command, @code{m4} flushes its output buffers. +Prior to executing the command, @code{m4} flushes its buffers. The default standard input, output and error of @var{shell-command} are the same as those of @code{m4}. @@ -3989,6 +4141,36 @@ syscmd(`echo foo') Note how the expansion of @code{syscmd} keeps the trailing newline of the command, as well as using the newline that appeared after the macro. +As an example of @var{shell-command} using the same standard input as +@code{m4}, the command line @kbd{echo "m4wrap(\`syscmd(\`cat')')" | m4} +will tell @code{m4} to read all of its input before executing the +wrapped text, then hand a valid (albeit emptied) pipe as standard input +for the @code{cat} subcommand. Therefore, you should be careful when +using standard input (either by specifying no files, or by passing +@samp{-} as a file name on the command line, @pxref{Invoking m4}), and +also invoking subcommands via @code{syscmd} or @code{esyscmd} that +consume data from standard input. When standard input is a seekable +file, the subprocess will pick up with the next character not yet +processed by @code{m4}; when it is a pipe or other non-seekable file, +there is no guarantee how much data will already be buffered by +@code{m4} and thus unavailable to the child. + +@ignore +@comment If the user types the example below with stdin being an +@comment interactive terminal, then cat will hang waiting for additional +@comment input after m4 has exited. But the testsuite is using a pipe +@comment for stdin. Hence, we have two versions - the one we feed the +@comment testsuite below, and the one we display to the user above that +@comment more accurately shows what the testsuite is really doing but +@comment which the testsuite cannot parse. + +@example +m4wrap(`syscmd(`cat')') +@result{} +^D +@end example +@end ignore + @node Esyscmd @section Reading the output of commands @@ -4000,7 +4182,7 @@ If you want @code{m4} to read the output Expands to the standard output of the shell command @var{shell-command}. -Prior to executing the command, @code{m4} flushes its output buffers. +Prior to executing the command, @code{m4} flushes its buffers. The default standard input and error output of @var{shell-command} are the same as those of @code{m4}. The error output of @var{shell-command} is not a part of the expansion: it will appear along with the error @@ -4020,6 +4202,9 @@ esyscmd(`echo foo') Note how the expansion of @code{esyscmd} keeps the trailing newline of the command, as well as using the newline that appeared after the macro. +Just as with @code{syscmd}, care must be exercised when sharing standard +input between @code{m4} and the child process of @code{esyscmd}. + @node Sysval @section Exit status @@ -4099,7 +4284,7 @@ sysval @end example @node Maketemp -@section Making names for temporary files +@section Making temporary files @cindex temporary file names @cindex files, names of temporary @@ -4123,12 +4308,15 @@ maketemp(`/tmp/fooXXXXXX') @result{}/tmp/fooa07346 @end example -@ignore -@c FIXME: POSIX requires maketemp to replace the trailing XXX with the -@c process id, without creating the file; meaning you only get one -@c string no matter how many times you use maketemp. Instead, we treat -@c it like mkstemp(), and create a unique file every invocation. +Traditional implementations of @code{m4} replaced the trailing @samp{X} +sequence with the process id, without creating the file; meaning you +only get one result no matter how many times you use maketemp on the +same string. As of this release, @acronym{POSIX} is considering the +addition of a new macro @code{mkstemp} that behaves like @acronym{GNU} +@code{maketemp}, so a future version of @acronym{GNU} M4 may have +changes in this area. +@ignore @c This test makes sure maketemp gets testsuite coverage, but is @c somewhat complex for use in the manual. @example @@ -4156,7 +4344,7 @@ any of the previous chapters. @menu * Errprint:: Printing error messages * Location:: Printing current location -* M4exit:: Exiting from m4 +* M4exit:: Exiting from @code{m4} @end menu @node Errprint @@ -4301,6 +4489,11 @@ what was requested by @code{m4exit}. If error, such as a write error on standard out, the exit status will be non-zero even if @code{m4exit} requested zero. +If standard input is seekable, then the file will be positioned at the +next unread character. If it is a pipe or other non-seekable file, +then there are no guarantees how much data @code{m4} might have read +into buffers, and thus discarded. + @node Frozen files @chapter Fast loading of frozen state @@ -4596,8 +4789,8 @@ The destination of trace and debug outpu In addition to the above extensions, @acronym{GNU} @code{m4} implements the following command line options: @option{-F}, @option{-G}, @option{-I}, -@option{-L}, @option{-R}, @option{-V}, @option{-W}, @option{-d}, -@option{-l}, @option{-o} and @option{-t}. @xref{Invoking m4}, for a +@option{-L}, @option{-R}, @option{-V}, @option{-W}, @option{-d}, @option{-i}, +@option{-l}, @option{--debugfile} and @option{-t}. @xref{Invoking m4}, for a description of these options. Also, the debugging and tracing facilities in @acronym{GNU} @code{m4} are much @@ -4628,6 +4821,11 @@ implemented for the various builtins tha @code{m4exit} (@pxref{M4exit}) with a non-numeric argument). @item +Some traditional implementations only allow reading standard input +once, but @acronym{GNU} @code{m4} correctly handles multiple instances +of @samp{-} on the command line. + +@item @acronym{POSIX} requires @code{m4wrap} (@pxref{M4wrap}) to act in FIFO (first-in, first-out) order, but @acronym{GNU} @code{m4} currently uses LIFO order. Furthermore, @acronym{POSIX} states that only the first @@ -4888,7 +5086,7 @@ fatal_error(`inside wrapped text')') @c ========================================================== Appendices @node Copying This Manual -@appendix Copying This Manual +@appendix How to make copies of this manual @cindex License @menu @@ -4898,20 +5096,20 @@ fatal_error(`inside wrapped text')') @include fdl.texi @node Indices -@appendix Indices +@appendix Indices of concepts and macros @menu * Concept index:: Index for many concepts -* Macro index:: Index for all m4 macros +* Macro index:: Index for all @code{m4} macros @end menu @node Concept index -@appendixsec Concept index +@appendixsec Index for many concepts @printindex cp @node Macro index -@appendixsec Macro index +@appendixsec Index for all @code{m4} macros References are exclusively to the places where a builtin is introduced the first time. diff -ruNp m4-1.4.6/doc/stamp-vti m4-1.4.7/doc/stamp-vti --- m4-1.4.6/doc/stamp-vti 2006-08-24 12:01:54.000000000 -0600 +++ m4-1.4.7/doc/stamp-vti 2006-09-25 06:10:10.000000000 -0600 @@ -1,4 +1,4 @@ -@set UPDATED 24 August 2006 -@set UPDATED-MONTH August 2006 -@set EDITION 1.4.6 -@set VERSION 1.4.6 +@set UPDATED 23 September 2006 +@set UPDATED-MONTH September 2006 +@set EDITION 1.4.7 +@set VERSION 1.4.7 diff -ruNp m4-1.4.6/doc/texinfo.tex m4-1.4.7/doc/texinfo.tex --- m4-1.4.6/doc/texinfo.tex 2006-08-24 11:47:50.000000000 -0600 +++ m4-1.4.7/doc/texinfo.tex 2006-09-25 06:08:02.000000000 -0600 @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2006-07-17.16} +\def\texinfoversion{2006-08-26.17} % % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free @@ -2301,6 +2301,10 @@ where each line of input produces a line }$% } +% @textdegree - the normal degrees sign. +% +\def\textdegree{$^\circ$} + % Laurent Siebenmann reports \Orb undefined with: % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 % so we'll define it if necessary. @@ -3524,6 +3528,7 @@ where each line of input produces a line \definedummyword\point \definedummyword\print \definedummyword\result + \definedummyword\textdegree % % We want to disable all macros so that they are not expanded by \write. \macrolist @@ -3657,6 +3662,7 @@ where each line of input produces a line \def\point{.}% \def\print{-|}% \def\result{=>}% + \def\textdegree{degrees}% % % We need to get rid of all macros, leaving only the arguments (if present). % Of course this is not nearly correct, but it is the best we can do for now. diff -ruNp m4-1.4.6/doc/version.texi m4-1.4.7/doc/version.texi --- m4-1.4.6/doc/version.texi 2006-08-24 12:01:54.000000000 -0600 +++ m4-1.4.7/doc/version.texi 2006-09-25 06:10:10.000000000 -0600 @@ -1,4 +1,4 @@ -@set UPDATED 24 August 2006 -@set UPDATED-MONTH August 2006 -@set EDITION 1.4.6 -@set VERSION 1.4.6 +@set UPDATED 23 September 2006 +@set UPDATED-MONTH September 2006 +@set EDITION 1.4.7 +@set VERSION 1.4.7 diff -ruNp m4-1.4.6/examples/Makefile.in m4-1.4.7/examples/Makefile.in --- m4-1.4.6/examples/Makefile.in 2006-08-24 11:47:42.000000000 -0600 +++ m4-1.4.7/examples/Makefile.in 2006-09-25 06:07:58.000000000 -0600 @@ -123,6 +123,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIBM4_LIBDEPS = @LIBM4_LIBDEPS@ +LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ diff -ruNp m4-1.4.6/lib/Makefile.am m4-1.4.7/lib/Makefile.am --- m4-1.4.6/lib/Makefile.am 2006-08-24 11:36:34.000000000 -0600 +++ m4-1.4.7/lib/Makefile.am 2006-09-23 22:28:58.000000000 -0600 @@ -15,7 +15,7 @@ AUTOMAKE_OPTIONS = 1.5 gnits no-dependen noinst_LIBRARIES = libm4.a libm4_a_SOURCES = -libm4_a_LIBADD = @LIBOBJS@ +libm4_a_LIBADD = $(LIBOBJS) noinst_HEADERS = EXTRA_DIST = BUILT_SOURCES = @@ -42,8 +42,8 @@ EXTRA_DIST += alloca_.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. alloca.h: alloca_.h - cp $(srcdir)/alloca_.h $@-t - mv $@-t $@ + cp -f $(srcdir)/alloca_.h $@-t + mv -f $@-t $@ MOSTLYCLEANFILES += alloca.h alloca.h-t ## end gnulib module alloca-opt @@ -98,8 +98,8 @@ EXTRA_DIST += getopt_.h getopt_int.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. getopt.h: getopt_.h - cp $(srcdir)/getopt_.h $@-t - mv $@-t $@ + cp -f $(srcdir)/getopt_.h $@-t + mv -f $@-t $@ MOSTLYCLEANFILES += getopt.h getopt.h-t ## end gnulib module getopt @@ -122,6 +122,12 @@ libm4_a_SOURCES += mbuiter.h ## end gnulib module mbuiter +## begin gnulib module mkstemp + +EXTRA_DIST += mkstemp.h + +## end gnulib module mkstemp + ## begin gnulib module regex EXTRA_DIST += regcomp.c regex.h regex_internal.c regex_internal.h regexec.c @@ -148,6 +154,7 @@ EXTRA_DIST += stdbool_.h # We need the following in order to create when the system # doesn't have one that works. stdbool.h: stdbool_.h + rm -f $@-t $@ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t mv $@-t $@ MOSTLYCLEANFILES += stdbool.h stdbool.h-t @@ -162,10 +169,11 @@ EXTRA_DIST += stdint_.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. stdint.h: stdint_.h + rm -f $@-t $@ sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ - -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ -e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \ + -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ @@ -216,6 +224,7 @@ EXTRA_DIST += stat_.h # has one that is incomplete. sys/stat.h: stat_.h test -d sys || mkdir sys + rm -f $@-t $@ sed -e 's|@''ABSOLUTE_SYS_STAT_H''@|$(ABSOLUTE_SYS_STAT_H)|g' \ < $(srcdir)/stat_.h > $@-t mv $@-t $@ @@ -310,5 +319,3 @@ mostlyclean-local: mostlyclean-generic echo "rmdir $$dir"; rmdir $$dir; \ fi; \ done - -# Makefile.am ends here diff -ruNp m4-1.4.6/lib/Makefile.in m4-1.4.7/lib/Makefile.in --- m4-1.4.6/lib/Makefile.in 2006-08-24 11:47:44.000000000 -0600 +++ m4-1.4.7/lib/Makefile.in 2006-09-25 06:07:59.000000000 -0600 @@ -93,7 +93,8 @@ LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libm4_a_AR = $(AR) $(ARFLAGS) -libm4_a_DEPENDENCIES = @LIBOBJS@ @ALLOCA@ +am__DEPENDENCIES_1 = @LIBOBJS@ +libm4_a_DEPENDENCIES = $(am__DEPENDENCIES_1) @ALLOCA@ am_libm4_a_OBJECTS = strnlen1.$(OBJEXT) verror.$(OBJEXT) \ xalloc-die.$(OBJEXT) xvasprintf.$(OBJEXT) xasprintf.$(OBJEXT) libm4_a_OBJECTS = $(am_libm4_a_OBJECTS) @@ -161,6 +162,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIBM4_LIBDEPS = @LIBM4_LIBDEPS@ +LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ @@ -239,14 +242,14 @@ libm4_a_SOURCES = binary-io.h exit.h get printf-parse.h vasnprintf.h vasprintf.h verror.h verror.c \ wcwidth.h xalloc-die.c xsize.h xvasprintf.h xvasprintf.c \ xasprintf.c -libm4_a_LIBADD = @LIBOBJS@ @ALLOCA@ +libm4_a_LIBADD = $(LIBOBJS) @ALLOCA@ noinst_HEADERS = EXTRA_DIST = alloca_.h cloexec.h close-stream.h exitfail.h \ stdio-safer.h stdio--.h __fpending.h getopt_.h getopt_int.h \ - regcomp.c regex.h regex_internal.c regex_internal.h regexec.c \ - stat-macros.h stdbool_.h stdint_.h stdlib-safer.h stdlib--.h \ - stat_.h stdio-safer.h stdio--.h unistd-safer.h unistd--.h \ - unlocked-io.h xalloc.h + mkstemp.h regcomp.c regex.h regex_internal.c regex_internal.h \ + regexec.c stat-macros.h stdbool_.h stdint_.h stdlib-safer.h \ + stdlib--.h stat_.h stdio-safer.h stdio--.h unistd-safer.h \ + unistd--.h unlocked-io.h xalloc.h BUILT_SOURCES = $(ALLOCA_H) $(GETOPT_H) $(STDBOOL_H) $(STDINT_H) \ $(SYS_STAT_H) $(UNISTD_H) SUFFIXES = @@ -486,28 +489,30 @@ uninstall-am: uninstall-info-am # We need the following in order to create when the system # doesn't have one that works with the given compiler. alloca.h: alloca_.h - cp $(srcdir)/alloca_.h $@-t - mv $@-t $@ + cp -f $(srcdir)/alloca_.h $@-t + mv -f $@-t $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. getopt.h: getopt_.h - cp $(srcdir)/getopt_.h $@-t - mv $@-t $@ + cp -f $(srcdir)/getopt_.h $@-t + mv -f $@-t $@ # We need the following in order to create when the system # doesn't have one that works. stdbool.h: stdbool_.h + rm -f $@-t $@ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t mv $@-t $@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. stdint.h: stdint_.h + rm -f $@-t $@ sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ - -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ -e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \ + -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ @@ -532,6 +537,7 @@ stdint.h: stdint_.h # has one that is incomplete. sys/stat.h: stat_.h test -d sys || mkdir sys + rm -f $@-t $@ sed -e 's|@''ABSOLUTE_SYS_STAT_H''@|$(ABSOLUTE_SYS_STAT_H)|g' \ < $(srcdir)/stat_.h > $@-t mv $@-t $@ @@ -548,8 +554,6 @@ mostlyclean-local: mostlyclean-generic echo "rmdir $$dir"; rmdir $$dir; \ fi; \ done - -# Makefile.am ends here # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff -ruNp m4-1.4.6/lib/__fpending.c m4-1.4.7/lib/__fpending.c --- m4-1.4.6/lib/__fpending.c 2006-08-24 11:36:00.000000000 -0600 +++ m4-1.4.7/lib/__fpending.c 2006-09-23 22:28:32.000000000 -0600 @@ -1,5 +1,5 @@ /* __fpending.c -- return the number of pending output bytes on a stream - Copyright (C) 2000, 2004 Free Software Foundation, Inc. + Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,9 +17,7 @@ /* Written by Jim Meyering. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include "__fpending.h" diff -ruNp m4-1.4.6/lib/alloca.c m4-1.4.7/lib/alloca.c --- m4-1.4.6/lib/alloca.c 2006-08-24 11:36:00.000000000 -0600 +++ m4-1.4.7/lib/alloca.c 2006-09-23 22:28:32.000000000 -0600 @@ -21,9 +21,7 @@ allocating any. It is a good idea to use alloca(0) in your main control loop, etc. to force garbage collection. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include diff -ruNp m4-1.4.6/lib/asnprintf.c m4-1.4.7/lib/asnprintf.c --- m4-1.4.6/lib/asnprintf.c 2006-08-24 11:36:01.000000000 -0600 +++ m4-1.4.7/lib/asnprintf.c 2006-09-23 22:28:33.000000000 -0600 @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,9 +15,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include /* Specification. */ #include "vasnprintf.h" diff -ruNp m4-1.4.6/lib/asprintf.c m4-1.4.7/lib/asprintf.c --- m4-1.4.6/lib/asprintf.c 2006-08-24 11:36:01.000000000 -0600 +++ m4-1.4.7/lib/asprintf.c 2006-09-23 22:28:33.000000000 -0600 @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,9 +15,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include /* Specification. */ #include "vasprintf.h" diff -ruNp m4-1.4.6/lib/cloexec.c m4-1.4.7/lib/cloexec.c --- m4-1.4.6/lib/cloexec.c 2006-08-24 11:36:01.000000000 -0600 +++ m4-1.4.7/lib/cloexec.c 2006-09-23 22:28:33.000000000 -0600 @@ -1,5 +1,6 @@ /* closexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 1991, 2004, 2005 Free Software Foundation, Inc. + + Copyright (C) 1991, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,9 +18,7 @@ The code is taken from glibc/manual/llio.texi */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include "cloexec.h" diff -ruNp m4-1.4.6/lib/close-stream.c m4-1.4.7/lib/close-stream.c --- m4-1.4.6/lib/close-stream.c 2006-08-24 11:36:01.000000000 -0600 +++ m4-1.4.7/lib/close-stream.c 2006-09-23 22:28:33.000000000 -0600 @@ -17,9 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include "close-stream.h" diff -ruNp m4-1.4.6/lib/dup-safer.c m4-1.4.7/lib/dup-safer.c --- m4-1.4.6/lib/dup-safer.c 2006-08-24 11:36:02.000000000 -0600 +++ m4-1.4.7/lib/dup-safer.c 2006-09-23 22:28:33.000000000 -0600 @@ -1,5 +1,6 @@ /* Invoke dup, but avoid some glitches. - Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. + + Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,9 +18,7 @@ /* Written by Paul Eggert. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include "unistd-safer.h" diff -ruNp m4-1.4.6/lib/error.c m4-1.4.7/lib/error.c --- m4-1.4.6/lib/error.c 2006-08-24 11:36:02.000000000 -0600 +++ m4-1.4.7/lib/error.c 2006-09-23 22:28:33.000000000 -0600 @@ -18,7 +18,7 @@ /* Written by David MacKenzie . */ -#ifdef HAVE_CONFIG_H +#if !_LIBC # include #endif @@ -92,23 +92,19 @@ extern void __error_at_line (int status, char *strerror_r (); # endif -# ifndef SIZE_MAX -# define SIZE_MAX ((size_t) -1) -# endif - /* The calling program should define program_name and set it to the name of the executing program. */ extern char *program_name; # if HAVE_STRERROR_R || defined strerror_r # define __strerror_r strerror_r -# endif +# endif /* HAVE_STRERROR_R || defined strerror_r */ #endif /* not _LIBC */ static void print_errno_message (int errnum) { - char const *s = NULL; + char const *s; #if defined HAVE_STRERROR_R || _LIBC char errbuf[1024]; @@ -117,11 +113,15 @@ print_errno_message (int errnum) # else if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) s = errbuf; + else + s = 0; # endif +#else + s = strerror (errnum); #endif #if !_LIBC - if (! s && ! (s = strerror (errnum))) + if (! s) s = _("Unknown system error"); #endif @@ -312,10 +312,10 @@ error_at_line (int status, int errnum, c #if _LIBC __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ", - file_name, line_number); + file_name, line_number); #else fprintf (stderr, file_name != NULL ? "%s:%d: " : " ", - file_name, line_number); + file_name, line_number); #endif va_start (args, message); diff -ruNp m4-1.4.6/lib/exitfail.c m4-1.4.7/lib/exitfail.c --- m4-1.4.6/lib/exitfail.c 2006-08-24 11:36:03.000000000 -0600 +++ m4-1.4.7/lib/exitfail.c 2006-09-23 22:28:34.000000000 -0600 @@ -1,6 +1,6 @@ /* Failure exit status - Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,9 +17,7 @@ If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include "exitfail.h" #include "exit.h" diff -ruNp m4-1.4.6/lib/fd-safer.c m4-1.4.7/lib/fd-safer.c --- m4-1.4.6/lib/fd-safer.c 2006-08-24 11:36:03.000000000 -0600 +++ m4-1.4.7/lib/fd-safer.c 2006-09-23 22:28:34.000000000 -0600 @@ -1,6 +1,6 @@ /* Return a safer copy of a file descriptor. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,9 +18,7 @@ /* Written by Paul Eggert. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include "unistd-safer.h" diff -ruNp m4-1.4.6/lib/fopen-safer.c m4-1.4.7/lib/fopen-safer.c --- m4-1.4.6/lib/fopen-safer.c 2006-08-24 11:36:03.000000000 -0600 +++ m4-1.4.7/lib/fopen-safer.c 2006-09-23 22:28:34.000000000 -0600 @@ -1,5 +1,6 @@ /* Invoke fopen, but avoid some glitches. - Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. + + Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,9 +18,7 @@ /* Written by Paul Eggert. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include "stdio-safer.h" diff -ruNp m4-1.4.6/lib/free.c m4-1.4.7/lib/free.c --- m4-1.4.6/lib/free.c 2006-08-24 11:36:03.000000000 -0600 +++ m4-1.4.7/lib/free.c 2006-09-23 22:28:34.000000000 -0600 @@ -1,6 +1,6 @@ /* Work around incompatibility on older systems where free (NULL) fails. - Copyright (C) 2003 Free Software Foundation, Inc. + Copyright (C) 2003, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,9 +18,7 @@ /* written by Paul Eggert */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #undef free #include diff -ruNp m4-1.4.6/lib/getopt.c m4-1.4.7/lib/getopt.c --- m4-1.4.6/lib/getopt.c 2006-08-24 11:36:04.000000000 -0600 +++ m4-1.4.7/lib/getopt.c 2006-09-23 22:28:34.000000000 -0600 @@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H +#ifndef _LIBC # include #endif diff -ruNp m4-1.4.6/lib/getopt1.c m4-1.4.7/lib/getopt1.c --- m4-1.4.6/lib/getopt1.c 2006-08-24 11:36:04.000000000 -0600 +++ m4-1.4.7/lib/getopt1.c 2006-09-23 22:28:35.000000000 -0600 @@ -1,5 +1,5 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004 + Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -17,13 +17,10 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H -# include -#endif - #ifdef _LIBC # include #else +# include # include "getopt.h" #endif #include "getopt_int.h" diff -ruNp m4-1.4.6/lib/malloc.c m4-1.4.7/lib/malloc.c --- m4-1.4.6/lib/malloc.c 2006-08-24 11:36:04.000000000 -0600 +++ m4-1.4.7/lib/malloc.c 2006-09-23 22:28:35.000000000 -0600 @@ -1,5 +1,6 @@ /* malloc() function that is glibc compatible. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. + + Copyright (C) 1997, 1998, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,9 +18,7 @@ /* written by Jim Meyering */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #undef malloc #include diff -ruNp m4-1.4.6/lib/mbchar.c m4-1.4.7/lib/mbchar.c --- m4-1.4.6/lib/mbchar.c 2006-08-24 11:36:05.000000000 -0600 +++ m4-1.4.7/lib/mbchar.c 2006-09-23 22:28:35.000000000 -0600 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,9 +15,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include diff -ruNp m4-1.4.6/lib/memchr.c m4-1.4.7/lib/memchr.c --- m4-1.4.6/lib/memchr.c 2006-08-24 11:36:05.000000000 -0600 +++ m4-1.4.7/lib/memchr.c 2006-09-23 22:28:36.000000000 -0600 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004 Free +/* Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004, 2006 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), @@ -24,7 +24,7 @@ You should have received a copy of the G along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H +#ifndef _LIBC # include #endif diff -ruNp m4-1.4.6/lib/mkstemp-safer.c m4-1.4.7/lib/mkstemp-safer.c --- m4-1.4.6/lib/mkstemp-safer.c 2006-08-24 11:36:05.000000000 -0600 +++ m4-1.4.7/lib/mkstemp-safer.c 2006-09-23 22:28:36.000000000 -0600 @@ -18,19 +18,13 @@ /* Written by Paul Eggert. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include "stdlib-safer.h" -#include +#include "mkstemp.h" #include "unistd-safer.h" -#if ! HAVE_MKSTEMP -int mkstemp (char *); -#endif - /* Like mkstemp, but do not return STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO. */ diff -ruNp m4-1.4.6/lib/mkstemp.c m4-1.4.7/lib/mkstemp.c --- m4-1.4.6/lib/mkstemp.c 2006-08-24 11:36:06.000000000 -0600 +++ m4-1.4.7/lib/mkstemp.c 2006-09-23 22:28:36.000000000 -0600 @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 2001, 2005, 2006 Free Software Foundation, Inc. This file is derived from the one in the GNU C Library. This program is free software; you can redistribute it and/or modify @@ -15,15 +15,12 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H +#if !_LIBC # include +# include "mkstemp.h" +int __gen_tempname (); #endif -/* Disable the definition of mkstemp to rpl_mkstemp (from config.h) in this - file. Otherwise, we'd get conflicting prototypes for rpl_mkstemp on - most systems. */ -#undef mkstemp - #include #include @@ -31,14 +28,13 @@ # define __GT_FILE 0 #endif -int __gen_tempname (); - /* Generate a unique temporary file name from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the file name unique. Then open the file and return a fd. */ int -rpl_mkstemp (char *template) +mkstemp (template) + char *template; { return __gen_tempname (template, __GT_FILE); } diff -ruNp m4-1.4.6/lib/mkstemp.h m4-1.4.7/lib/mkstemp.h --- m4-1.4.6/lib/mkstemp.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.7/lib/mkstemp.h 2006-09-23 22:28:36.000000000 -0600 @@ -0,0 +1,30 @@ +/* Create a unique temporary file. + + Copyright (C) 2006 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* written by Jim Meyering */ + +#include + +#ifdef __MKSTEMP_PREFIX +# define _GL_CONCAT(x, y) x ## y +# define _GL_XCONCAT(x, y) _GL_CONCAT (x, y) +# define __MKSTEMP_ID(y) _GL_XCONCAT (__MKSTEMP_PREFIX, y) +# undef mkstemp +# define mkstemp __MKSTEMP_ID (mkstemp) +int mkstemp (char *); +#endif diff -ruNp m4-1.4.6/lib/obstack.c m4-1.4.7/lib/obstack.c --- m4-1.4.6/lib/obstack.c 2006-08-24 11:36:06.000000000 -0600 +++ m4-1.4.7/lib/obstack.c 2006-09-23 22:28:36.000000000 -0600 @@ -18,14 +18,11 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H -# include -#endif - #ifdef _LIBC # include # include #else +# include # include "obstack.h" #endif diff -ruNp m4-1.4.6/lib/pipe-safer.c m4-1.4.7/lib/pipe-safer.c --- m4-1.4.6/lib/pipe-safer.c 2006-08-24 11:36:06.000000000 -0600 +++ m4-1.4.7/lib/pipe-safer.c 2006-09-23 22:28:36.000000000 -0600 @@ -17,9 +17,7 @@ /* Written by Jim Meyering. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include "unistd-safer.h" diff -ruNp m4-1.4.6/lib/printf-args.c m4-1.4.7/lib/printf-args.c --- m4-1.4.6/lib/printf-args.c 2006-08-24 11:36:06.000000000 -0600 +++ m4-1.4.7/lib/printf-args.c 2006-09-23 22:28:37.000000000 -0600 @@ -15,9 +15,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include /* Specification. */ #include "printf-args.h" diff -ruNp m4-1.4.6/lib/printf-parse.c m4-1.4.7/lib/printf-parse.c --- m4-1.4.6/lib/printf-parse.c 2006-08-24 11:36:07.000000000 -0600 +++ m4-1.4.7/lib/printf-parse.c 2006-09-23 22:28:37.000000000 -0600 @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999-2000, 2002-2003 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002-2003, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,9 +15,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include /* Specification. */ #if WIDE_CHAR_VERSION diff -ruNp m4-1.4.6/lib/regex.c m4-1.4.7/lib/regex.c --- m4-1.4.6/lib/regex.c 2006-08-24 11:36:07.000000000 -0600 +++ m4-1.4.7/lib/regex.c 2006-09-23 22:28:37.000000000 -0600 @@ -17,9 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include /* Make sure noone compiles this code with a C++ compiler. */ #if defined __cplusplus && defined _LIBC diff -ruNp m4-1.4.6/lib/regex_internal.c m4-1.4.7/lib/regex_internal.c --- m4-1.4.6/lib/regex_internal.c 2006-08-24 11:36:08.000000000 -0600 +++ m4-1.4.7/lib/regex_internal.c 2006-09-23 22:28:38.000000000 -0600 @@ -597,34 +597,98 @@ re_string_reconstruct (re_string_t *pstr if (BE (offset != 0, 1)) { - /* Are the characters which are already checked remain? */ - if (BE (offset < pstr->valid_raw_len, 1) -#ifdef RE_ENABLE_I18N - /* Handling this would enlarge the code too much. - Accept a slowdown in that case. */ - && pstr->offsets_needed == 0 -#endif - ) + /* Should the already checked characters be kept? */ + if (BE (offset < pstr->valid_raw_len, 1)) { /* Yes, move them to the front of the buffer. */ - pstr->tip_context = re_string_context_at (pstr, offset - 1, eflags); #ifdef RE_ENABLE_I18N - if (pstr->mb_cur_max > 1) - memmove (pstr->wcs, pstr->wcs + offset, - (pstr->valid_len - offset) * sizeof (wint_t)); + if (BE (pstr->offsets_needed, 0)) + { + Idx low = 0, high = pstr->valid_len, mid; + do + { + mid = (high + low) / 2; + if (pstr->offsets[mid] > offset) + high = mid; + else if (pstr->offsets[mid] < offset) + low = mid + 1; + else + break; + } + while (low < high); + if (pstr->offsets[mid] < offset) + ++mid; + pstr->tip_context = re_string_context_at (pstr, mid - 1, + eflags); + /* This can be quite complicated, so handle specially + only the common and easy case where the character with + different length representation of lower and upper + case is present at or after offset. */ + if (pstr->valid_len > offset + && mid == offset && pstr->offsets[mid] == offset) + { + memmove (pstr->wcs, pstr->wcs + offset, + (pstr->valid_len - offset) * sizeof (wint_t)); + memmove (pstr->mbs, pstr->mbs + offset, pstr->valid_len - offset); + pstr->valid_len -= offset; + pstr->valid_raw_len -= offset; + for (low = 0; low < pstr->valid_len; low++) + pstr->offsets[low] = pstr->offsets[low + offset] - offset; + } + else + { + /* Otherwise, just find out how long the partial multibyte + character at offset is and fill it with WEOF/255. */ + pstr->len = pstr->raw_len - idx + offset; + pstr->stop = pstr->raw_stop - idx + offset; + pstr->offsets_needed = 0; + while (mid > 0 && pstr->offsets[mid - 1] == offset) + --mid; + while (mid < pstr->valid_len) + if (pstr->wcs[mid] != WEOF) + break; + else + ++mid; + if (mid == pstr->valid_len) + pstr->valid_len = 0; + else + { + pstr->valid_len = pstr->offsets[mid] - offset; + if (pstr->valid_len) + { + for (low = 0; low < pstr->valid_len; ++low) + pstr->wcs[low] = WEOF; + memset (pstr->mbs, 255, pstr->valid_len); + } + } + pstr->valid_raw_len = pstr->valid_len; + } + } + else +#endif + { + pstr->tip_context = re_string_context_at (pstr, offset - 1, + eflags); +#ifdef RE_ENABLE_I18N + if (pstr->mb_cur_max > 1) + memmove (pstr->wcs, pstr->wcs + offset, + (pstr->valid_len - offset) * sizeof (wint_t)); #endif /* RE_ENABLE_I18N */ - if (BE (pstr->mbs_allocated, 0)) - memmove (pstr->mbs, pstr->mbs + offset, - pstr->valid_len - offset); - pstr->valid_len -= offset; - pstr->valid_raw_len -= offset; + if (BE (pstr->mbs_allocated, 0)) + memmove (pstr->mbs, pstr->mbs + offset, + pstr->valid_len - offset); + pstr->valid_len -= offset; + pstr->valid_raw_len -= offset; #if DEBUG - assert (pstr->valid_len > 0); + assert (pstr->valid_len > 0); #endif + } } else { /* No, skip all characters until IDX. */ + Idx prev_valid_len = pstr->valid_len; + #ifdef RE_ENABLE_I18N if (BE (pstr->offsets_needed, 0)) { @@ -648,6 +712,8 @@ re_string_reconstruct (re_string_t *pstr byte other than 0x80 - 0xbf. */ raw = pstr->raw_mbs + pstr->raw_mbs_idx; end = raw + (offset - pstr->mb_cur_max); + if (end < pstr->raw_mbs) + end = pstr->raw_mbs; p = raw + offset - 1; #ifdef _LIBC /* We know the wchar_t encoding is UCS4, so for the simple @@ -655,7 +721,7 @@ re_string_reconstruct (re_string_t *pstr if (isascii (*p) && BE (pstr->trans == NULL, 1)) { memset (&pstr->cur_state, '\0', sizeof (mbstate_t)); - pstr->valid_len = 0; + /* pstr->valid_len = 0; */ wc = (wchar_t) *p; } else @@ -698,7 +764,7 @@ re_string_reconstruct (re_string_t *pstr pstr->valid_len = re_string_skip_chars (pstr, idx, &wc) - idx; if (wc == WEOF) pstr->tip_context - = re_string_context_at (pstr, pstr->valid_raw_len - 1, eflags); + = re_string_context_at (pstr, prev_valid_len - 1, eflags); else pstr->tip_context = ((BE (pstr->word_ops_used != 0, 0) && IS_WIDE_WORD_CHAR (wc)) @@ -711,7 +777,7 @@ re_string_reconstruct (re_string_t *pstr for (wcs_idx = 0; wcs_idx < pstr->valid_len; ++wcs_idx) pstr->wcs[wcs_idx] = WEOF; if (pstr->mbs_allocated) - memset (pstr->mbs, -1, pstr->valid_len); + memset (pstr->mbs, 255, pstr->valid_len); } pstr->valid_raw_len = pstr->valid_len; } @@ -1340,7 +1406,6 @@ static Idx internal_function re_dfa_add_node (re_dfa_t *dfa, re_token_t token) { - int type = token.type; if (BE (dfa->nodes_len >= dfa->nodes_alloc, 0)) { size_t new_nodes_alloc = dfa->nodes_alloc * 2; @@ -1376,8 +1441,11 @@ re_dfa_add_node (re_dfa_t *dfa, re_token dfa->nodes[dfa->nodes_len] = token; dfa->nodes[dfa->nodes_len].constraint = 0; #ifdef RE_ENABLE_I18N + { + int type = token.type; dfa->nodes[dfa->nodes_len].accept_mb = (type == OP_PERIOD && dfa->mb_cur_max > 1) || type == COMPLEX_BRACKET; + } #endif dfa->nexts[dfa->nodes_len] = REG_MISSING; re_node_set_init_empty (dfa->edests + dfa->nodes_len); diff -ruNp m4-1.4.6/lib/stdint_.h m4-1.4.7/lib/stdint_.h --- m4-1.4.6/lib/stdint_.h 2006-08-24 11:36:09.000000000 -0600 +++ m4-1.4.7/lib/stdint_.h 2006-09-23 22:28:38.000000000 -0600 @@ -62,7 +62,9 @@ /* In OpenBSD 3.8, includes , which defines int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. also defines intptr_t and uintptr_t. */ +# define _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H # include +# undef _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H #elif @HAVE_SYS_INTTYPES_H@ /* Solaris 7 has the types except the *_fast*_t types, and the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ diff -ruNp m4-1.4.6/lib/stdlib--.h m4-1.4.7/lib/stdlib--.h --- m4-1.4.6/lib/stdlib--.h 2006-08-24 11:36:10.000000000 -0600 +++ m4-1.4.7/lib/stdlib--.h 2006-09-23 22:28:39.000000000 -0600 @@ -1,6 +1,6 @@ /* Like stdlib.h, but redefine some names to avoid glitches. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,5 +21,6 @@ #include #include "stdlib-safer.h" +#include "mkstemp.h" #undef mkstemp #define mkstemp mkstemp_safer diff -ruNp m4-1.4.6/lib/strcasecmp.c m4-1.4.7/lib/strcasecmp.c --- m4-1.4.6/lib/strcasecmp.c 2006-08-24 11:36:10.000000000 -0600 +++ m4-1.4.7/lib/strcasecmp.c 2006-09-23 22:28:39.000000000 -0600 @@ -1,5 +1,5 @@ /* Case-insensitive string comparison function. - Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006 Free Software Foundation, Inc. Written by Bruno Haible , 2005, based on earlier glibc code. @@ -17,9 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include /* Specification. */ #include "strcase.h" diff -ruNp m4-1.4.6/lib/strncasecmp.c m4-1.4.7/lib/strncasecmp.c --- m4-1.4.6/lib/strncasecmp.c 2006-08-24 11:36:10.000000000 -0600 +++ m4-1.4.7/lib/strncasecmp.c 2006-09-23 22:28:39.000000000 -0600 @@ -1,5 +1,5 @@ /* strncasecmp.c -- case insensitive string comparator - Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,9 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include /* Specification. */ #include "strcase.h" diff -ruNp m4-1.4.6/lib/strnlen1.c m4-1.4.7/lib/strnlen1.c --- m4-1.4.6/lib/strnlen1.c 2006-08-24 11:36:11.000000000 -0600 +++ m4-1.4.7/lib/strnlen1.c 2006-09-23 22:28:39.000000000 -0600 @@ -1,5 +1,5 @@ /* Find the length of STRING + 1, but scan at most MAXLEN bytes. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005-2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,9 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include /* Specification. */ #include "strnlen1.h" diff -ruNp m4-1.4.6/lib/strtol.c m4-1.4.7/lib/strtol.c --- m4-1.4.6/lib/strtol.c 2006-08-24 11:36:11.000000000 -0600 +++ m4-1.4.7/lib/strtol.c 2006-09-23 22:28:40.000000000 -0600 @@ -20,12 +20,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H -# include -#endif - #ifdef _LIBC # define USE_NUMBER_GROUPING +#else +# include #endif #include diff -ruNp m4-1.4.6/lib/tempname.c m4-1.4.7/lib/tempname.c --- m4-1.4.6/lib/tempname.c 2006-08-24 11:36:11.000000000 -0600 +++ m4-1.4.7/lib/tempname.c 2006-09-23 22:28:40.000000000 -0600 @@ -17,7 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H +#if !_LIBC # include #endif @@ -213,11 +213,15 @@ __gen_tempname (char *tmpl, int kind) necessary to try all these combinations. Instead if a reasonable number of names is tried (we define reasonable as 62**3) fail to give the system administrator the chance to remove the problems. */ - unsigned int attempts_min = 62 * 62 * 62; +#define ATTEMPTS_MIN (62 * 62 * 62) /* The number of times to attempt to generate a temporary file. To conform to POSIX, this must be no smaller than TMP_MAX. */ - unsigned int attempts = attempts_min < TMP_MAX ? TMP_MAX : attempts_min; +#if ATTEMPTS_MIN < TMP_MAX + unsigned int attempts = TMP_MAX; +#else + unsigned int attempts = ATTEMPTS_MIN; +#endif len = strlen (tmpl); if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX")) diff -ruNp m4-1.4.6/lib/tmpfile-safer.c m4-1.4.7/lib/tmpfile-safer.c --- m4-1.4.6/lib/tmpfile-safer.c 2006-08-24 11:36:11.000000000 -0600 +++ m4-1.4.7/lib/tmpfile-safer.c 2006-09-23 22:28:40.000000000 -0600 @@ -17,9 +17,7 @@ /* Written by Eric Blake, based on ideas from Paul Eggert. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include "stdio-safer.h" diff -ruNp m4-1.4.6/lib/vasnprintf.c m4-1.4.7/lib/vasnprintf.c --- m4-1.4.6/lib/vasnprintf.c 2006-08-24 11:36:12.000000000 -0600 +++ m4-1.4.7/lib/vasnprintf.c 2006-09-23 22:28:40.000000000 -0600 @@ -22,9 +22,7 @@ # define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif +#include #ifndef IN_LIBINTL # include #endif @@ -40,7 +38,7 @@ #include /* abort(), malloc(), realloc(), free() */ #include /* memcpy(), strlen() */ #include /* errno */ -#include /* CHAR_BIT, INT_MAX */ +#include /* CHAR_BIT */ #include /* DBL_MAX_EXP, LDBL_MAX_EXP */ #if WIDE_CHAR_VERSION # include "wprintf-parse.h" @@ -51,11 +49,6 @@ /* Checked size_t computations. */ #include "xsize.h" -/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ -#ifndef EOVERFLOW -# define EOVERFLOW E2BIG -#endif - #ifdef HAVE_WCHAR_T # ifdef HAVE_WCSLEN # define local_wcslen wcslen @@ -869,19 +862,12 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l free (buf_malloced); CLEANUP (); *lengthp = length; - if (length > INT_MAX) - goto length_overflow; + /* Note that we can produce a big string of a length > INT_MAX. POSIX + says that snprintf() fails with errno = EOVERFLOW in this case, but + that's only because snprintf() returns an 'int'. This function does + not have this limitation. */ return result; - length_overflow: - /* We could produce such a big string, but its length doesn't fit into - an 'int'. POSIX says that snprintf() fails with errno = EOVERFLOW in - this case. */ - if (result != resultbuf) - free (result); - errno = EOVERFLOW; - return NULL; - out_of_memory: if (!(result == resultbuf || result == NULL)) free (result); diff -ruNp m4-1.4.6/lib/vasprintf.c m4-1.4.7/lib/vasprintf.c --- m4-1.4.6/lib/vasprintf.c 2006-08-24 11:36:12.000000000 -0600 +++ m4-1.4.7/lib/vasprintf.c 2006-09-23 22:28:41.000000000 -0600 @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,17 +15,22 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include /* Specification. */ #include "vasprintf.h" +#include +#include #include #include "vasnprintf.h" +/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ +#ifndef EOVERFLOW +# define EOVERFLOW E2BIG +#endif + int vasprintf (char **resultp, const char *format, va_list args) { @@ -34,9 +39,14 @@ vasprintf (char **resultp, const char *f if (result == NULL) return -1; + if (length > INT_MAX) + { + free (result); + errno = EOVERFLOW; + return -1; + } + *resultp = result; - /* Return the number of resulting bytes, excluding the trailing NUL. - If it wouldn't fit in an 'int', vasnprintf() would have returned NULL - and set errno to EOVERFLOW. */ + /* Return the number of resulting bytes, excluding the trailing NUL. */ return length; } diff -ruNp m4-1.4.6/lib/xalloc-die.c m4-1.4.7/lib/xalloc-die.c --- m4-1.4.6/lib/xalloc-die.c 2006-08-24 11:36:13.000000000 -0600 +++ m4-1.4.7/lib/xalloc-die.c 2006-09-23 22:28:41.000000000 -0600 @@ -17,9 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include "xalloc.h" diff -ruNp m4-1.4.6/lib/xmalloc.c m4-1.4.7/lib/xmalloc.c --- m4-1.4.6/lib/xmalloc.c 2006-08-24 11:36:14.000000000 -0600 +++ m4-1.4.7/lib/xmalloc.c 2006-09-23 22:28:41.000000000 -0600 @@ -1,7 +1,8 @@ /* xmalloc.c -- malloc with out of memory checking Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + 1999, 2000, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, + Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,9 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include "xalloc.h" diff -ruNp m4-1.4.6/m4/codeset.m4 m4-1.4.7/m4/codeset.m4 --- m4-1.4.6/m4/codeset.m4 2006-08-24 11:36:15.000000000 -0600 +++ m4-1.4.7/m4/codeset.m4 2006-09-23 22:28:42.000000000 -0600 @@ -1,5 +1,5 @@ -# codeset.m4 serial AM1 (gettext-0.10.40) -dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. +# codeset.m4 serial 2 (gettext-0.15.1) +dnl Copyright (C) 2000-2002, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -10,7 +10,7 @@ AC_DEFUN([AM_LANGINFO_CODESET], [ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, [AC_TRY_LINK([#include ], - [char* cs = nl_langinfo(CODESET);], + [char* cs = nl_langinfo(CODESET); return !cs;], am_cv_langinfo_codeset=yes, am_cv_langinfo_codeset=no) ]) diff -ruNp m4-1.4.6/m4/gnulib-cache.m4 m4-1.4.7/m4/gnulib-cache.m4 --- m4-1.4.6/m4/gnulib-cache.m4 2006-08-22 14:46:10.000000000 -0600 +++ m4-1.4.7/m4/gnulib-cache.m4 2006-09-07 16:48:15.000000000 -0600 @@ -18,6 +18,7 @@ # gnulib-tool --import --dir=. --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=M4 binary-io cloexec close-stream error fdl fopen-safer free gendocs getopt gnupload mkstemp obstack regex stdlib-safer strtol tmpfile-safer unlocked-io verror xalloc xvasprintf # Specification in the form of a few gnulib-tool.m4 macro invocations: +gl_LOCAL_DIR([]) gl_MODULES([binary-io cloexec close-stream error fdl fopen-safer free gendocs getopt gnupload mkstemp obstack regex stdlib-safer strtol tmpfile-safer unlocked-io verror xalloc xvasprintf]) gl_AVOID([]) gl_SOURCE_BASE([lib]) @@ -25,4 +26,5 @@ gl_M4_BASE([m4]) gl_DOC_BASE([doc]) gl_TESTS_BASE([tests]) gl_LIB([libm4]) +gl_MAKEFILE_NAME([]) gl_MACRO_PREFIX([M4]) diff -ruNp m4-1.4.6/m4/gnulib-comp.m4 m4-1.4.7/m4/gnulib-comp.m4 --- m4-1.4.6/m4/gnulib-comp.m4 2006-08-24 11:36:38.000000000 -0600 +++ m4-1.4.7/m4/gnulib-comp.m4 2006-09-23 22:29:02.000000000 -0600 @@ -31,6 +31,10 @@ AC_DEFUN([M4_EARLY], AC_DEFUN([M4_INIT], [ AM_CONDITIONAL([GL_COND_LIBTOOL], [false]) + gl_cond_libtool=false + gl_libdeps= + gl_ltlibdeps= + gl_source_base='lib' gl_FUNC_ALLOCA gl_CLOEXEC gl_CLOSE_STREAM @@ -69,6 +73,10 @@ AC_DEFUN([M4_INIT], gl_XALLOC gl_XSIZE gl_XVASPRINTF + LIBM4_LIBDEPS="$gl_libdeps" + AC_SUBST([LIBM4_LIBDEPS]) + LIBM4_LTLIBDEPS="$gl_ltlibdeps" + AC_SUBST([LIBM4_LTLIBDEPS]) ]) # This macro records the list of files which have been installed by @@ -110,6 +118,7 @@ AC_DEFUN([M4_FILE_LIST], [ lib/memchr.c lib/mkstemp-safer.c lib/mkstemp.c + lib/mkstemp.h lib/obstack.c lib/obstack.h lib/pipe-safer.c diff -ruNp m4-1.4.6/m4/mkstemp.m4 m4-1.4.7/m4/mkstemp.m4 --- m4-1.4.6/m4/mkstemp.m4 2006-08-24 11:36:18.000000000 -0600 +++ m4-1.4.7/m4/mkstemp.m4 2006-09-23 22:28:44.000000000 -0600 @@ -1,4 +1,4 @@ -#serial 13 +#serial 14 # Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -12,46 +12,41 @@ # only 32 files per process. # On systems like the above, arrange to use the replacement function. AC_DEFUN([gl_FUNC_MKSTEMP], -[dnl - AC_REPLACE_FUNCS(mkstemp) - if test $ac_cv_func_mkstemp = no; then - gl_cv_func_mkstemp_limitations=yes - else - AC_CACHE_CHECK([for mkstemp limitations], - gl_cv_func_mkstemp_limitations, - [ - mkdir conftest.mkstemp - AC_TRY_RUN([ -# include -# include - int main () - { - int i; - for (i = 0; i < 70; i++) - { - char template[] = "conftest.mkstemp/coXXXXXX"; - int fd = mkstemp (template); - if (fd == -1) - exit (1); - close (fd); - } - exit (0); - } - ], - gl_cv_func_mkstemp_limitations=no, - gl_cv_func_mkstemp_limitations=yes, - gl_cv_func_mkstemp_limitations=yes - ) - rm -rf conftest.mkstemp - ] - ) - fi +[ + AC_REQUIRE([AC_SYS_LARGEFILE]) + + AC_CACHE_CHECK([for working mkstemp], + [gl_cv_func_working_mkstemp], + [ + mkdir conftest.mkstemp + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [AC_INCLUDES_DEFAULT], + [[int i; + off_t large = (off_t) 4294967295u; + if (large < 0) + large = 2147483647; + for (i = 0; i < 70; i++) + { + char template[] = "conftest.mkstemp/coXXXXXX"; + int (*mkstemp_function) (char *) = mkstemp; + int fd = mkstemp_function (template); + if (fd < 0 || lseek (fd, large, SEEK_SET) != large) + return 1; + close (fd); + } + return 0;]])], + [gl_cv_func_working_mkstemp=yes], + [gl_cv_func_working_mkstemp=no], + [gl_cv_func_working_mkstemp=no]) + rm -rf conftest.mkstemp + ]) - if test $gl_cv_func_mkstemp_limitations = yes; then + if test $gl_cv_func_working_mkstemp != yes; then + AC_DEFINE([__MKSTEMP_PREFIX], [[rpl_]], + [Define to rpl_ if the mkstemp replacement function should be used.]) AC_LIBOBJ(mkstemp) AC_LIBOBJ(tempname) - AC_DEFINE(mkstemp, rpl_mkstemp, - [Define to rpl_mkstemp if the replacement function should be used.]) gl_PREREQ_MKSTEMP gl_PREREQ_TEMPNAME fi diff -ruNp m4-1.4.6/m4/regex.m4 m4-1.4.7/m4/regex.m4 --- m4-1.4.6/m4/regex.m4 2006-08-24 11:36:18.000000000 -0600 +++ m4-1.4.7/m4/regex.m4 2006-09-23 22:28:44.000000000 -0600 @@ -1,4 +1,4 @@ -#serial 39 +#serial 40 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006 Free Software Foundation, Inc. @@ -14,6 +14,8 @@ AC_PREREQ([2.50]) AC_DEFUN([gl_REGEX], [ + AC_CHECK_HEADERS_ONCE([locale.h]) + AC_ARG_WITH([included-regex], [AC_HELP_STRING([--without-included-regex], [don't compile regex; this is the default on @@ -34,6 +36,9 @@ AC_DEFUN([gl_REGEX], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [AC_INCLUDES_DEFAULT + #if HAVE_LOCALE_H + #include + #endif #include #include ], @@ -42,6 +47,33 @@ AC_DEFUN([gl_REGEX], int i; const char *s; struct re_registers regs; + + #if HAVE_LOCALE_H + /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html + This test needs valgrind to catch the bug on Debian + GNU/Linux 3.1 x86, but it might catch the bug better + on other platforms and it shouldn't hurt to try the + test here. */ + if (setlocale (LC_ALL, "en_US.UTF-8")) + { + static char const pat[] = "insert into"; + static char const data[] = + "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK"; + re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE + | RE_ICASE); + memset (®ex, 0, sizeof regex); + s = re_compile_pattern (pat, sizeof pat - 1, ®ex); + if (s) + return 1; + if (re_search (®ex, data, sizeof data - 1, + 0, sizeof data - 1, ®s) + != -1) + return 1; + if (! setlocale (LC_ALL, "C")) + return 1; + } + #endif + re_set_syntax (RE_SYNTAX_POSIX_EGREP); memset (®ex, 0, sizeof (regex)); for (i = 0; i <= UCHAR_MAX; i++) @@ -161,7 +193,7 @@ AC_DEFUN([gl_PREREQ_REGEX], AC_REQUIRE([AC_GNU_SOURCE]) AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([AM_LANGINFO_CODESET]) - AC_CHECK_HEADERS_ONCE([locale.h wchar.h wctype.h]) + AC_CHECK_HEADERS_ONCE([wchar.h wctype.h]) AC_CHECK_FUNCS_ONCE([mbrtowc mempcpy wcrtomb wcscoll]) AC_CHECK_DECLS([isblank], [], [], [#include ]) ]) diff -ruNp m4-1.4.6/m4/signed.m4 m4-1.4.7/m4/signed.m4 --- m4-1.4.6/m4/signed.m4 2006-08-24 11:36:18.000000000 -0600 +++ m4-1.4.7/m4/signed.m4 2006-09-23 22:28:44.000000000 -0600 @@ -1,5 +1,5 @@ -# signed.m4 serial 1 (gettext-0.10.40) -dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. +# signed.m4 serial 2 +dnl Copyright (C) 2001-2002, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,7 +9,8 @@ dnl From Bruno Haible. AC_DEFUN([bh_C_SIGNED], [ AC_CACHE_CHECK([for signed], bh_cv_c_signed, - [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)]) + [AC_TRY_COMPILE(, [signed char x; return !x;], + bh_cv_c_signed=yes, bh_cv_c_signed=no)]) if test $bh_cv_c_signed = no; then AC_DEFINE(signed, , [Define to empty if the C compiler doesn't support this keyword.]) diff -ruNp m4-1.4.6/m4/vasprintf.m4 m4-1.4.7/m4/vasprintf.m4 --- m4-1.4.6/m4/vasprintf.m4 2006-08-24 11:36:22.000000000 -0600 +++ m4-1.4.7/m4/vasprintf.m4 2006-09-23 22:28:46.000000000 -0600 @@ -1,5 +1,5 @@ -# vasprintf.m4 serial 1 -dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +# vasprintf.m4 serial 2 +dnl Copyright (C) 2002-2003, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,11 +9,19 @@ AC_DEFUN([gl_FUNC_VASPRINTF], AC_REPLACE_FUNCS(vasprintf) if test $ac_cv_func_vasprintf = no; then AC_LIBOBJ(asprintf) + gl_PREREQ_VASPRINTF_H gl_PREREQ_VASPRINTF gl_PREREQ_ASPRINTF fi ]) +# Prerequisites of lib/vasprintf.h. +AC_DEFUN([gl_PREREQ_VASPRINTF_H], +[ + dnl Persuade glibc to declare asprintf() and vasprintf(). + AC_REQUIRE([AC_GNU_SOURCE]) +]) + # Prerequisites of lib/vasprintf.c. AC_DEFUN([gl_PREREQ_VASPRINTF], [ diff -ruNp m4-1.4.6/src/Makefile.am m4-1.4.7/src/Makefile.am --- m4-1.4.6/src/Makefile.am 2006-07-04 12:30:02.000000000 -0600 +++ m4-1.4.7/src/Makefile.am 2006-09-11 07:17:21.000000000 -0600 @@ -26,4 +26,4 @@ macro.c output.c path.c symtab.c if STACKOVF m4_SOURCES += stackovf.c endif -m4_LDADD = ../lib/libm4.a +m4_LDADD = ../lib/libm4.a $(LIBM4_LIBDEPS) diff -ruNp m4-1.4.6/src/Makefile.in m4-1.4.7/src/Makefile.in --- m4-1.4.6/src/Makefile.in 2006-08-24 11:47:45.000000000 -0600 +++ m4-1.4.7/src/Makefile.in 2006-09-25 06:08:00.000000000 -0600 @@ -83,7 +83,8 @@ am_m4_OBJECTS = m4.$(OBJEXT) builtin.$(O input.$(OBJEXT) macro.$(OBJEXT) output.$(OBJEXT) \ path.$(OBJEXT) symtab.$(OBJEXT) $(am__objects_1) m4_OBJECTS = $(am_m4_OBJECTS) -m4_DEPENDENCIES = ../lib/libm4.a +am__DEPENDENCIES_1 = +m4_DEPENDENCIES = ../lib/libm4.a $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -147,6 +148,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIBM4_LIBDEPS = @LIBM4_LIBDEPS@ +LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ @@ -221,7 +224,7 @@ target_alias = @target_alias@ AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib m4_SOURCES = m4.h m4.c builtin.c debug.c eval.c format.c freeze.c \ input.c macro.c output.c path.c symtab.c $(am__append_1) -m4_LDADD = ../lib/libm4.a +m4_LDADD = ../lib/libm4.a $(LIBM4_LIBDEPS) all: all-am .SUFFIXES: diff -ruNp m4-1.4.6/src/builtin.c m4-1.4.7/src/builtin.c --- m4-1.4.6/src/builtin.c 2006-08-24 07:43:14.000000000 -0600 +++ m4-1.4.7/src/builtin.c 2006-09-11 07:17:21.000000000 -0600 @@ -456,7 +456,11 @@ define_macro (int argc, token_data **arg return; if (TOKEN_DATA_TYPE (argv[1]) != TOKEN_TEXT) - return; + { + M4ERROR ((warning_status, 0, + "Warning: %s: invalid macro name ignored", ARG (0))); + return; + } if (argc == 2) { @@ -1171,7 +1175,7 @@ include (int argc, token_data **argv, bo return; } - push_file (fp, name); + push_file (fp, name, TRUE); free ((char *) name); } @@ -1287,15 +1291,16 @@ m4_m4exit (struct obstack *obs, int argc "exit status out of range: `%d'", exit_code)); exit_code = EXIT_FAILURE; } + /* Change debug stream back to stderr, to force flushing debug stream and + detect any errors it might have encountered. */ + debug_set_output (NULL); + debug_flush_files (); if (close_stream (stdout) != 0) { M4ERROR ((warning_status, errno, "write error")); if (exit_code == 0) exit_code = EXIT_FAILURE; } - /* Change debug stream back to stderr, to force flushing debug stream and - detect any errors it might have encountered. */ - debug_set_output (NULL); if (exit_code == 0 && retcode != 0) exit_code = retcode; exit (exit_code); diff -ruNp m4-1.4.6/src/debug.c m4-1.4.7/src/debug.c --- m4-1.4.6/src/debug.c 2006-08-23 05:28:14.000000000 -0600 +++ m4-1.4.7/src/debug.c 2006-09-11 07:17:21.000000000 -0600 @@ -142,7 +142,7 @@ debug_set_file (FILE *fp) if (debug != NULL && debug != stdout) { - if (fstat (fileno (stdout), &stdout_stat) < 0) + if (fstat (STDOUT_FILENO, &stdout_stat) < 0) return; if (fstat (fileno (debug), &debug_stat) < 0) return; @@ -175,6 +175,27 @@ debug_flush_files (void) fflush (stderr); if (debug != NULL && debug != stdout && debug != stderr) fflush (debug); + /* POSIX requires that if m4 doesn't consume all input, but stdin is + opened on a seekable file, that the file pointer be left at the + next character on exit (but places no restrictions on the file + pointer location on a non-seekable file). It also requires that + fflush() followed by fseek() on an input file set the underlying + file pointer. However, fflush() on a non-seekable file can lose + buffered data, which we might otherwise want to process after + syscmd. Hence, we must check whether stdin is seekable. We must + also be tolerant of operating with stdin closed, so we don't + report any failures in this attempt. The stdio-safer module and + friends are essential, so that if stdin was closed, this lseek is + not on some other file that we have since opened. Mingw has bugs + when using fseek on text files, so we only strive for POSIX + behavior when we detect a UNIX environment. */ +#if UNIX + if (lseek (STDIN_FILENO, 0, SEEK_CUR) >= 0 + && fflush (stdin) == 0) + { + fseek (stdin, 0, SEEK_CUR); + } +#endif /* UNIX */ } /*-------------------------------------------------------------------------. diff -ruNp m4-1.4.6/src/input.c m4-1.4.7/src/input.c --- m4-1.4.6/src/input.c 2006-08-22 18:20:13.000000000 -0600 +++ m4-1.4.7/src/input.c 2006-09-07 16:48:15.000000000 -0600 @@ -82,10 +82,11 @@ struct input_block struct { FILE *file; /* input file handle */ + boolean end; /* true if peek has seen EOF */ + boolean close; /* true if we should close file on pop */ const char *name; /* name of PREVIOUS input file */ - int lineno; /* current line number for do */ - /* Yet another attack of "The curse of global variables" (sic) */ - int out_lineno; /* current output line number do */ + int lineno; /* current line of previous file */ + int out_lineno; /* current output line of previous file */ boolean advance_line; /* start_of_input_line from next_char () */ } u_f; @@ -156,14 +157,16 @@ static const char *token_type_string (to #endif -/*-------------------------------------------------------------------------. -| push_file () pushes an input file on the input stack, saving the current | -| file name and line number. If next is non-NULL, this push invalidates a | -| call to push_string_init (), whose storage are consequentely released. | -`-------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| push_file () pushes an input file on the input stack, saving the | +| current file name and line number. If next is non-NULL, this push | +| invalidates a call to push_string_init (), whose storage is | +| consequently released. If CLOSE, then close FP after EOF is | +| detected. | +`-------------------------------------------------------------------*/ void -push_file (FILE *fp, const char *title) +push_file (FILE *fp, const char *title, boolean close) { input_block *i; @@ -180,6 +183,8 @@ push_file (FILE *fp, const char *title) sizeof (struct input_block)); i->type = INPUT_FILE; + i->u.u_f.end = FALSE; + i->u.u_f.close = close; i->u.u_f.name = current_file; i->u.u_f.lineno = current_line; i->u.u_f.out_lineno = output_current_line; @@ -325,7 +330,7 @@ pop_input (void) fclose (isp->u.u_f.file); retcode = EXIT_FAILURE; } - else if (fclose (isp->u.u_f.file) == EOF) + else if (isp->u.u_f.close && fclose (isp->u.u_f.file) == EOF) { M4ERROR ((warning_status, errno, "error reading file")); retcode = EXIT_FAILURE; @@ -445,6 +450,7 @@ peek_input (void) ungetc (ch, isp->u.u_f.file); return ch; } + isp->u.u_f.end = TRUE; break; case INPUT_MACRO: @@ -455,8 +461,12 @@ peek_input (void) "INTERNAL ERROR: input stack botch in peek_input ()")); abort (); } - /* End of input source --- pop one level. */ - pop_input (); + /* End of current input source --- pop one level if another + level still exists. */ + if (isp->prev != NULL) + pop_input (); + else + return CHAR_EOF; } } @@ -500,7 +510,10 @@ next_char_1 (void) break; case INPUT_FILE: - ch = getc (isp->u.u_f.file); + /* If stdin is a terminal, calling getc after peek_input + already called it would make the user have to hit ^D + twice to quit. */ + ch = isp->u.u_f.end ? EOF : getc (isp->u.u_f.file); if (ch != EOF) { if (ch == '\n') @@ -783,18 +796,20 @@ next_token (token_data *td) obstack_1grow (&token_stack, '\0'); token_bottom = obstack_finish (&token_stack); + /* Can't consume character until after CHAR_MACRO is handled. */ ch = peek_input (); if (ch == CHAR_EOF) { #ifdef DEBUG_INPUT fprintf (stderr, "next_token -> EOF\n"); #endif + next_char (); return TOKEN_EOF; } if (ch == CHAR_MACRO) { init_macro_token (td); - (void) next_char (); + next_char (); #ifdef DEBUG_INPUT fprintf (stderr, "next_token -> MACDEF (%s)\n", find_builtin_by_addr (TOKEN_DATA_FUNC (td))->name); @@ -802,7 +817,7 @@ next_token (token_data *td) return TOKEN_MACDEF; } - (void) next_char (); + next_char (); /* Consume character we already peeked at. */ if (MATCH (ch, bcomm.string, TRUE)) { obstack_grow (&token_stack, bcomm.string, bcomm.length); diff -ruNp m4-1.4.6/src/m4.c m4-1.4.7/src/m4.c --- m4-1.4.6/src/m4.c 2006-08-09 05:51:02.000000000 -0600 +++ m4-1.4.7/src/m4.c 2006-09-20 22:13:22.000000000 -0600 @@ -22,13 +22,11 @@ #include "m4.h" #include +#include #include static void usage (int); -/* Operate interactively (-e). */ -static int interactive = 0; - /* Enable sync output for /lib/cpp (-s). */ int sync_output = 0; @@ -61,21 +59,9 @@ int nesting_limit = 1024; const char *user_word_regexp = ""; #endif -/* Name of frozen file to digest after initialization. */ -const char *frozen_file_to_read = NULL; - -/* Name of frozen file to produce near completion. */ -const char *frozen_file_to_write = NULL; - /* The name this program was run with. */ const char *program_name; -/* If non-zero, display usage information and exit. */ -static int show_help = 0; - -/* If non-zero, print the version on standard output and exit. */ -static int show_version = 0; - struct macro_definition { struct macro_definition *next; @@ -96,7 +82,7 @@ m4_error (int status, int errnum, const va_list args; va_start (args, format); verror_at_line (status, errnum, current_line ? current_file : NULL, - current_line, format, args); + current_line, format, args); } /*-------------------------------. @@ -105,7 +91,7 @@ m4_error (int status, int errnum, const void m4_error_at_line (int status, int errnum, const char *file, int line, - const char *format, ...) + const char *format, ...) { va_list args; va_start (args, format); @@ -153,7 +139,7 @@ Operation modes:\n\ --help display this help and exit\n\ --version output version information and exit\n\ -E, --fatal-warnings stop execution after first warning\n\ - -e, --interactive unbuffer output, ignore interrupts\n\ + -i, --interactive unbuffer output, ignore interrupts\n\ -P, --prefix-builtins force a `m4_' prefix to all builtins\n\ -Q, --quiet, --silent suppress some warnings for builtins\n\ ", stdout); @@ -165,7 +151,7 @@ Operation modes:\n\ fputs ("\ \n\ Preprocessor features:\n\ - -D, --define=NAME[=VALUE] define NAME has having VALUE, or empty\n\ + -D, --define=NAME[=VALUE] define NAME as having VALUE, or empty\n\ -I, --include=DIRECTORY append DIRECTORY to include path\n\ -s, --synclines generate `#line NUM \"FILE\"' lines\n\ -U, --undefine=NAME undefine NAME\n\ @@ -187,9 +173,9 @@ Frozen state files:\n\ \n\ Debugging:\n\ -d, --debug[=FLAGS] set debug level (no FLAGS implies `aeq')\n\ + --debugfile=FILE redirect debug and trace output\n\ -l, --arglength=NUM restrict macro tracing size\n\ - -o, --error-output=FILE redirect debug and trace output\n\ - -t, --trace=NAME trace NAME when it will be defined\n\ + -t, --trace=NAME trace NAME when it is defined\n\ ", stdout); fputs ("\ \n\ @@ -228,35 +214,46 @@ mismatch, or whatever value was passed t | Decode options and launch execution. | `--------------------------------------*/ +/* For long options that have no equivalent short option, use a + non-character as a pseudo short option, starting with CHAR_MAX + 1. */ +enum +{ + DEBUGFILE_OPTION = CHAR_MAX + 1, /* no short opt */ + DIVERSIONS_OPTION, /* not quite -N, because of message */ + + HELP_OPTION, /* no short opt */ + VERSION_OPTION /* no short opt */ +}; + static const struct option long_options[] = { {"arglength", required_argument, NULL, 'l'}, {"debug", optional_argument, NULL, 'd'}, - {"diversions", required_argument, NULL, 'N'}, - {"error-output", required_argument, NULL, 'o'}, + {"define", required_argument, NULL, 'D'}, + {"error-output", required_argument, NULL, 'o'}, /* FIXME: deprecate in 2.0 */ {"fatal-warnings", no_argument, NULL, 'E'}, {"freeze-state", required_argument, NULL, 'F'}, {"hashsize", required_argument, NULL, 'H'}, {"include", required_argument, NULL, 'I'}, - {"interactive", no_argument, NULL, 'e'}, + {"interactive", no_argument, NULL, 'i'}, {"nesting-limit", required_argument, NULL, 'L'}, {"prefix-builtins", no_argument, NULL, 'P'}, {"quiet", no_argument, NULL, 'Q'}, {"reload-state", required_argument, NULL, 'R'}, {"silent", no_argument, NULL, 'Q'}, {"synclines", no_argument, NULL, 's'}, + {"trace", required_argument, NULL, 't'}, {"traditional", no_argument, NULL, 'G'}, + {"undefine", required_argument, NULL, 'U'}, {"word-regexp", required_argument, NULL, 'W'}, - {"help", no_argument, &show_help, 1}, - {"version", no_argument, &show_version, 1}, + {"debugfile", required_argument, NULL, DEBUGFILE_OPTION}, + {"diversions", required_argument, NULL, DIVERSIONS_OPTION}, - /* These are somewhat troublesome. */ - { "define", required_argument, NULL, 'D' }, - { "undefine", required_argument, NULL, 'U' }, - { "trace", required_argument, NULL, 't' }, + {"help", no_argument, NULL, HELP_OPTION}, + {"version", no_argument, NULL, VERSION_OPTION}, - { 0, 0, 0, 0 }, + { NULL, 0, NULL, 0 }, }; /* Global catchall for any errors that should affect final error status, but @@ -264,9 +261,9 @@ static const struct option long_options[ int retcode; #ifdef ENABLE_CHANGEWORD -#define OPTSTRING "B:D:EF:GH:I:L:N:PQR:S:T:U:W:d::el:o:st:" +#define OPTSTRING "B:D:EF:GH:I:L:N:PQR:S:T:U:W:d::eil:o:st:" #else -#define OPTSTRING "B:D:EF:GH:I:L:N:PQR:S:T:U:d::el:o:st:" +#define OPTSTRING "B:D:EF:GH:I:L:N:PQR:S:T:U:d::eil:o:st:" #endif int @@ -279,6 +276,10 @@ main (int argc, char *const *argv, char macro_definition *defines; FILE *fp; + boolean read_stdin = FALSE; + boolean interactive = FALSE; + const char *frozen_file_to_read = NULL; + const char *frozen_file_to_write = NULL; program_name = argv[0]; retcode = EXIT_SUCCESS; @@ -301,15 +302,22 @@ main (int argc, char *const *argv, char default: usage (EXIT_FAILURE); - case 0: - break; - - case 'B': /* compatibility junk */ - case 'N': + case 'B': case 'S': case 'T': + /* Compatibility junk: options that other implementations + support, but which we ignore as no-ops and don't list in + --help. */ + error (0, 0, "Warning: `m4 -%c' may be removed in a future release", + optchar); break; + case 'N': + case DIVERSIONS_OPTION: + /* -N became an obsolete no-op in 1.4.x. */ + error (0, 0, "Warning: `m4 %s' is deprecated", + optchar == 'N' ? "-N" : "--diversions"); + case 'D': case 'U': case 't': @@ -383,7 +391,10 @@ main (int argc, char *const *argv, char break; case 'e': - interactive = 1; + error (0, 0, "Warning: `m4 -e' is deprecated, use `-i' instead"); + /* fall through */ + case 'i': + interactive = TRUE; break; case 'l': @@ -393,6 +404,11 @@ main (int argc, char *const *argv, char break; case 'o': + /* -o/--error-output are deprecated synonyms of --debugfile, + but don't issue a deprecation warning until autoconf 2.61 + or later is more widely established, as such a warning + would interfere with all earlier versions of autoconf. */ + case DEBUGFILE_OPTION: if (!debug_set_output (optarg)) error (0, errno, "%s", optarg); break; @@ -400,12 +416,10 @@ main (int argc, char *const *argv, char case 's': sync_output = 1; break; - } - if (show_version) - { - printf ("%s\n", PACKAGE_STRING); - fputs ("\ + case VERSION_OPTION: + printf ("%s\n", PACKAGE_STRING); + fputs ("\ Copyright (C) 2006 Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ @@ -413,13 +427,15 @@ warranty; not even for MERCHANTABILITY o Written by Rene' Seindal.\n\ ", stdout); - if (close_stream (stdout) != 0) - M4ERROR ((EXIT_FAILURE, errno, "write error")); - exit (EXIT_SUCCESS); - } + if (close_stream (stdout) != 0) + M4ERROR ((EXIT_FAILURE, errno, "write error")); + exit (EXIT_SUCCESS); + break; - if (show_help) - usage (EXIT_SUCCESS); + case HELP_OPTION: + usage (EXIT_SUCCESS); + break; + } defines = head; @@ -488,14 +504,24 @@ Written by Rene' Seindal.\n\ if (optind == argc) { - push_file (stdin, "stdin"); + /* No point closing stdin until after wrapped text is + processed. */ + push_file (stdin, "stdin", FALSE); + read_stdin = TRUE; expand_input (); } else for (; optind < argc; optind++) { if (strcmp (argv[optind], "-") == 0) - push_file (stdin, "stdin"); + { + /* If stdin is a terminal, we want to allow 'm4 - file -' + to read input from stdin twice, like GNU cat. Besides, + there is no point closing stdin before wrapped text, to + minimize bugs in syscmd called from wrapped text. */ + push_file (stdin, "stdin", FALSE); + read_stdin = TRUE; + } else { const char *name; @@ -508,7 +534,7 @@ Written by Rene' Seindal.\n\ retcode = EXIT_FAILURE; continue; } - push_file (fp, name); + push_file (fp, name, TRUE); free ((char *) name); } expand_input (); @@ -520,9 +546,15 @@ Written by Rene' Seindal.\n\ while (pop_wrapup ()) expand_input (); - /* Change debug stream back to stderr, to force flushing debug stream and - detect any errors it might have encountered. */ + /* Change debug stream back to stderr, to force flushing the debug + stream and detect any errors it might have encountered. Close + stdin if we read from it, to detect any errors. */ debug_set_output (NULL); + if (read_stdin && fclose (stdin) == EOF) + { + M4ERROR ((warning_status, errno, "error reading file")); + retcode = EXIT_FAILURE; + } if (frozen_file_to_write) produce_frozen_state (frozen_file_to_write); diff -ruNp m4-1.4.6/src/m4.h m4-1.4.7/src/m4.h --- m4-1.4.6/src/m4.h 2006-08-19 06:56:59.000000000 -0600 +++ m4-1.4.7/src/m4.h 2006-09-23 22:28:04.000000000 -0600 @@ -288,7 +288,7 @@ token_type next_token (token_data *); void skip_line (void); /* push back input */ -void push_file (FILE *, const char *); +void push_file (FILE *, const char *, boolean); void push_macro (builtin_func *); struct obstack *push_string_init (void); const char *push_string_finish (void);