| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: job.c,v 1.290 2020/10/26 21:34:10 rillig Exp $ */ | | 1 | /* $NetBSD: job.c,v 1.291 2020/10/26 22:51:56 rillig Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | | 4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to Berkeley by | | 7 | * This code is derived from software contributed to Berkeley by |
8 | * Adam de Boor. | | 8 | * Adam de Boor. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -133,27 +133,27 @@ | | | @@ -133,27 +133,27 @@ |
133 | #ifndef USE_SELECT | | 133 | #ifndef USE_SELECT |
134 | #include <poll.h> | | 134 | #include <poll.h> |
135 | #endif | | 135 | #endif |
136 | #include <signal.h> | | 136 | #include <signal.h> |
137 | #include <utime.h> | | 137 | #include <utime.h> |
138 | | | 138 | |
139 | #include "make.h" | | 139 | #include "make.h" |
140 | #include "dir.h" | | 140 | #include "dir.h" |
141 | #include "job.h" | | 141 | #include "job.h" |
142 | #include "pathnames.h" | | 142 | #include "pathnames.h" |
143 | #include "trace.h" | | 143 | #include "trace.h" |
144 | | | 144 | |
145 | /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ | | 145 | /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ |
146 | MAKE_RCSID("$NetBSD: job.c,v 1.290 2020/10/26 21:34:10 rillig Exp $"); | | 146 | MAKE_RCSID("$NetBSD: job.c,v 1.291 2020/10/26 22:51:56 rillig Exp $"); |
147 | | | 147 | |
148 | /* A shell defines how the commands are run. All commands for a target are | | 148 | /* A shell defines how the commands are run. All commands for a target are |
149 | * written into a single file, which is then given to the shell to execute | | 149 | * written into a single file, which is then given to the shell to execute |
150 | * the commands from it. The commands are written to the file using a few | | 150 | * the commands from it. The commands are written to the file using a few |
151 | * templates for echo control and error control. | | 151 | * templates for echo control and error control. |
152 | * | | 152 | * |
153 | * The name of the shell is the basename for the predefined shells, such as | | 153 | * The name of the shell is the basename for the predefined shells, such as |
154 | * "sh", "csh", "bash". For custom shells, it is the full pathname, and its | | 154 | * "sh", "csh", "bash". For custom shells, it is the full pathname, and its |
155 | * basename is used to select the type of shell; the longest match wins. | | 155 | * basename is used to select the type of shell; the longest match wins. |
156 | * So /usr/pkg/bin/bash has type sh, /usr/local/bin/tcsh has type csh. | | 156 | * So /usr/pkg/bin/bash has type sh, /usr/local/bin/tcsh has type csh. |
157 | * | | 157 | * |
158 | * The echoing of command lines is controlled using hasEchoCtl, echoOff, | | 158 | * The echoing of command lines is controlled using hasEchoCtl, echoOff, |
159 | * echoOn, noPrint and noPrintLen. When echoOff is executed by the shell, it | | 159 | * echoOn, noPrint and noPrintLen. When echoOff is executed by the shell, it |
| @@ -2321,28 +2321,28 @@ Job_ParseShell(char *line) | | | @@ -2321,28 +2321,28 @@ Job_ParseShell(char *line) |
2321 | if (strncmp(arg, "quiet=", 6) == 0) { | | 2321 | if (strncmp(arg, "quiet=", 6) == 0) { |
2322 | newShell.echoOff = arg + 6; | | 2322 | newShell.echoOff = arg + 6; |
2323 | } else if (strncmp(arg, "echo=", 5) == 0) { | | 2323 | } else if (strncmp(arg, "echo=", 5) == 0) { |
2324 | newShell.echoOn = arg + 5; | | 2324 | newShell.echoOn = arg + 5; |
2325 | } else if (strncmp(arg, "filter=", 7) == 0) { | | 2325 | } else if (strncmp(arg, "filter=", 7) == 0) { |
2326 | newShell.noPrint = arg + 7; | | 2326 | newShell.noPrint = arg + 7; |
2327 | newShell.noPrintLen = strlen(newShell.noPrint); | | 2327 | newShell.noPrintLen = strlen(newShell.noPrint); |
2328 | } else if (strncmp(arg, "echoFlag=", 9) == 0) { | | 2328 | } else if (strncmp(arg, "echoFlag=", 9) == 0) { |
2329 | newShell.echo = arg + 9; | | 2329 | newShell.echo = arg + 9; |
2330 | } else if (strncmp(arg, "errFlag=", 8) == 0) { | | 2330 | } else if (strncmp(arg, "errFlag=", 8) == 0) { |
2331 | newShell.exit = arg + 8; | | 2331 | newShell.exit = arg + 8; |
2332 | } else if (strncmp(arg, "hasErrCtl=", 10) == 0) { | | 2332 | } else if (strncmp(arg, "hasErrCtl=", 10) == 0) { |
2333 | char c = arg[10]; | | 2333 | char c = arg[10]; |
2334 | newShell.hasErrCtl = !((c != 'Y') && (c != 'y') && | | 2334 | newShell.hasErrCtl = c == 'Y' || c == 'y' || |
2335 | (c != 'T') && (c != 't')); | | 2335 | c == 'T' || c == 't'; |
2336 | } else if (strncmp(arg, "newline=", 8) == 0) { | | 2336 | } else if (strncmp(arg, "newline=", 8) == 0) { |
2337 | newShell.newline = arg + 8; | | 2337 | newShell.newline = arg + 8; |
2338 | } else if (strncmp(arg, "check=", 6) == 0) { | | 2338 | } else if (strncmp(arg, "check=", 6) == 0) { |
2339 | newShell.errOnOrEcho = arg + 6; | | 2339 | newShell.errOnOrEcho = arg + 6; |
2340 | } else if (strncmp(arg, "ignore=", 7) == 0) { | | 2340 | } else if (strncmp(arg, "ignore=", 7) == 0) { |
2341 | newShell.errOffOrExecIgnore = arg + 7; | | 2341 | newShell.errOffOrExecIgnore = arg + 7; |
2342 | } else if (strncmp(arg, "errout=", 7) == 0) { | | 2342 | } else if (strncmp(arg, "errout=", 7) == 0) { |
2343 | newShell.errExit = arg + 7; | | 2343 | newShell.errExit = arg + 7; |
2344 | } else if (strncmp(arg, "comment=", 8) == 0) { | | 2344 | } else if (strncmp(arg, "comment=", 8) == 0) { |
2345 | newShell.commentChar = arg[8]; | | 2345 | newShell.commentChar = arg[8]; |
2346 | } else { | | 2346 | } else { |
2347 | Parse_Error(PARSE_FATAL, "Unknown keyword \"%s\"", arg); | | 2347 | Parse_Error(PARSE_FATAL, "Unknown keyword \"%s\"", arg); |
2348 | free(words); | | 2348 | free(words); |