summaryrefslogtreecommitdiffstats
path: root/usr.bin/m4/eval.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* mkstemp() returns -1 on failurederaadt2019-06-281-2/+2
|
* replace sloppy parsing of numeric values with strtonum (incr, decr, divert)espie2017-11-111-13/+31
| | | | | | | | | still use integers, so use the natural bounds for these. POSIX says m4 should error when these use non numeric values, and now they do. okay millert@
* ifelse is special, fix argv parsing to avoid segfaultespie2017-10-231-9/+8
| | | | | | | | | | problem noticed by Matthew Green (netbsd), slightly different fix so that argc counting makes more sense. we might want to warn on wrong number of parameters later, but this is somewhat inconsistent depending on the builtin right now. okay millert@
* Add -E flag (make warnings fatal), following the behavior of GNU m4 1.4.9+bcallah2017-06-151-1/+5
| | | | | | Help and direction millert@ espie@ anton@ deraadt@ ok espie@
* Include stdint.h, not limits.h to get SIZE_MAX. OK guenther@millert2015-02-051-1/+2
|
* better error handling in mkstemp/unlink/fdopen logic.espie2014-07-111-6/+5
| | | | | from Doug Hogan <doug@acyclic.org> okay miod@
* check for integer overflows in custom allocs, okay jca@espie2014-04-281-2/+2
|
* cleanup up a nest of if/if/elsederaadt2013-11-141-3/+5
|
* new m4 -g stuff:espie2012-04-121-3/+8
| | | | | | | | | | - expr(`4**3') - include(`hey I am not there') keeps going. work with Baptiste Daroussin, who had the idea but didn't nail all details right. okay otto@, miod@
* fix translit() behavior to not be recursive. Fixes autoconf 2.65, matchesespie2011-03-241-24/+6
| | | | | | | | | | behavior of solaris m4 (e.g., posix). Bug-fix by Nigel Taylor Okay sthen@, todd@. Comment amended per sthen@' suggestion.
* Remove stray spaces. No code change.marco2010-09-071-16/+16
|
* conform to gnum4 AND traditional m4 (solaris) behavior, namely,espie2010-03-251-4/+14
| | | | | | | | translit(`ab',`aa',`cd') -> `cb' (first occurrence matches) okay miod@, sthen@ fixes minor autoconf issues, like HAVE_VOID__ instead of HAVE_VOID_P
* in gnu-m4 mode, allow definition of the empty macro (yes, autoconf 2.62espie2008-08-211-6/+8
| | | | | | actually uses this, bleh) okay otto@
* revert eval.cespie2008-08-161-8/+6
|
* argument parsing should only skip spaces outside of parenthesis.espie2008-08-161-6/+8
| | | | | | | | | Inside matching parenthesis, keep spaces as is (use chrsave instead of pbstr, since there's no way it can be a further macro expansion). Fixes a long-standing issue with autoconf ( --option -> --option), matches other m4 than gnum4 okay millert@, fries@
* oops, noticed by David Hill.espie2006-03-241-1/+2
|
* ... and remove extra test that is no longer needed.espie2006-03-231-5/+2
|
* add limited support for format builtin in gnu-m4 mode, because I'm fedespie2006-03-201-1/+7
| | | | | | up of patching it away in various autoconf derivatives. okay miod@
* report function m4errx, that shows app-specific data (filename/linenumber)espie2006-03-201-14/+8
| | | | | | before the error message. Use it to simplify code. okay miod@
* use stdint.h where appropriate. okay millert@espie2006-01-201-3/+3
|
* finally make our m4 SusV3-compliant.espie2005-09-061-80/+34
| | | | | | | | | | | | | | | | | | | | | | - changecom and changequote have a simple definition (that matches gnu-m4, coincidentally, so we no longer need two distinct modes for these) - off-by-one bug in -s, this finally works. - reorder main parser loop, so that we can use alphabetic constructs in quotes/comments. - rename putback to pushback, this matches comments, and makes more sense. - more uniform (and updated) description of changequote/changecom. - new, systematic regression tests of comments/quotes. - framework to test -s: one perl script to reconstitute `full' files with all line numbers, so that we can verify the output without needing a complete match. okay otto@, fries@
* zap rcsid. It's not ramdisk, but they still take space.espie2005-08-061-9/+1
|
* fix a few minor compatibility issues.espie2005-05-291-13/+48
| | | | | | | | | - let eval() handle a base and number of digits, like it's advertized to. - in gnu-mode, undivert can take file names as arguments. - in gnu-mode, map can handle reversed charsets. Suggestions and okay otto@, mostly prompted by looking at the regress tests in newer gnu-m4.
* let m4wrap handle multiple wraps, both in normal and gnu-mode.espie2005-03-021-3/+22
| | | | | based on Noah Misch's bug report. okay otto, jmc.
* use fflush(stdout) before system() so we won't miss anyrobert2005-01-311-3/+5
| | | | | | wanted output; from Andreas Burmester <buster_hh@gmx.net> ok espie@
* more portable code, stderr is not necessarily a constant.espie2005-01-211-2/+4
|
* remove unused variables, extra declarations.espie2005-01-201-3/+2
|
* Modify xalloc so that it also takes err(3)-like arguments.espie2003-11-171-3/+3
| | | | | | | | | Write an xrealloc wrapper that works the same way, and use it as well. People who feel like it may want to add more explicit error messages to all the places m4 can fail allocating memory... okay tedu@
* Make the trace status of a macro an actual argument that gets pushedespie2003-06-301-4/+4
| | | | | | | | | in the frame for the macro expansion. (This will allow one single lookup to grab the macro definition and the trace status) okay millert@
* clean up internal lookup interface:espie2003-06-301-64/+20
| | | | | | | define an interface with explicit define/pushdef/popdef... and use it. That way, most details of the hashtable are no longer visible. okay millert@
* - store builtin name as definition for builtin macros.espie2003-06-181-28/+31
| | | | | | | | | | | this removes the need for code->name conversion, in exchange for systematically testing the definition type, since we can no longer rely on the defn being NULL. - commonnalize the builtin-detection code, so that we can use it for pushdef as well with define, so that pushdef handles builtins correctly as well. okay fries@, millert@.
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-031-7/+3
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* say goodbye to strcpy, okay deraadt@espie2003-04-051-3/+3
|
* Implement -s.espie2002-04-281-2/+5
| | | | | | | | | | | | | | | | | Triggered by recent FreeBSD changes. - emits #line directives at every file change (like FreeBSD) - maintains a synch_lineno variable to verify when the output gets out of synch with the input, so that it can emit #line to re-synch as well (unlike FreeBSD) To do: either handle \end-of-line, or recognize when a macro expansion is in progress, so that line synch don't perturb cpp on multi-line expansions. With this, we should have a fully POSIX-compliant m4. ok miod@
* use ansi function declarations. ok millert@espie2002-04-261-67/+23
|
* Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.millert2002-02-161-21/+21
|
* Kill yet another hardcoded size. Ok fries@espie2001-12-281-3/+7
| | | | | and flush(stdout) on debugging mode, as a vicious coredump can leave you without info otherwise.
* Handle macro expansion even if argc==2, which can happen in indir() calls.espie2001-10-101-16/+20
| | | | Problem encountered by obecian@.
* Fix indentespie2001-10-101-5/+5
|
* Synchronize comment with reality.espie2001-09-291-29/+71
| | | | | In gnu-m4 mode, pass the real number of arguments to changequote/changecom, since those distinguish changequote() from changequote.
* pass all properties of builtins when defn...espie2001-09-271-3/+5
|
* traceon/traceoff built-ins.espie2001-09-271-2/+29
|
* inline some very common putback/chrsave. Worth roughly 10%espie2001-09-191-6/+6
|
* Tracing facilities. Same style as gnu-m4, because it's mostly used forespie2001-09-181-5/+11
| | | | autoconf right now.
* instrumentation for tracing mode: macro expansionespie2001-09-181-2/+4
|
* better gnu m4 emulation for dumpdefespie2001-09-181-3/+15
|
* let dumpdef go thru dump_one_def for each def.espie2001-09-181-8/+15
|
* let defn(builtin) work enough so thatespie2001-09-181-3/+20
| | | | | define(`newmacro', defn(builtin)) will work, as it should.
* One single point for all macros/builtin expansion.espie2001-09-181-9/+28
|
* Fix PR 1868. MAXSTR has no place there.espie2001-06-131-11/+10
| | | | | | MAXSTR is still a hard limit, but only for token length, where 512 characters seems reasonable. Ok millert@