From 3c37057c34d975ada2e9e6590845732677e77104 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 13 Oct 2005 16:30:13 +0000 Subject: 21871: replace INULL() by inull() --- ChangeLog | 7 ++++++- Src/Zle/compcore.c | 2 +- Src/Zle/compctl.c | 2 +- Src/Zle/zle_tricky.c | 6 +++--- Src/exec.c | 2 +- Src/glob.c | 4 ++-- Src/params.c | 12 ++++++------ Src/subst.c | 10 +++++----- Src/utils.c | 4 +++- Src/zsh.h | 2 -- Src/ztype.h | 2 ++ 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 - * 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)"$(= 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) -- cgit 1.4.1