make(1): use consistent name for result of Cmd_Exec
This commit is contained in:
parent
6aab009d48
commit
7b21ea36c4
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: var.c,v 1.415 2020/08/06 17:48:41 rillig Exp $ */
|
/* $NetBSD: var.c,v 1.416 2020/08/06 17:51:21 rillig Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988, 1989, 1990, 1993
|
* Copyright (c) 1988, 1989, 1990, 1993
|
||||||
@ -69,14 +69,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MAKE_NATIVE
|
#ifndef MAKE_NATIVE
|
||||||
static char rcsid[] = "$NetBSD: var.c,v 1.415 2020/08/06 17:48:41 rillig Exp $";
|
static char rcsid[] = "$NetBSD: var.c,v 1.416 2020/08/06 17:51:21 rillig Exp $";
|
||||||
#else
|
#else
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
|
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: var.c,v 1.415 2020/08/06 17:48:41 rillig Exp $");
|
__RCSID("$NetBSD: var.c,v 1.416 2020/08/06 17:51:21 rillig Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
#endif
|
#endif
|
||||||
@ -2136,7 +2136,7 @@ ApplyModifier_Exclam(const char **pp, ApplyModifiersState *st)
|
|||||||
{
|
{
|
||||||
char delim;
|
char delim;
|
||||||
char *cmd;
|
char *cmd;
|
||||||
const char *emsg;
|
const char *errfmt;
|
||||||
|
|
||||||
(*pp)++;
|
(*pp)++;
|
||||||
delim = '!';
|
delim = '!';
|
||||||
@ -2147,15 +2147,15 @@ ApplyModifier_Exclam(const char **pp, ApplyModifiersState *st)
|
|||||||
return AMR_CLEANUP;
|
return AMR_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
emsg = NULL;
|
errfmt = NULL;
|
||||||
if (st->eflags & VARE_WANTRES)
|
if (st->eflags & VARE_WANTRES)
|
||||||
st->newVal = Cmd_Exec(cmd, &emsg);
|
st->newVal = Cmd_Exec(cmd, &errfmt);
|
||||||
else
|
else
|
||||||
st->newVal = varNoError;
|
st->newVal = varNoError;
|
||||||
free(cmd);
|
free(cmd);
|
||||||
|
|
||||||
if (emsg != NULL)
|
if (errfmt != NULL)
|
||||||
Error(emsg, st->val); /* XXX: why still return AMR_OK? */
|
Error(errfmt, st->val); /* XXX: why still return AMR_OK? */
|
||||||
|
|
||||||
if (st->v->flags & VAR_JUNK)
|
if (st->v->flags & VAR_JUNK)
|
||||||
st->v->flags |= VAR_KEEP;
|
st->v->flags |= VAR_KEEP;
|
||||||
@ -2845,10 +2845,10 @@ ApplyModifier_Assign(const char **pp, ApplyModifiersState *st)
|
|||||||
Var_Append(st->v->name, val, v_ctxt);
|
Var_Append(st->v->name, val, v_ctxt);
|
||||||
break;
|
break;
|
||||||
case '!': {
|
case '!': {
|
||||||
const char *emsg;
|
const char *errfmt;
|
||||||
char *cmd_output = Cmd_Exec(val, &emsg);
|
char *cmd_output = Cmd_Exec(val, &errfmt);
|
||||||
if (emsg)
|
if (errfmt)
|
||||||
Error(emsg, st->val);
|
Error(errfmt, st->val);
|
||||||
else
|
else
|
||||||
Var_Set(st->v->name, cmd_output, v_ctxt);
|
Var_Set(st->v->name, cmd_output, v_ctxt);
|
||||||
free(cmd_output);
|
free(cmd_output);
|
||||||
@ -3216,10 +3216,10 @@ ApplyModifiers(
|
|||||||
case 's':
|
case 's':
|
||||||
if (p[1] == 'h' && (p[2] == st.endc || p[2] == ':')) {
|
if (p[1] == 'h' && (p[2] == st.endc || p[2] == ':')) {
|
||||||
if (st.eflags & VARE_WANTRES) {
|
if (st.eflags & VARE_WANTRES) {
|
||||||
const char *emsg;
|
const char *errfmt;
|
||||||
st.newVal = Cmd_Exec(st.val, &emsg);
|
st.newVal = Cmd_Exec(st.val, &errfmt);
|
||||||
if (emsg)
|
if (errfmt)
|
||||||
Error(emsg, st.val);
|
Error(errfmt, st.val);
|
||||||
} else
|
} else
|
||||||
st.newVal = varNoError;
|
st.newVal = varNoError;
|
||||||
p += 2;
|
p += 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user