2008-08-20 17:00:34 +03:00
|
|
|
--- a/shell/ash.c
|
|
|
|
+++ b/shell/ash.c
|
2008-09-22 15:36:13 +03:00
|
|
|
@@ -11909,8 +11909,17 @@
|
2006-11-22 22:17:18 +02:00
|
|
|
const char *p;
|
|
|
|
char **aptr;
|
|
|
|
int flag = argv[0][0] == 'r'? VREADONLY : VEXPORT;
|
|
|
|
+ int mask = ~0;
|
2007-10-05 03:27:49 +03:00
|
|
|
+ int nopt;
|
|
|
|
+ while ((nopt = nextopt("np"))) {
|
|
|
|
+ if (nopt == 'n') {
|
2006-11-22 22:17:18 +02:00
|
|
|
+ mask = ~flag;
|
|
|
|
+ } else { /* p */
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
2008-08-20 17:00:34 +03:00
|
|
|
|
|
|
|
- if (nextopt("p") != 'p') {
|
2007-10-05 03:27:49 +03:00
|
|
|
+ if (nopt != 'p') {
|
|
|
|
aptr = argptr;
|
|
|
|
name = *aptr;
|
|
|
|
if (name) {
|
2008-09-22 15:36:13 +03:00
|
|
|
@@ -11922,10 +11931,12 @@
|
2007-10-05 03:27:49 +03:00
|
|
|
vp = *findvar(hashvar(name), name);
|
|
|
|
if (vp) {
|
|
|
|
vp->flags |= flag;
|
|
|
|
+ vp->flags &= mask;
|
|
|
|
continue;
|
|
|
|
}
|
2006-11-22 22:17:18 +02:00
|
|
|
}
|
2008-08-20 17:00:34 +03:00
|
|
|
setvar(name, p, flag);
|
2007-10-05 03:27:49 +03:00
|
|
|
+ setvar(name, p, flag & mask);
|
|
|
|
} while ((name = *++aptr) != NULL);
|
|
|
|
return 0;
|
|
|
|
}
|