Commit Graph

127 Commits

Author SHA1 Message Date
christos a686e4e754 back all changes out until I fix it properly. 2008-02-15 21:29:50 +00:00
christos e654b454bc remove error/noerror const 2008-02-15 02:50:53 +00:00
christos 4d9d6704c1 - symbolic names for error and no error
- more size_t
2008-02-15 02:37:51 +00:00
christos 2b28370627 - use pid_t/size_t as appropriate instead of int.
- use %ld to print pids.
- fix a bit of lint.
- WARNS=4
2008-02-14 22:11:20 +00:00
apb 7da86686ca Don't write into const strings; not even if we intend to
reinstate the original contents later.
2007-10-13 19:59:52 +00:00
apb 67bb324312 * Convert all uses of strdup() to estrdup();
* Use estrndup() in a few cases where it simplifies the code;
* Provide compatibility definitions of strndup and estrndup;
2007-10-13 16:16:41 +00:00
apb 781e1efd0c Oops, missed a few more comments in previous. 2007-10-13 14:32:18 +00:00
apb a8bf2a2f8a Correct documentation for Var_Parse's freePtr arg. It's a pointer to
the thing to be freed (or NULL if nothing to free), not to a pointer to
boolean saying whether or not to free the result.
2007-10-13 13:54:06 +00:00
sjg 3a5409e4eb Fix an off-by-one error in handing mal-formed modifiers.
The issue seems to have been present for some time, only showed up
when running unit-tests on SunOS.
Make sure we get an error message, but otherwise behave as before.
2007-10-09 05:55:03 +00:00
sjg f28827375c Add the ability to .export variables to the environment. 2007-10-05 15:27:45 +00:00
dsl 53bf780833 Under DEBUG(VAR) report when the variable wasn't found.
Disposes of pr bin/15842
2007-06-16 19:47:29 +00:00
dsl b7483eac69 Since the 'buf' code here is only used by make, we don't need two names
for the default buffer size of 256.
Also allow for the trailing 0 byte!
2007-01-01 21:29:01 +00:00
dsl 16c8499ed2 Since 'ClientData' is 'void *', nuke almost all the (ClientData) casts. 2006-10-27 21:00:18 +00:00
dsl 0195907f3d Output all debug trace output through 'debug_file' defaulting to 'stdout'.
(Almost all the debug output went there, but some went to stderr.)
Split the parsing of -d (debug flags) out into its own routine.
Allow the output filename to be changed by specifying -dF<file> to create
a log file, or -dF+<file> to append to it. <file> may be stdout or stderr.
Also change so that -d-<flags> acts on <flags> locally but doesn't copy
them to MAKEFLAGS so they aren't inherited by child makes.
I'm not 100% happy with the command line syntax for the above, so they are
currently undocumented.
2006-10-15 08:38:21 +00:00
christos cdab3a7a06 More programs using efun. 2006-08-26 18:17:41 +00:00
sjg 7ab69f08a8 Indicate which modifier a result applies to, helps debug complex cases. 2006-07-28 17:08:55 +00:00
rillig a3ea8b9d59 Fixed the bug reported in PR 33866, which is that the :Q operator does not
handle newlines correctly. Ok'ed by christos.
2006-06-29 22:01:17 +00:00
christos 236f8aef2c Coverity CI D3758: Plug memory leak. 2006-05-19 17:29:01 +00:00
christos 19d4b5c5e9 Coverity CID 3757: Plug memory leak. 2006-05-19 17:27:06 +00:00
sjg 03cbcf6532 Extract the variable modifier logic to a separate function.
This cuts Var_Parse in half! and allows the modifier logic to
be used recursively - when getting modifiers via variables.

