summaryrefslogtreecommitdiff
path: root/usr.bin/make
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2020-12-12 21:20:30 +0000
committerrillig <rillig@NetBSD.org>2020-12-12 21:20:30 +0000
commite176ea96fa31090f49c35679c66d5f2d60024bf5 (patch)
tree1eea72f5a0973bcf941ef552937eb7933eb2f1cd /usr.bin/make
parent355f4d09f5ec8086bf1dd7ec0fe55935f23ca575 (diff)
make(1): eliminate boolean argument of Var_Export
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/nonints.h5
-rw-r--r--usr.bin/make/parse.c8
-rw-r--r--usr.bin/make/var.c20
3 files changed, 20 insertions, 13 deletions
diff --git a/usr.bin/make/nonints.h b/usr.bin/make/nonints.h
index 679b2037ee1..dcc9442432f 100644
--- a/usr.bin/make/nonints.h
+++ b/usr.bin/make/nonints.h
@@ -1,4 +1,4 @@
-/* $NetBSD: nonints.h,v 1.167 2020/12/12 18:53:53 rillig Exp $ */
+/* $NetBSD: nonints.h,v 1.168 2020/12/12 21:20:30 rillig Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@@ -324,7 +324,8 @@ VarParseResult Var_Subst(const char *, GNode *, VarEvalFlags, char **);
void Var_Stats(void);
void Var_Dump(GNode *);
void Var_ReexportVars(void);
-void Var_Export(const char *, Boolean);
+void Var_Export(const char *);
+void Var_ExportVars(const char *);
void Var_UnExport(const char *);
/* util.c */
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index 5d2ac384750..927c05cd169 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.472 2020/12/06 20:33:44 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.473 2020/12/12 21:20:30 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.472 2020/12/06 20:33:44 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.473 2020/12/12 21:20:30 rillig Exp $");
/* types and constants */
@@ -2042,7 +2042,7 @@ VarAssignSpecial(const char *name, const char *avalue)
} else if (strcmp(name, MAKE_JOB_PREFIX) == 0)
Job_SetPrefix();
else if (strcmp(name, MAKE_EXPORTED) == 0)
- Var_Export(avalue, FALSE);
+ Var_ExportVars(avalue);
}
/* Perform the variable variable assignment in the given context. */
@@ -2983,7 +2983,7 @@ ParseDirective(char *line)
} else if (strncmp(cp, "export", 6) == 0) {
cp += 6;
pp_skip_whitespace(&cp);
- Var_Export(cp, TRUE);
+ Var_Export(cp);
return TRUE;
} else if (strncmp(cp, "unexport", 8) == 0) {
Var_UnExport(cp);
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index f7492b73db3..fda647b89b1 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.728 2020/12/12 20:00:51 rillig Exp $ */
+/* $NetBSD: var.c,v 1.729 2020/12/12 21:20:30 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.728 2020/12/12 20:00:51 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.729 2020/12/12 21:20:30 rillig Exp $");
/* A string that may need to be freed after use. */
typedef struct FStr {
@@ -714,26 +714,32 @@ ExportVarsExpand(const char *uvarnames, Boolean isExport, VarExportFlags flags)
* str has the format "[-env|-literal] varname...".
*/
void
-Var_Export(const char *str, Boolean isExport)
+Var_Export(const char *str)
{
VarExportFlags flags;
- if (isExport && str[0] == '\0') {
+ if (str[0] == '\0') {
var_exportedVars = VAR_EXPORTED_ALL; /* use with caution! */
return;
}
- if (isExport && strncmp(str, "-env", 4) == 0) {
+ if (strncmp(str, "-env", 4) == 0) {
str += 4;
flags = VAR_EXPORT_NORMAL;
- } else if (isExport && strncmp(str, "-literal", 8) == 0) {
+ } else if (strncmp(str, "-literal", 8) == 0) {
str += 8;
flags = VAR_EXPORT_LITERAL;
} else {
flags = VAR_EXPORT_PARENT;
}
- ExportVarsExpand(str, isExport, flags);
+ ExportVarsExpand(str, TRUE, flags);
+}
+
+void
+Var_ExportVars(const char *varnames)
+{
+ ExportVarsExpand(varnames, FALSE, VAR_EXPORT_PARENT);
}