Include disabled options in the output of 'set +o'. POSIX says the output of
set +o can be used to reload previous settings, for this to work disabled options must be printed as well or otherwise options that were set in the mean time won't be turned off. To avoid an excessively long output line I formatted the output to print only six options per line. Submitted by: Jilles Tjoelker PR: 73500
This commit is contained in:
parent
19b114da0e
commit
70293cc76a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=151866
@ -247,7 +247,7 @@ options(int cmdline)
|
||||
STATIC void
|
||||
minus_o(char *name, int val)
|
||||
{
|
||||
int doneset, i;
|
||||
int i;
|
||||
|
||||
if (name == NULL) {
|
||||
if (val) {
|
||||
@ -258,16 +258,13 @@ minus_o(char *name, int val)
|
||||
optlist[i].val ? "on" : "off");
|
||||
} else {
|
||||
/* Output suitable for re-input to shell. */
|
||||
for (doneset = i = 0; i < NOPTS; i++)
|
||||
if (optlist[i].val) {
|
||||
if (!doneset) {
|
||||
out1str("set");
|
||||
doneset = 1;
|
||||
}
|
||||
out1fmt(" -o %s", optlist[i].name);
|
||||
}
|
||||
if (doneset)
|
||||
out1c('\n');
|
||||
for (i = 0; i < NOPTS; i++) {
|
||||
if (i % 6 == 0)
|
||||
out1str(i == 0 ? "set" : "\nset");
|
||||
out1fmt(" %co %s", optlist[i].val ? '-' : '+',
|
||||
optlist[i].name);
|
||||
}
|
||||
out1c('\n');
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < NOPTS; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user