From ebd05dbeb31dbc09c496d76e802d9b68bd848e9a Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Wed, 18 Sep 2002 20:51:58 +0000 Subject: Fix a bug exporting/unexporting multiple variables in one command. Update the text about reporting bugs. --- read.c | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) (limited to 'read.c') diff --git a/read.c b/read.c index 3488524..c135acc 100644 --- a/read.c +++ b/read.c @@ -683,25 +683,23 @@ eval (ebuf, set_default) else { unsigned int len; + char *ap; + + /* Expand the line so we can use indirect and constructed + variable names in an export command. */ + p2 = ap = allocated_variable_expand (p2); + for (p = find_next_token (&p2, &len); p != 0; p = find_next_token (&p2, &len)) { - char *var; - int l; - - /* Expand the thing we're looking up, so we can use - indirect and constructed variable names. */ - p[len] = '\0'; - var = allocated_variable_expand (p); - l = strlen (var); - - v = lookup_variable (var, l); + v = lookup_variable (p, len); if (v == 0) - v = define_variable_loc (var, l, "", o_file, 0, + v = define_variable_loc (p, len, "", o_file, 0, fstart); v->export = v_export; - free (var); } + + free (ap); } } goto rule_complete; @@ -715,26 +713,23 @@ eval (ebuf, set_default) { unsigned int len; struct variable *v; + char *ap; + + /* Expand the line so we can use indirect and constructed + variable names in an unexport command. */ + p2 = ap = allocated_variable_expand (p2); + for (p = find_next_token (&p2, &len); p != 0; p = find_next_token (&p2, &len)) { - char *var; - int l; - - /* Expand the thing we're looking up, so we can use - indirect and constructed variable names. */ - p[len] = '\0'; - var = allocated_variable_expand (p); - l = strlen (var); - - v = lookup_variable (var, l); + v = lookup_variable (p, len); if (v == 0) - v = define_variable_loc (var, l, "", o_file, 0, fstart); + v = define_variable_loc (p, len, "", o_file, 0, fstart); v->export = v_noexport; - - free (var); } + + free (ap); } goto rule_complete; } -- cgit v1.2.3