about summary refs log tree commit diff
path: root/Src/subst.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/subst.c')
-rw-r--r--Src/subst.c13
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