Op 27-09-17 om 03:48 schreef Thorsten Glaser:
Martijn Dekker dixit:

I’ll put the issue on my TODO only, for now, but thanks anyway.

We're at R56 now but nothing seems to have changed here. Status?

It’s on the TODO.

Here's another attempt at a patch. Note that this version checks for OFF(i) != OF_CMDLINE to exclude immutable command line-only options (interactive, login, restricted, stdin).

- M.
diff --git a/misc.c b/misc.c
index cddc516..0d3ff6c 100644
--- a/misc.c
+++ b/misc.c
@@ -185,11 +185,11 @@ printoptions(bool verbose)
                print_columns(&co, n, options_fmt_entry, &oi,
                    octs + 4, oi.opt_width + 4);
        } else {
-               /* short version like AT&T ksh93 */
+               /* short version: command to restore current options */
                shf_puts(Tset, shl_stdout);
                while (i < NELEM(options)) {
-                       if (Flag(i) && OFN(i)[0])
-                               shprintf(" -o %s", OFN(i));
+                       if (OFN(i)[0] && OFF(i) != OF_CMDLINE)
+                               shprintf(" %co %s", Flag(i) ? '-' : '+', 
OFN(i));
                        ++i;
                }
                shf_putc('\n', shl_stdout);
diff --git a/mksh.1 b/mksh.1
index d786e99..42f5e12 100644
--- a/mksh.1
+++ b/mksh.1
@@ -4395,12 +4395,7 @@ options (with single letter names) can be found in the 
parameter
 .Ic set Fl o
 with no option name will list all the options and whether each is on or off;
 .Ic set +o
-will print the long names of all options that are currently on.
-In a future version,
-.Ic set +o
-will behave
-.Tn POSIX
-compliant and print commands to restore the current options instead.
+prints a command that restores the current options.
 .Pp
 Remaining arguments, if any, are positional parameters and are assigned, in
 order, to the positional parameters (i.e. $1, $2, etc.).

Reply via email to