(start_job_command): Use `message' to print the command, and call it with

an empty string if the command is silent.
This commit is contained in:
Roland McGrath 1995-11-22 00:06:28 +00:00
parent 21fbad8602
commit 10d6808977

26
job.c
View File

@ -544,7 +544,7 @@ start_job_command (child)
1 tells the user that -q is saying `something to do'; the exit status 1 tells the user that -q is saying `something to do'; the exit status
for a random error is 2. */ for a random error is 2. */
if (question_flag && !(flags & COMMANDS_RECURSE)) if (question_flag && !(flags & COMMANDS_RECURSE))
{ {
child->file->update_status = 1; child->file->update_status = 1;
notice_finished_file (child->file); notice_finished_file (child->file);
return; return;
@ -553,9 +553,9 @@ start_job_command (child)
/* There may be some preceding whitespace left if there /* There may be some preceding whitespace left if there
was nothing but a backslash on the first line. */ was nothing but a backslash on the first line. */
p = next_token (p); p = next_token (p);
/* Figure out an argument list from this command line. */ /* Figure out an argument list from this command line. */
{ {
char *end; char *end;
argv = construct_command_argv (p, &end, child->file); argv = construct_command_argv (p, &end, child->file);
@ -592,10 +592,12 @@ start_job_command (child)
return; return;
} }
/* Print out the command. */ /* Print out the command. If silent, we call `message' with an empty
string so it can log the working directory before the command's own
error messages appear. */
if (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag)) message ((just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag))
puts (p); ? "" : "%s\n", p);
/* Tell update_goal_chain that a command has been started on behalf of /* Tell update_goal_chain that a command has been started on behalf of
this target. It is important that this happens here and not in this target. It is important that this happens here and not in
@ -619,7 +621,7 @@ start_job_command (child)
fflush (stdout); fflush (stdout);
fflush (stderr); fflush (stderr);
/* Set up a bad standard input that reads from a broken pipe. */ /* Set up a bad standard input that reads from a broken pipe. */
if (bad_stdin == -1) if (bad_stdin == -1)
@ -1076,7 +1078,7 @@ exec_command (argv, envp)
/* Run the program. */ /* Run the program. */
environ = envp; environ = envp;
execvp (argv[0], argv); execvp (argv[0], argv);
switch (errno) switch (errno)
{ {
case ENOENT: case ENOENT:
@ -1402,14 +1404,14 @@ construct_command_argv_internal (line, restp, shell, ifs)
"SHELL -c LINE", with all special chars in LINE escaped. "SHELL -c LINE", with all special chars in LINE escaped.
Then recurse, expanding this command line to get the final Then recurse, expanding this command line to get the final
argument list. */ argument list. */
unsigned int shell_len = strlen (shell); unsigned int shell_len = strlen (shell);
static char minus_c[] = " -c "; static char minus_c[] = " -c ";
unsigned int line_len = strlen (line); unsigned int line_len = strlen (line);
char *new_line = (char *) alloca (shell_len + (sizeof (minus_c) - 1) char *new_line = (char *) alloca (shell_len + (sizeof (minus_c) - 1)
+ (line_len * 2) + 1); + (line_len * 2) + 1);
ap = new_line; ap = new_line;
bcopy (shell, ap, shell_len); bcopy (shell, ap, shell_len);
ap += shell_len; ap += shell_len;
@ -1450,7 +1452,7 @@ construct_command_argv_internal (line, restp, shell, ifs)
*ap++ = *p; *ap++ = *p;
} }
*ap = '\0'; *ap = '\0';
new_argv = construct_command_argv_internal (new_line, (char **) NULL, new_argv = construct_command_argv_internal (new_line, (char **) NULL,
(char *) 0, (char *) 0); (char *) 0, (char *) 0);
} }