aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/make/compat.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge compat.c into job.c. There is a lot in common between theseHartmut Brandt2005-05-101-765/+0
| | | | | | | | | | files and we are going to factor this out. Patch: 7.199 (slightly changed) Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=146056
* Split Var_Subst() into two functions: Var_SubstOnly() which substitutesHartmut Brandt2005-05-091-1/+1
| | | | | | | | | | | | | only one variable and Var_Subst() which substitutes all. Split out the test whether a variable should not be expanded into match_var(). Make access to the input string consistently using str[]. Remove two unused functions: Var_GetTail() and Var_GetHead(). Patches: 7.184-7.189 Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=146027
* Replace Lst_ForEach by LST_FOREACH.Hartmut Brandt2005-03-161-7/+3
| | | | Notes: svn path=/head/; revision=143703
* Use the Buf_Peel function to get to the string contained into aHartmut Brandt2005-03-081-5/+1
| | | | | | | buffer without using an extra local variable. Notes: svn path=/head/; revision=143291
* Remove useless local prototypes.Hartmut Brandt2005-03-081-4/+0
| | | | Notes: svn path=/head/; revision=143290
* Style: fix indentation.Hartmut Brandt2005-03-081-479/+489
| | | | Notes: svn path=/head/; revision=143289
* Change the return value of Var_Subst to return a Buffer insteadHartmut Brandt2005-02-251-1/+6
| | | | | | | | | | | of a char *. Patch: 7.49 Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=142457
* Replace the calls to Lst_ForEach with the new LST_FOREACH macro andHartmut Brandt2005-02-241-8/+22
| | | | | | | | fix the prototype for Compat_RunCommand to take the actual argument types instead of void *. Notes: svn path=/head/; revision=142375
* Fix spacing by converting mixes of space and tab to tab. Also add a numberHartmut Brandt2005-02-101-13/+13
| | | | | | | | | of empty lines in appropriate places. Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=141648
* Use _exit() instead of exit() when the exec() after a vfork() fails.Hartmut Brandt2005-02-041-1/+1
| | | | | | | Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=141272
* General whitespace cleanup: remove mixes of tabs and spaces, removeHartmut Brandt2005-02-041-3/+3
| | | | | | | | | space after function names, remove spaces on emtpy lines. Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=141270
* Minor cleanup: make brk_string to return argc only if the pointer to itHartmut Brandt2005-02-041-14/+4
| | | | | | | | | | | | was non-NULL. This let's us eliminated an otherwise unused variable. shellneeded can never return -1 so there is no need to check for it and hence no need for a variable to hold the returned value. Submitted by: Max Okumoto <okumoto@ucsd.edu> (partly) Notes: svn path=/head/; revision=141269
* Style: remove a space between a function name and the openingHartmut Brandt2005-02-041-1/+1
| | | | | | | | | paranthesis. Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=141253
* Some more easy constification.Hartmut Brandt2005-02-041-4/+5
| | | | | | | Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=141252
* Clean up include files and file including. Split nonints.h into piecesHartmut Brandt2005-02-011-14/+23
| | | | | | | | | | | | | | | | that get included just where they are needed. All headers include the headers that they need to compile (just with an empty .c file). Sort includes alphabetically where apropriate and fix some duplicate commenting for struct Job, struct GNode and struct Shell by removing one version and inlining the comments into the structure declaration (the comments have been somewhat outdated). This patch does not contain functional changes (checked with md5). Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=141104
* Instead of dynamically allocating list heads allocated them staticallyHartmut Brandt2004-12-161-10/+10
| | | | | | | | | | | now that their size is only two pointers. This eliminates a lot of calls to Lst_Init and from there to malloc together with many calls to Lst_Destroy (in places where the list is obviously empty). This also reduces the chance to leave a list uninitilized so we can remove more NULL pointer checks and probably eliminates a couple of memory leaks. Notes: svn path=/head/; revision=138916
* Typedefs of pointers to structs are evil. Make Lst and LstNode typedef ofHartmut Brandt2004-12-071-2/+2
| | | | | | | | | the structs itself not of pointers to them. This will simplify constification. Checked by: diff on the object files Notes: svn path=/head/; revision=138512
* Style: remove a lot of unnecessary casts, add some and spell the nullHartmut Brandt2004-12-011-13/+13
| | | | | | | | | pointer constant as NULL. Checked by: diff -r on the object files before and after Notes: svn path=/head/; revision=138264
* Stylification: missing spaces, extra space after function names, castsHartmut Brandt2004-11-301-59/+60
| | | | | | | | | | | and the sizeof operator, missing empty lines, void casts, extra empty lines. Checked by: diff on make *.o lst.lib/*.o Submitted by: Max Okumoto <okumoto@soe.ucsd.edu> (partly) Notes: svn path=/head/; revision=138232
* Fix a (very) long standing bug in make (this has been there probablyHartmut Brandt2004-11-121-15/+42
| | | | | | | | | | | | | from the beginning). Make used to handle all its interrupt-time stuff directly from the signal handler, including calls to printf, accessing global data and so on. This is of course wrong and could provoke a core dump when interrupting make. Just set a flag in the signal handler and do everything else from the main thread. PR: bin/29103 Notes: svn path=/head/; revision=137605
* Expand the scope of the .SHELL specification to also coverRuslan Ermilov2004-10-231-2/+5
| | | | | | | | | | | | | the compat mode of operation and the != operator. While here, fixed a bug in the .SHELL directive processing when only the name= attribute is specified and no built-in shell matches this name, causing null pointer dereference. Obtained from: NetBSD (except for bugs) Notes: svn path=/head/; revision=136840
* Implement POSIX's '+' flag for command lines. This flag causes a lineHartmut Brandt2004-07-291-24/+43
| | | | | | | | | | | | | | | | | | to be executed even when -n is given on the command line to make. This is very handy for calls to submakes. This is slightly changed from the original patch as obtained from NetBSD. The NetBSD variant prints lines which have both '+' and '@' when -n is specified. The commited version always obeys '@'. Bump MAKE_VERSION so Makefiles can use this conditionally. PR: standards/66357 (partly) Submitted by: Mark Baushke <mdb@juniper.net> Obtained from: NetBSD Notes: svn path=/head/; revision=132839
* Make the -q option DTRT in the compat mode.Ruslan Ermilov2003-10-031-1/+1
| | | | | | | PR: 48210 Notes: svn path=/head/; revision=120718
* Remove efree(), it isn't used consistently enough to even pretend that itJuli Mallett2002-10-231-4/+4
| | | | | | | | | might help on the systems it could possibly be used as a bandaid for. In fact, the only thing it's useful for is instrumenting free(3) calls, and in that capacity, it's better served as a local patch, than a public wrapper. Notes: svn path=/head/; revision=105826
* Convert make(1) to use ANSI style function declarations. VariableJuli Mallett2002-10-091-14/+8
| | | | | | | | | | | | | | documentation already adequatedly existed in the description in most cases. Where it did not, it was added. If no documentation existed beforehand, then none was added. Some unused dummies for use in the traversal functions were marked as __unused during the conversion. Occasionally, local style fixes were applied to lines already being modified or influenced. Now make(1) should always build with WARNS=3. Notes: svn path=/head/; revision=104696
* Make make(1) WARNS=6 clean except for const issues. This mostly involvesJuli Mallett2002-09-281-5/+5
| | | | | | | | | | | | | | renaming variables to not shadow libc functions or greater scope locals. Kinda makes one wonder if the extern ones weren't meant in some of these places :) The only thing I'd still like to do WRT this is possibly combine rstat and status in compat.c -- that should be fine, as I do not think the codepaths will want both around at once. Sponsored by: Bright Path Solutions Notes: svn path=/head/; revision=104121
* Add empty default cases where they should be, remove non-local execution stuffJuli Mallett2002-09-281-13/+5
| | | | | | | | | | | | | in compat.c which doesn't even have preprocessor-conditional-hidden support code, and add a debugging statement where we might end up with a nil list somehow, but where I doubt it. First confirmed userland kill for Flexelint. Sponsored by: Bright Path Solutions Notes: svn path=/head/; revision=104108
* Make the DEBUGF() macro portable by (ugh) adding a Debug() function, whichJuli Mallett2002-09-181-4/+4
| | | | | | | | is merely printf() but to stderr. This takes care of the caveat which lead to the use of a vararg macro -- getting everything to stderr. Notes: svn path=/head/; revision=103545
* Move common use of if (DEBUG(FOO)) printf... to DEBUGF(FOO, ...), usingJuli Mallett2002-09-171-11/+5
| | | | | | | | | | | | variable length arguments to a macro. Bump version as this makes DEBUG statements *always* go to stderr rather than sometimes stdout. There are a few stragglers, which I will take care of as soon as I can. Mostly these relate to the need-for-death-of some of the remote job code. Nearby stylistic nits and XXX added/fixed where appropriate. Notes: svn path=/head/; revision=103508
* String lengths and sizeof()s are size_t not int. Mark an unused parameterJuli Mallett2002-06-121-0/+1
| | | | | | | | | of ReadMakefile as __unused, it's there because this function is used by the abstracted list interface which normally deals with item handlers which take two arguments. Add a missing static prototype. Notes: svn path=/head/; revision=98138
* Back out the ``run shell from $PATH'' change; this was an overkillRuslan Ermilov2002-05-241-11/+3
| | | | | | | | | and is insecure. Requested by: bde Notes: svn path=/head/; revision=97251
* Do not run shell from /bin, run it from $PATH.Ruslan Ermilov2002-05-221-3/+11
| | | | | | | Bump MAKE_VERSION to 5200205221. Notes: svn path=/head/; revision=97122
* Fix copyrights, and undo SCS ID damage.David E. O'Brien2002-04-131-1/+2
| | | | Notes: svn path=/head/; revision=94589
* Update SCM ID method.David E. O'Brien2002-04-131-3/+1
| | | | Notes: svn path=/head/; revision=94587
* De'register.David E. O'Brien2002-04-131-1/+1
| | | | Notes: svn path=/head/; revision=94584
* remove __PWarner Losh2002-03-221-3/+3
| | | | Notes: svn path=/head/; revision=92921
* Use STD{ERR,IN,OUT}_FILENO instead of their numeric values. TheSheldon Hearn2001-07-261-4/+5
| | | | | | | | | | definitions are more readable, and it's possible that they're more portable to pathalogical platforms. Submitted by: David Hill <david@phobia.ms> Notes: svn path=/head/; revision=80381
* There's also no point in #typedef'ing void/char pointers. Accordingly,Will Andrews2000-12-021-14/+14
| | | | | | | | | rip out ClientData/Address pointers and use standard types. Obtained from: OpenBSD Notes: svn path=/head/; revision=69531
* There's no reason to use fancy forms of NULL. Replace all instancesWill Andrews2000-12-021-7/+7
| | | | | | | | | of NIL, NILLST, NILLGNODE, etc. with NULL. Obtained from: OpenBSD Notes: svn path=/head/; revision=69527
* Use __RCSID()Wilfredo Sanchez2000-07-091-6/+4
| | | | Notes: svn path=/head/; revision=62833
* Add loud debugging facility (-dl option) which allows programmers/developersWill Andrews2000-05-141-1/+1
| | | | | | | | | | | | | | | to override @-prefixed commands in Makefiles. It is especially useful for debugging ports and/or complex Makefiles in such a manner that is basically a last resort, but is quite effective if the output is well-handled. I'll update the manpage after dinner. ;-) Better patch submitted by: steve Reviewed by: phk, steve, chuckr, obrien, Lyndon Nerenberg <lyndon@orthanc.ab.ca> Notes: svn path=/head/; revision=60569
* #include <errno.h> where needed. Kill extern int errno;.Warner Losh2000-04-141-1/+0
| | | | | | | Minor warnings in tip corrected. Notes: svn path=/head/; revision=59217
* Unduplicate IDs from comments, do $Id -> $FreeBSD$ (submitted-by: bde)Tim Vanderhoek1999-09-111-2/+0
| | | | Notes: svn path=/head/; revision=51150
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-2/+2
| | | | Notes: svn path=/head/; revision=50477
* Merge style- and trivial- only changes from OpenBSD (dated 1999/07/29-19:55+1).Tim Vanderhoek1999-08-171-9/+14
| | | | | | | Obtained from: OpenBSD, sometimes indirected from NetBSD; myself Notes: svn path=/head/; revision=49938
* When printing an error message after command execution fails, don't assumeTim Vanderhoek1999-07-311-2/+4
| | | | | | | | the only possible error is "command not found". This makes debugging of messages such as "/bin/sh: not found" less common... Notes: svn path=/head/; revision=49330
* Fix spurious `free()' when -d g2 is enabled.Joseph Koshy1998-09-091-3/+12
| | | | | | | | PR: 6790 Submitted by: nsmart <njs3@doc.ic.ac.uk> Notes: svn path=/head/; revision=38971
* When exiting on SIGINT, exit with signal statusMartin Cracauer1998-08-241-2/+5
| | | | Notes: svn path=/head/; revision=38520
* Fix broken (at least on alpha, but probably on i386 too) code whichJohn Birrell1998-05-131-4/+4
| | | | | | | | is supposed to walk an arry of character pointers, not an array of characters. Notes: svn path=/head/; revision=35993
* Some commands are shell builtins. Execute the builtins by the shellWolfram Schneider1998-05-121-1/+50
| | | | | | | | | | and not directly by make(1). PR: bin/6550 Submitted by: Theo de Raadt <deraadt@cvs.openbsd.org & wosch Notes: svn path=/head/; revision=35968