2008-08-20 14:00:34 +00:00
|
|
|
--- a/shell/ash.c
|
|
|
|
+++ b/shell/ash.c
|
2011-10-21 23:08:45 +00:00
|
|
|
@@ -12611,8 +12611,17 @@ exportcmd(int argc UNUSED_PARAM, char **
|
2006-11-22 20:17:18 +00:00
|
|
|
const char *p;
|
|
|
|
char **aptr;
|
2009-05-25 13:52:31 +00:00
|
|
|
int flag = argv[0][0] == 'r' ? VREADONLY : VEXPORT;
|
2006-11-22 20:17:18 +00:00
|
|
|
+ int mask = ~0;
|
2007-10-05 00:27:49 +00:00
|
|
|
+ int nopt;
|
|
|
|
+ while ((nopt = nextopt("np"))) {
|
|
|
|
+ if (nopt == 'n') {
|
2006-11-22 20:17:18 +00:00
|
|
|
+ mask = ~flag;
|
|
|
|
+ } else { /* p */
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
2008-08-20 14:00:34 +00:00
|
|
|
|
|
|
|
- if (nextopt("p") != 'p') {
|
2007-10-05 00:27:49 +00:00
|
|
|
+ if (nopt != 'p') {
|
|
|
|
aptr = argptr;
|
|
|
|
name = *aptr;
|
|
|
|
if (name) {
|
2014-03-20 14:14:30 +00:00
|
|
|
@@ -12624,10 +12633,11 @@ exportcmd(int argc UNUSED_PARAM, char **
|
2007-10-05 00:27:49 +00:00
|
|
|
vp = *findvar(hashvar(name), name);
|
|
|
|
if (vp) {
|
|
|
|
vp->flags |= flag;
|
|
|
|
+ vp->flags &= mask;
|
|
|
|
continue;
|
|
|
|
}
|
2006-11-22 20:17:18 +00:00
|
|
|
}
|
2014-03-20 14:14:30 +00:00
|
|
|
- setvar(name, p, flag);
|
2007-10-05 00:27:49 +00:00
|
|
|
+ setvar(name, p, flag & mask);
|
|
|
|
} while ((name = *++aptr) != NULL);
|
|
|
|
return 0;
|
|
|
|
}
|