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

Re: typeset -F3 SECONDS doesn't work the first time

On Jun 27,  7:58pm, Mikael Magnusson wrote:
} >                 } else if (!setsecondstype(pm, on, off)) {
} >                     if (value && !setsparam(pname, ztrdup(value)))
} >                         return NULL;
} >                     /* return pm; */
} >                     usepm = 1;
} >                     err = 0;
} >                 }
} >
} > (Not provided as a patch because I don't have time right now to test it.)
} This appears to work.

I've now tried this with various typeset flags, assigning a value to
SECONDS in the typeset call, etc., and haven't gotten it to break.

Is there any circumstance in which setsparam() [which is a macro around
assignsparam()] could render pm invalid?  It doesn't look like it from
examination of the code, but maybe this should be

                } else if (!setsecondstype(pm, on, off)) {
                    if (value && !(pm = setsparam(pname, ztrdup(value))))
                        return NULL;
                    usepm = 1;
                    err = 0;

(Note the assignment to pm.)

Aside:  Exporting SECONDS doesn't do what you might think.  The value at
the time of the export is enshrined in the environment and never changes,
and is thereafter the starting clock for newly-started shells.

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