about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--Src/Zle/compcore.c2
-rw-r--r--Src/Zle/compctl.c2
-rw-r--r--Src/Zle/zle_tricky.c6
-rw-r--r--Src/exec.c2
-rw-r--r--Src/glob.c4
-rw-r--r--Src/params.c12
-rw-r--r--Src/subst.c10
-rw-r--r--Src/utils.c4
-rw-r--r--Src/zsh.h2
-rw-r--r--Src/ztype.h2
11 files changed, 30 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 17c439a18..7bbcb2add 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
 2005-10-13  Peter Stephenson  <pws@csr.com>
 
-	* Src/prompt.c, Src/complist.c: 21869: fix multibyte characters
+	* 21871: Src/exec.c, Src/glob.c, Src/params.c, Src/subst.c,
+	Src/utils.c, Src/zsh.h, Src/ztype.h, Src/Zle/compcore.c,
+	Src/Zle/compctl.c, Src/Zle/zle_tricky.c: replace INULL() with
+	more sensible inull() macro.
+
+	* 21869: Src/prompt.c, Src/complist.c: fix multibyte characters
 	in %-substitutions and output of invalid multibyte characters
 	in completion listings.
 
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 4b6c7a3af..e911cee5f 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -1461,7 +1461,7 @@ set_comp_sep(void)
 	autoq = NULL;
     }
     for (p = ns, i = swb; *p; p++, i++) {
-	if (INULL(*p)) {
+	if (inull(*p)) {
 	    if (i < scs) {
 		if (*p == Bnull) {
                     if (p[1] && remq)
diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index 2789068e7..1c1176715 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -2862,7 +2862,7 @@ sep_comp_string(char *ss, char *s, int noffs)
 	autoq = "";
     }
     for (p = ns, i = swb; *p; p++, i++) {
-	if (INULL(*p)) {
+	if (inull(*p)) {
 	    if (i < scs) {
 		soffs--;
 		if (remq && *p == Bnull && p[1])
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 1b9986fb2..0b70c935a 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -775,7 +775,7 @@ docomplete(int lst)
 	    char *w = dupstring(origword), *x, *q, *ox;
 
 	    for (q = w; *q; q++)
-		if (INULL(*q))
+		if (inull(*q))
 		    *q = Nularg;
 	    zlemetacs = wb;
 	    foredel(we - wb);
@@ -1015,7 +1015,7 @@ static int
 has_real_token(const char *s)
 {
     while (*s) {
-	if (itok(*s) && !INULL(*s))
+	if (itok(*s) && !inull(*s))
 	    return 1;
 	s++;
     }
@@ -1487,7 +1487,7 @@ get_comp_string(void)
     }
     /* While building the quoted form, we also clean up the command line. */
     for (p = s, i = wb, j = 0; *p; p++, i++)
-	if (INULL(*p)) {
+	if (inull(*p)) {
 	    if (i < zlemetacs)
 		offs--;
 	    if (*p == Snull && isset(RCQUOTES))
diff --git a/Src/exec.c b/Src/exec.c
index e77a04a53..663cb6ab7 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2864,7 +2864,7 @@ gethere(char *str, int typ)
     char *s, *t, *bptr, c;
 
     for (s = str; *s; s++)
-	if (INULL(*s)) {
+	if (inull(*s)) {
 	    qt = 1;
 	    break;
 	}
diff --git a/Src/glob.c b/Src/glob.c
index be2dcd5ec..a4d02c3c8 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -2588,13 +2588,13 @@ remnulargs(char *s)
 		 * pattern matching.
 		 */
 		continue;
-	    } else if (INULL(c)) {
+	    } else if (inull(c)) {
 		char *t = s - 1;
 
 		while ((c = *s++)) {
 		    if (c == Bnullkeep)
 			*t++ = '\\';
-		    else if (!INULL(c))
+		    else if (!inull(c))
 			*t++ = c;
 		}
 		*t = '\0';
diff --git a/Src/params.c b/Src/params.c
index 218744000..835c12230 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -1043,8 +1043,8 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w)
     for (t = s, i = 0;
 	 (c = *t) && ((c != Outbrack &&
 		       (ishash || c != ',')) || i); t++) {
-	/* Untokenize INULL() except before brackets and double-quotes */
-	if (INULL(c)) {
+	/* Untokenize inull() except before brackets and double-quotes */
+	if (inull(c)) {
 	    c = t[1];
 	    if (c == '[' || c == ']' ||
 		c == '(' || c == ')' ||
@@ -1070,7 +1070,7 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w)
 	return 0;
     s = dupstrpfx(s, t - s);
     *str = tt = t;
-    /* If we're NOT reverse subscripting, strip the INULL()s so brackets *
+    /* If we're NOT reverse subscripting, strip the inull()s so brackets *
      * are not backslashed after parsestr().  Otherwise leave them alone *
      * so that the brackets will be escaped when we patcompile() or when *
      * subscript arithmetic is performed (for nested subscripts).        */
@@ -1305,11 +1305,11 @@ getindex(char **pptr, Value v, int dq)
 
     *s++ = '[';
     s = parse_subscript(s, dq);	/* Error handled after untokenizing */
-    /* Now we untokenize everything except INULL() markers so we can check *
-     * for the '*' and '@' special subscripts.  The INULL()s are removed  *
+    /* Now we untokenize everything except inull() markers so we can check *
+     * for the '*' and '@' special subscripts.  The inull()s are removed  *
      * in getarg() after we know whether we're doing reverse indexing.    */
     for (tbrack = *pptr + 1; *tbrack && tbrack != s; tbrack++) {
-	if (INULL(*tbrack) && !*++tbrack)
+	if (inull(*tbrack) && !*++tbrack)
 	    break;
 	if (itok(*tbrack))	/* Need to check for Nularg here? */
 	    *tbrack = ztokens[*tbrack - Pound];
diff --git a/Src/subst.c b/Src/subst.c
index 67de61418..a10e2ee22 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1406,7 +1406,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 		zerr("bad substitution", NULL, 0);
 		return NULL;
 	    }
-	} else if (inbrace && INULL(*s)) {
+	} else if (inbrace && inull(*s)) {
 	    /*
 	     * Handles things like ${(f)"$(<file)"} by skipping 
 	     * the double quotes.  We don't need to know what was
@@ -1460,7 +1460,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 	 * This tests for the second double quote in an expression
 	 * like ${(f)"$(<file)"}, compare above.
 	 */
-	while (INULL(*s))
+	while (inull(*s))
 	    s++;
 	v = (Value) NULL;
     } else if (aspar) {
@@ -1850,7 +1850,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 	 * we didn't have a subexpression, e.g. ${"foo"}.
 	 * This form is pointless, but logically it ought to work.
 	 */
-	while (INULL(*s))
+	while (inull(*s))
 	    s++;
     }
     /*
@@ -2846,11 +2846,11 @@ modify(char **str, char **ptr)
 		}
 		zsfree(hsubr);
 		for (tt = hsubl; *tt; tt++)
-		    if (INULL(*tt) && *tt != Bnullkeep)
+		    if (inull(*tt) && *tt != Bnullkeep)
 			chuck(tt--);
 		untokenize(hsubl);
 		for (tt = hsubr = ztrdup(ptr2); *tt; tt++)
-		    if (INULL(*tt) && *tt != Bnullkeep)
+		    if (inull(*tt) && *tt != Bnullkeep)
 			chuck(tt--);
 		ptr2[-1] = del;
 		if (sav)
diff --git a/Src/utils.c b/Src/utils.c
index 838846910..3394b0526 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2562,8 +2562,10 @@ inittyptab(void)
     typtab['\0'] |= IMETA;
     typtab[STOUC(Meta)  ] |= IMETA;
     typtab[STOUC(Marker)] |= IMETA;
-    for (t0 = (int)STOUC(Pound); t0 <= (int)STOUC(Nularg); t0++)
+    for (t0 = (int)STOUC(Pound); t0 <= (int)STOUC(Comma); t0++)
 	typtab[t0] |= ITOK | IMETA;
+    for (t0 = (int)STOUC(Snull); t0 <= (int)STOUC(Nularg); t0++)
+	typtab[t0] |= ITOK | IMETA | INULL;
     for (s = ifs ? ifs : DEFAULT_IFS; *s; s++) {
 	if (inblank(*s)) {
 	    if (s[1] == *s)
diff --git a/Src/zsh.h b/Src/zsh.h
index 3db3aa3d4..8fea197f7 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -163,8 +163,6 @@ struct mathfunc {
  */
 #define Nularg		((char) 0x9c)
 
-#define INULL(x)	((x) >= Snull && (x) <= Nularg)
-
 /*
  * Take care to update the use of IMETA appropriately when adding
  * tokens here.
diff --git a/Src/ztype.h b/Src/ztype.h
index 595ff0588..2732682a2 100644
--- a/Src/ztype.h
+++ b/Src/ztype.h
@@ -41,6 +41,7 @@
 #define ISPECIAL (1 << 11)
 #define IMETA    (1 << 12)
 #define IWSEP    (1 << 13)
+#define INULL    (1 << 14)
 #define _icom(X,Y) (typtab[STOUC(X)] & Y)
 #define idigit(X) _icom(X,IDIGIT)
 #define ialnum(X) _icom(X,IALNUM)
@@ -56,3 +57,4 @@
 #define ispecial(X) _icom(X,ISPECIAL)
 #define imeta(X) _icom(X,IMETA)
 #define iwsep(X) _icom(X,IWSEP)
+#define inull(X) _icom(X,INULL)