diff --git a/hash.c b/hash.c index 7eab8560..2e8ad668 100644 --- a/hash.c +++ b/hash.c @@ -229,11 +229,6 @@ extern void initenv(char **envp) { } } -static char *neverexport[] = { - "apid", "apids", "bqstatus", "cdpath", "home", - "ifs", "path", "pid", "ppid", "status", "*" -}; - /* for a few variables that have default values, we export them only if they've been explicitly set; maybeexport[n].flag is TRUE if this has occurred. */ @@ -255,12 +250,13 @@ void set_exportable(char *s, bool b) { static bool var_exportable(char *s) { int i; - for (i = 0; i < arraysize(neverexport); i++) - if (streq(s, neverexport[i])) - return FALSE; + List *noex; for (i = 0; i < arraysize(maybeexport); i++) if (maybeexport[i].flag == FALSE && streq(s, maybeexport[i].name)) return FALSE; + for (noex = varlookup("noexport"); noex != NULL; noex = noex->n) + if (streq(s, noex->w)) + return FALSE; return TRUE; } diff --git a/main.c b/main.c index 471b55ed..bca22a8a 100644 --- a/main.c +++ b/main.c @@ -101,6 +101,9 @@ extern int main(int argc, char *argv[], char *envp[]) { VERSION, "$Release: @(#)" PACKAGE " " VERSION " " DESCRIPTION " $", (void *)0 ); + assigndefault("noexport", + "noexport", "apid", "apids", "bqstatus", "cdpath", "home", + "ifs", "path", "pid", "ppid", "status", "*", (void *)0); initenv(envp); initinput(); null[0] = NULL;