Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: typeset -n -H



On Tue, Feb 11, 2025 at 8:26 AM Oliver Kiddle <opk@xxxxxxx> wrote:
>
> Should +n -m be similarly blocked because that appears to work?

I think you mean this?

diff --git a/Src/builtin.c b/Src/builtin.c
index 2fab73b24..9877c6d8f 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3053,12 +3053,11 @@ bin_typeset(char *name, char **argv, LinkList
assigns, Options ops, int func)
     /* With the -m option, treat arguments as glob patterns */
     if (OPT_ISSET(ops,'m')) {
        if (!OPT_ISSET(ops,'p')) {
-           if (on & PM_NAMEREF) {
+           if ((on & PM_NAMEREF) && OPT_MINUS(ops,'m')) {
                /* It's generally unwise to mass-change the types of
                 * parameters, but for namerefs it would be fatal */
                unqueue_signals();
-               zerrnam(name, "%cm not allowed with -n",
-                       (OPT_PLUS(ops,'m') ? '+' : '-'));
+               zerrnam(name, "-m not allowed with -n");
                return 1;
            }
            if (!(on|roff))




Messages sorted by: Reverse Date, Date, Thread, Author