version 1.35, 2000/06/23 16:20:01 |
version 1.36, 2000/06/23 16:21:44 |
|
|
* look for it in VAR_CMD, VAR_GLOBAL and the environment, in that order, |
* look for it in VAR_CMD, VAR_GLOBAL and the environment, in that order, |
* depending on the FIND_* flags in 'flags' |
* depending on the FIND_* flags in 'flags' |
*/ |
*/ |
var = Lst_Find(ctxt, VarCmp, name); |
if (ctxt != NULL) |
|
var = Lst_Find(ctxt, VarCmp, name); |
|
else |
|
var = NULL; |
|
|
if ((var == NULL) && (flags & FIND_CMD) && (ctxt != VAR_CMD)) |
if ((var == NULL) && (flags & FIND_CMD) && (ctxt != VAR_CMD)) |
var = Lst_Find(VAR_CMD, VarCmp, name); |
var = Lst_Find(VAR_CMD, VarCmp, name); |
|
|
if (v == NULL) { |
if (v == NULL) { |
*lengthPtr = 2; |
*lengthPtr = 2; |
|
|
if ((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL)) { |
if (ctxt == VAR_CMD || ctxt == VAR_GLOBAL || ctxt == NULL) { |
/* |
/* |
* If substituting a local variable in a non-local context, |
* If substituting a local variable in a non-local context, |
* assume it's for dynamic source stuff. We have to handle |
* assume it's for dynamic source stuff. We have to handle |
|
|
*tstr = '\0'; |
*tstr = '\0'; |
|
|
v = VarFind (str + 2, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD); |
v = VarFind (str + 2, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD); |
if ((v == NULL) && (ctxt != VAR_CMD) && (ctxt != VAR_GLOBAL) && |
if (v == NULL && ctxt != VAR_CMD && ctxt != VAR_GLOBAL && |
((tstr-str) == 4) && (str[3] == 'F' || str[3] == 'D')) |
ctxt != NULL && |
|
(tstr-str) == 4 && (str[3] == 'F' || str[3] == 'D')) |
{ |
{ |
/* |
/* |
* Check for bogus D and F forms of local variables since we're |
* Check for bogus D and F forms of local variables since we're |
|
|
} |
} |
|
|
if (v == NULL) { |
if (v == NULL) { |
if ((((tstr-str) == 3) || |
if ((tstr-str == 3 || |
((((tstr-str) == 4) && (str[3] == 'F' || |
((tstr-str == 4 && (str[3] == 'F' || |
str[3] == 'D')))) && |
str[3] == 'D')))) && |
((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL))) |
(ctxt == VAR_CMD || ctxt == VAR_GLOBAL || ctxt == NULL)) |
{ |
{ |
/* |
/* |
* If substituting a local variable in a non-local context, |
* If substituting a local variable in a non-local context, |
|
|
} |
} |
} else if (((tstr-str) > 4) && (str[2] == '.') && |
} else if (((tstr-str) > 4) && (str[2] == '.') && |
isupper((unsigned char) str[3]) && |
isupper((unsigned char) str[3]) && |
((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL))) |
(ctxt == VAR_CMD || ctxt == VAR_GLOBAL || ctxt == NULL)) |
{ |
{ |
int len; |
int len; |
|
|