summaryrefslogtreecommitdiffstats
path: root/usr.bin/make
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-05-12 15:10:45 +0000
committerharti <harti@FreeBSD.org>2005-05-12 15:10:45 +0000
commit0c5d8337ec86ffcf078fa2d0dbf12822294391b6 (patch)
tree32f5356987c426a7d224cb472bc0fdf38e43a876 /usr.bin/make
parent2df173ac684d874dc720572384772bde811f18f6 (diff)
downloadFreeBSD-src-0c5d8337ec86ffcf078fa2d0dbf12822294391b6.zip
FreeBSD-src-0c5d8337ec86ffcf078fa2d0dbf12822294391b6.tar.gz
The first element of the vector built by brk_string() is never
used so there is no need to stuff the value of .MAKE into it, which btw isn't set for quite a while already. Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.239)
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/job.c9
-rw-r--r--usr.bin/make/str.c16
2 files changed, 15 insertions, 10 deletions
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index 8b83d33..dcffdf5 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -2822,7 +2822,6 @@ Job_ParseShell(char *line)
while (isspace((unsigned char)*line)) {
line++;
}
- words = brk_string(line, &wordCount, TRUE);
memset(&newShell, 0, sizeof(newShell));
path = NULL;
@@ -2831,8 +2830,9 @@ Job_ParseShell(char *line)
* Parse the specification by keyword but skip the first word - it
* is not set by brk_string.
*/
- wordCount--;
+ words = brk_string(line, &wordCount, TRUE);
words++;
+ wordCount--;
for (argc = wordCount, argv = words; argc != 0; argc--, argv++) {
/*
@@ -3310,6 +3310,11 @@ shellneed(char *cmd)
if (strpbrk(cmd, sh_meta) != NULL)
return (NULL);
+ /*
+ * Break the command into words to form an argument
+ * vector we can execute. brk_string sticks NULL
+ * in av[0], so we have to skip over it...
+ */
av = brk_string(cmd, NULL, TRUE);
for (p = sh_builtin; *p != 0; p++)
if (strcmp(av[1], *p) == 0)
diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c
index 1ccf9f5..372b3d8 100644
--- a/usr.bin/make/str.c
+++ b/usr.bin/make/str.c
@@ -49,10 +49,11 @@ __FBSDID("$FreeBSD$");
#include "globals.h"
#include "str.h"
#include "util.h"
-#include "var.h"
-static char **argv, *buffer;
-static int argmax, curlen;
+static char **argv;
+static char *buffer;
+static int argmax;
+static int curlen;
/*
* str_init --
@@ -62,10 +63,10 @@ static int argmax, curlen;
void
str_init(void)
{
- char *p1;
- argv = emalloc(((argmax = 50) + 1) * sizeof(char *));
- argv[0] = Var_Value(".MAKE", VAR_GLOBAL, &p1);
+ argmax = 50;
+ argv = emalloc((argmax + 1) * sizeof(char *));
+ argv[0] = NULL;
}
/*-
@@ -113,8 +114,7 @@ str_concat(const char *s1, const char *s2, int flags)
* are ignored.
*
* returns --
- * Pointer to the array of pointers to the words. To make life easier,
- * the first word is always the value of the .MAKE variable.
+ * Pointer to the array of pointers to the words.
*/
char **
brk_string(const char *str, int *store_argc, Boolean expand)
OpenPOWER on IntegriCloud