diff options
author | Clint Adams <clint@users.sourceforge.net> | 2001-12-16 20:53:44 +0000 |
---|---|---|
committer | Clint Adams <clint@users.sourceforge.net> | 2001-12-16 20:53:44 +0000 |
commit | 1e103ebef330694fe94889127df2c166aa4804a1 (patch) | |
tree | c730f3b2d1833f8b1e6df853d40386d2d4f7c4d6 /Src/subst.c | |
parent | 2c71f2ce29055c14083de7cc62b0bd6e652c712f (diff) | |
download | zsh-1e103ebef330694fe94889127df2c166aa4804a1.tar.gz zsh-1e103ebef330694fe94889127df2c166aa4804a1.tar.xz zsh-1e103ebef330694fe94889127df2c166aa4804a1.zip |
16345: (n) flag to remove duplicate array values during expansion.
Diffstat (limited to 'Src/subst.c')
-rw-r--r-- | Src/subst.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Src/subst.c b/Src/subst.c index a42b81358..9a59495d0 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -767,6 +767,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) int flags = 0; int flnum = 0; int sortit = 0, casind = 0; + int unique = 0; int casmod = 0; int quotemod = 0, quotetype = 0, quoteerr = 0; int visiblemod = 0; @@ -996,6 +997,10 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) shsplit = 1; break; + case 'n': + unique = 1; + break; + default: flagerr: zerr("error in flags", NULL, 0); @@ -1873,6 +1878,14 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) setdata(n, y); return n; } + if (unique) { +/* if(!copied) */ + aval = arrdup(aval); + + i = arrlen(aval); + if (i > 1) + zhuniqarray(aval); + } if (sortit) { static CompareFn sortfn[] = { strpcmp, invstrpcmp, cstrpcmp, invcstrpcmp |