From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh Hackers' List <zsh-workers@zsh.org>
Subject: Re: "functions +t" etc. output
Date: Thu, 21 Feb 2013 15:54:55 +0000 [thread overview]
Message-ID: <20130221155455.0c4c071b@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20130221123343.692abdec@pwslap01u.europe.root.pri>
On Thu, 21 Feb 2013 12:33:43 +0000
Peter Stephenson <p.stephenson@samsung.com> wrote:
> For "typeset" etc., with flags but no arguments,
>
> using ‘+’ rather than ‘-’ to introduce the flag
> suppresses printing of the values of parameters when there is no
> parameter name.
>
> It would seem to me this ought to apply to "functions", in fact it's
> even more useful if you want to see the functions with a particular flag
> to suppress the body of the function, which might be huge. But it
> doesn't work --- you get the body of the function.
>
> It does work if you add an extra and otherwise redundant "+", which you
> don't need in the typeset case, leading me to suppose this is just a
> bug. Same feacha with autoload.
Remembering that the option +/-f is only tested for in the caller, if
that's bin_typeset(), and that implicitly turned off flags shouldn't be
included, you get something like this...
diff --git a/Src/builtin.c b/Src/builtin.c
index f13167f..d91c2d9 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2680,7 +2680,7 @@ bin_functions(char *name, char **argv, Options ops, int func)
Patprog pprog;
Shfunc shf;
int i, returnval = 0;
- int on = 0, off = 0, pflags = 0;
+ int on = 0, off = 0, pflags = 0, roff;
/* Do we have any flags defined? */
if (OPT_PLUS(ops,'u'))
@@ -2699,16 +2699,21 @@ bin_functions(char *name, char **argv, Options ops, int func)
on |= PM_TAGGED_LOCAL;
else if (OPT_PLUS(ops,'T'))
off |= PM_TAGGED_LOCAL;
+ roff = off;
if (OPT_MINUS(ops,'z')) {
on |= PM_ZSHSTORED;
off |= PM_KSHSTORED;
- } else if (OPT_PLUS(ops,'z'))
+ } else if (OPT_PLUS(ops,'z')) {
off |= PM_ZSHSTORED;
+ roff |= PM_ZSHSTORED;
+ }
if (OPT_MINUS(ops,'k')) {
on |= PM_KSHSTORED;
off |= PM_ZSHSTORED;
- } else if (OPT_PLUS(ops,'k'))
+ } else if (OPT_PLUS(ops,'k')) {
off |= PM_KSHSTORED;
+ roff |= PM_KSHSTORED;
+ }
if ((off & PM_UNDEFINED) || (OPT_ISSET(ops,'k') && OPT_ISSET(ops,'z')) ||
(OPT_MINUS(ops,'X') && (OPT_ISSET(ops,'m') || *argv || !scriptname))) {
@@ -2716,7 +2721,7 @@ bin_functions(char *name, char **argv, Options ops, int func)
return 1;
}
- if (OPT_PLUS(ops,'f') || OPT_ISSET(ops,'+'))
+ if (OPT_PLUS(ops,'f') || roff || OPT_ISSET(ops,'+'))
pflags |= PRINT_NAMEONLY;
if (OPT_MINUS(ops,'M') || OPT_PLUS(ops,'M')) {
--
Peter Stephenson <p.stephenson@samsung.com> Consultant, Software
Tel: +44 (0)1223 434724 Samsung Cambridge Solution Centre
St John's House, St John's Innovation Park,
Cowley Road, Cambridge, CB4 0DS, UK
prev parent reply other threads:[~2013-02-21 16:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-21 12:33 Peter Stephenson
2013-02-21 15:54 ` Peter Stephenson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130221155455.0c4c071b@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).