Add new unit-test, to check that certain error cases are handled
correctly.
2006-05-11 15:37:07 +00:00
christos 3d5b8ce5a8 Coverity CID 529: Call VarFreeEnv to prevent leak. 2006-04-22 19:40:40 +00:00
christos ac5c384e1b Coverity CID 534: Free junk variables on return from Var_Parse. 2006-04-22 19:32:35 +00:00
christos bb46846e03 Coverity CID 533: Plug memory leak.
Add a new function VarFreeEnv() to free environment variables and use it.
2006-04-22 19:28:51 +00:00
christos e052a053e4 Add some coverity allocation comments, and change the way the allocator
functions work. When they allocate storage that needs to be freed, instead
of setting a boolean, set the pointer to be freed. Plug some more memory
leaks found by inspection.
2006-03-31 21:58:08 +00:00
sjg 98b766c482 Fix :P modifier so it actually works as described.
I.e ${var.c:P} should expand to the absolute path of var.c found via .PATH
2006-03-19 01:54:21 +00:00
sjg 2bc18a45e6 Update man page and add test case for specifying modifiers via variable.
Also allow said variable to appear anywhere in the modifier list.
2006-02-26 21:43:00 +00:00
sjg 051abc7bc4 Allow variable modifiers to be specified via variable. 2006-02-18 01:29:27 +00:00
christos efc9df200f PR/31077: Wil L: /usr/bin/make can read off of end of buffer 2005-08-27 08:04:26 +00:00
christos 81b135acdf From Max Okumoto:
- Remove casts to NULL.
- Remove space between cast and object.
2005-08-08 16:42:54 +00:00
christos 6240774069 More KNF cleanups from Max Okumoto 2005-08-05 00:53:18 +00:00
christos 3692d77541 Whitespace KNF cleanup from Max Okumoto 2005-07-25 22:55:58 +00:00
christos 3d520edd5e PR/29985: Roland Illig: make(1) interprets backslash wrongly in for
loop expansions, when the expanded variable ends in backslash and
the backslash is the last character on the line. While this fix is
ugly (detect the condition and append a space), it is the least
intrusive for now.
2005-07-01 16:45:38 +00:00
lukem 366252f608 * Improve error handling with unrecognized chars after :t.
* Explicitly goto default_case for unknown chars encountered after
  various : modifiers, rather than multiple FALLTHRUs.
* Appease gcc -Wuninitialized for sv_name and v_ctxt.

Discussed with sjg.
2005-06-03 07:02:39 +00:00
lukem fb0f76d8e8 cosmetic comment tweak 2005-06-03 05:56:25 +00:00
sjg 5f60a7de65 Add :Ox for random ordering, based on patch from
Mike M. Volokhov <mishka@apk.od.ua>
2005-06-01 17:17:34 +00:00
christos 63fca13660 PR/29203, PR/29204: Max Okumoto: KNF changes to make [no functional changes] 2005-02-16 15:11:52 +00:00
dsl 108eb2ab42 Add (unsigned char) cast to ctype functions 2004-10-30 20:39:35 +00:00
jmc a2bacbeec5 Change to use __unused instead and provide a compat definition in make.h if
not already defined from cdefs.h
2004-07-01 20:38:09 +00:00
jmc 71a252d58b Add some checks for gcc around a few function declarations and note the
unused variables. Also fix a few other warnings that PR#22118 shows when
trying to compile bmake on non-NetBSD hosts
2004-07-01 04:39:30 +00:00
ross 42dbdbd46a Simplify build, no functional changes.
Instead of adding MAKE_BOOTSTRAP for hosted environments, i.e., when
you want things simple, instead add MAKE_NATIVE to get those hugely
important features like __RCSID().

It's now possible to build make on some hosts with: cc *.c */*.c
2004-05-07 00:04:38 +00:00
sjg a3cc11808b Fix :M so that modifiers in nested variables don't terminate parsing
early.  Add a unit-test to verify it works and keeps working.
Re-jig the unit-tests so that all are sub makefiles.
2004-02-20 09:03:26 +00:00
dsl c3032ca9a0 Restore correct name string when VarGetPattern() returns.
Stops error from free() evaluating ${x::=y} when x is undefined.
(Erm why is free() allowed to write to fd 2?)
2004-01-24 19:58:54 +00:00
sjg 1752434408 Fix :?: modifier so that it works again. 2004-01-08 23:55:05 +00:00
jmc 3eb499682d Support variable expansions inside of SYSV style = substitutions. Better matches
expectations (and some cases of historical behavior I've found). Also fixes
PR#3865
2003-12-26 23:13:32 +00:00
jmc c7c6bf2bbd Don't assume startc is always {, set delim to endc when separating the args to
the ? test.
2003-12-26 08:03:06 +00:00
jmc 89996408fa Fixes from PR#23210 to eliminate use of asprintf which makes cross building
on non-NetBSD hosts work again
2003-10-23 15:58:29 +00:00
sjg d388dcd1a3 Implement :[] modifier to allow picking a range of words out of a variable.
Also :tW and a W flag to :C and :S to allow treating value as a single word.
Add unit tests for the above, and fix some corner cases.
Based on patches supplied by Alan Barrett <apb@cequrux.com>
2003-09-27 21:29:37 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
scw bc25d2ab5f Const poisoning. 2003-07-31 13:48:11 +00:00
sjg 82cba16bce A couple of other places where delim should be set 2003-07-29 09:06:29 +00:00