summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1992-05-04 22:37:22 +0000
committerRoland McGrath <roland@redhat.com>1992-05-04 22:37:22 +0000
commit2ebaa9f881d63ba63bef02c0d4a68607ddd54182 (patch)
tree229f571af392f7a471abb5079f4a766d9c5ee42f /variable.c
parent207db3747f92b9e28a979802fef68eb07e3c677a (diff)
downloadgunmake-2ebaa9f881d63ba63bef02c0d4a68607ddd54182.tar.gz
Formerly variable.c.~3~
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/variable.c b/variable.c
index c5a63dc..16e5ada 100644
--- a/variable.c
+++ b/variable.c
@@ -423,6 +423,8 @@ initialize_variable_output ()
return variable_buffer;
}
+int export_all_variables;
+
/* Create a new environment for FILE's commands.
The child's MAKELEVEL variable is incremented. */
@@ -441,6 +443,7 @@ target_environment (file)
register unsigned int i;
register unsigned nvariables;
char **result;
+ unsigned int mklev_hash;
/* Find the lowest number of buckets in any set in the list. */
s = file->variables;
@@ -449,6 +452,14 @@ target_environment (file)
if (s->set->buckets < buckets)
buckets = s->set->buckets;
+ /* Find the hash value of `MAKELEVEL' will fall into. */
+ {
+ char *p = "MAKELEVEL";
+ mklev_hash = 0;
+ while (*p != '\0')
+ HASH (mklev_hash, *p++);
+ }
+
/* Temporarily allocate a table with that many buckets. */
table = (struct variable_bucket **)
alloca (buckets * sizeof (struct variable_bucket *));
@@ -470,10 +481,17 @@ target_environment (file)
register struct variable_bucket *ov;
register char *p = v->name;
+ if (i == mklev_hash % set->buckets
+ && streq (v->name, "MAKELEVEL"))
+ /* Don't include MAKELEVEL because it will be
+ added specially at the end. */
+ continue;
+
switch (v->export)
{
case v_default:
- if (v->origin != o_command
+ if (!export_all_variables
+ && v->origin != o_command
&& v->origin != o_env && v->origin != o_env_override
&& !(v->origin == o_file && getenv (p) != 0))
continue;