zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] typeset -p doesn't report -U (unique) attribute
@ 2018-09-24 21:05 Stephane Chazelas
  2018-09-25 16:41 ` Daniel Shahaf
  2018-10-07 13:35 ` [PATCH] [long] typeset doesn't report tied parameters (and related issues) Stephane Chazelas
  0 siblings, 2 replies; 27+ messages in thread
From: Stephane Chazelas @ 2018-09-24 21:05 UTC (permalink / raw)
  To: Zsh hackers list

From:
https://unix.stackexchange.com/questions/470956/how-to-print-all-the-attributes-of-a-zsh-parameter


$ typeset -U a=(x x)
$ typeset -p a
typeset -a a=( x )

Expected:

$ typeset -p a
typeset -aU a=( x )


diff --git a/Src/params.c b/Src/params.c
index a1c299f60..f7ecff32a 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -5854,20 +5854,27 @@ printparamnode(HashNode hn, int printflags)
 		if ((pmptr->flags & PMTF_USE_BASE) && p->base) {
 		    printf("%d ", p->base);
 		    doneminus = 0;
 		}
 		if ((pmptr->flags & PMTF_USE_WIDTH) && p->width) {
 		    printf("%d ", p->width);
 		    doneminus = 0;
 		}
 	    }
 	}
+	if (p->node.flags & PM_UNIQUE) {
+	    if (!doneminus) {
+	      putchar('-');
+	      doneminus = 1;
+	    }
+	    putchar('U');
+	}
 	if (doneminus)
 	    putchar(' ');
     }
 
     if ((printflags & PRINT_NAMEONLY) ||
 	((p->node.flags & PM_HIDEVAL) && !(printflags & PRINT_INCLUDEVALUE))) {
 	zputs(p->node.nam, stdout);
 	putchar('\n');
     } else {
 	if (printflags & PRINT_KV_PAIR) {

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2018-10-11 12:47 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-24 21:05 [PATCH] typeset -p doesn't report -U (unique) attribute Stephane Chazelas
2018-09-25 16:41 ` Daniel Shahaf
2018-10-07 13:35 ` [PATCH] [long] typeset doesn't report tied parameters (and related issues) Stephane Chazelas
2018-10-08  9:05   ` Peter Stephenson
     [not found]     ` <CACeGjnUhNqca7jLAR0KKSxobzDd+xXdAe4BeUeRpxu2CTp_zkA@mail.gmail.com>
2018-10-08 14:10       ` Peter Stephenson
2018-10-08 14:28         ` Daniel Shahaf
2018-10-08 15:24           ` Peter Stephenson
2018-10-08 15:49             ` Daniel Shahaf
2018-10-08 15:57               ` Bart Schaefer
2018-10-08 16:06                 ` Daniel Shahaf
2018-10-08 16:52                   ` Bart Schaefer
2018-10-08 16:58                     ` Peter Stephenson
2018-10-08 16:02               ` Daniel Shahaf
2018-10-08 16:19                 ` Peter Stephenson
2018-10-08 16:43               ` Peter Stephenson
2018-10-08 16:58                 ` Daniel Shahaf
2018-10-08 17:14                   ` Bart Schaefer
2018-10-08 19:39                     ` Stephane Chazelas
2018-10-09  9:02                   ` Peter Stephenson
     [not found]                   ` <1539075745.1499.2.camel@samsung.com>
2018-10-09  9:44                     ` Peter Stephenson
2018-10-09 16:52                       ` Bart Schaefer
2018-10-09 23:40                         ` Vin Shelton
2018-10-08 15:54             ` Bart Schaefer
2018-10-08 16:40               ` Bart Schaefer
2018-10-09 10:59   ` local read-only variables (Was:[PATCH] [long] typeset doesn't report tied parameters (and related issues)) Stephane Chazelas
2018-10-11  9:45   ` [PATCH] [long] typeset doesn't report tied parameters (and related issues) Oliver Kiddle
2018-10-11 12:46     ` Peter Stephenson

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).