diff options
Diffstat (limited to 'contrib/bmake/main.c')
-rw-r--r-- | contrib/bmake/main.c | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/contrib/bmake/main.c b/contrib/bmake/main.c index d020ba85f16b..a773b44f42c4 100644 --- a/contrib/bmake/main.c +++ b/contrib/bmake/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.659 2025/06/13 05:41:36 rillig Exp $ */ +/* $NetBSD: main.c,v 1.661 2025/07/06 07:11:31 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.659 2025/06/13 05:41:36 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.661 2025/07/06 07:11:31 rillig Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1221,23 +1221,8 @@ InitMaxJobs(void) if (bogusJflag && !opts.compatMake) { opts.compatMake = true; Parse_Error(PARSE_WARNING, - "internal option \"-J\" in \"%s\" " - "refers to unopened file descriptors; " - "falling back to compat mode.\n" - "\t" - "To run the target even in -n mode, " - "add the .MAKE pseudo-source to the target.\n" - "\t" - "To run the target in default mode only, " - "add a ${:D make} marker to a target's command. " - "(This marker expression expands to an empty string.)\n" - "\t" - "To make the sub-make run in compat mode, add -B to " - "its invocation.\n" - "\t" - "To make the sub-make independent from the parent make, " - "unset the MAKEFLAGS environment variable in the " - "target's commands.", + "Invalid internal option \"-J\" in \"%s\"; " + "see the manual page", curdir); PrintStackTrace(true); return; @@ -1734,11 +1719,10 @@ found: } /* populate av for Cmd_Exec and Compat_RunCommand */ -int -Cmd_Argv(const char *cmd, size_t cmd_len, const char **av, size_t avsz, +void +Cmd_Argv(const char *cmd, size_t cmd_len, const char *av[5], char *cmd_file, size_t cmd_filesz, bool eflag, bool xflag) { - int ac = 0; int cmd_fd = -1; if (shellPath == NULL) @@ -1764,23 +1748,19 @@ Cmd_Argv(const char *cmd, size_t cmd_len, const char **av, size_t avsz, cmd_file[0] = '\0'; } - if (avsz < 4 || (eflag && avsz < 5)) - return -1; - /* The following works for any of the builtin shell specs. */ - av[ac++] = shellPath; + *av++ = shellPath; if (eflag) - av[ac++] = shellErrFlag; + *av++ = shellErrFlag; if (cmd_fd >= 0) { if (xflag) - av[ac++] = "-x"; - av[ac++] = cmd_file; + *av++ = "-x"; + *av++ = cmd_file; } else { - av[ac++] = xflag ? "-xc" : "-c"; - av[ac++] = cmd; + *av++ = xflag ? "-xc" : "-c"; + *av++ = cmd; } - av[ac] = NULL; - return ac; + *av = NULL; } /* @@ -1790,7 +1770,7 @@ Cmd_Argv(const char *cmd, size_t cmd_len, const char **av, size_t avsz, char * Cmd_Exec(const char *cmd, char **error) { - const char *args[4]; /* Arguments for invoking the shell */ + const char *args[5]; /* Arguments for invoking the shell */ int pipefds[2]; int cpid; /* Child PID */ int pid; /* PID from wait() */ @@ -1804,8 +1784,8 @@ Cmd_Exec(const char *cmd, char **error) DEBUG1(VAR, "Capturing the output of command \"%s\"\n", cmd); - if (Cmd_Argv(cmd, 0, args, 4, cmd_file, sizeof(cmd_file), false, false) < 0 - || pipe(pipefds) == -1) { + Cmd_Argv(cmd, 0, args, cmd_file, sizeof(cmd_file), false, false); + if (pipe(pipefds) == -1) { *error = str_concat3( "Couldn't create pipe for \"", cmd, "\""); return bmake_strdup(""); @@ -2083,7 +2063,7 @@ shouldDieQuietly(GNode *gn, int bf) else if (bf >= 0) quietly = bf; else - quietly = (gn != NULL && (gn->type & OP_MAKE)) ? 1 : 0; + quietly = gn != NULL && gn->type & OP_MAKE ? 1 : 0; } return quietly != 0; } |