diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index 8b83d33269e9..dcffdf5f7f7e 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 1ccf9f57cb04..372b3d826885 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)