Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 2/4] internal: Document bin_compadd().
- X-seq: zsh-workers 39803
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 2/4] internal: Document bin_compadd().
- Date: Tue, 1 Nov 2016 17:26:09 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=A6QE5YsNI8GPQ8SxApyzPET1GJE=; b=vNpJOP Hkt0AjvPY4iHsECN5SU8RPcKPLuIr9l4fkR+1J6hKK1y8FEF0jKyfIS1J3kWEeVD LCfsx4dWFR2TGr9uu/yKPSv+7Y1CP4DQyH3pk2i4LPmHNLn6Mi1ga8Iu030V8uMM jzd4cFDimUm10eYW0S7GnQeYlMOv04rc5weSA=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=smtpout; bh=A6QE5YsNI8GPQ8SxApyzPET1GJE=; b=htYSE qHAmFsA1CK0F46OBXmqajcX0HPYFvU8EaS3fNh4Jvi9mfvmLnYwYqq8jqAXuz8vt G+27PmBEY0qDH3Tg2nksptJpr0i7wYLXrpBd/WV3IuyCYXWn9Af66H/uo2TjP60v vKlUCrpiM6NXwdsYo2FKGSH2UVeL82l0Gbfzgw=
- In-reply-to: <1478021171-22495-1-git-send-email-danielsh@fujitsu.shahaf.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1478021171-22495-1-git-send-email-danielsh@fujitsu.shahaf.local2>
---
Src/Zle/complete.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index 7361934..484754b 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -555,8 +555,8 @@ static int
bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
{
struct cadata dat;
- char *p, **sp, *e, *m = NULL, *mstr = NULL;
- int dm;
+ char *mstr = NULL; /* argument of -M options, accumulated */
+ int added; /* return value */
Cmatcher match = NULL;
if (incompfunc != 1) {
@@ -572,14 +572,16 @@ bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
dat.dummies = -1;
for (; *argv && **argv == '-'; argv++) {
+ char *p; /* loop variable, points into argv */
if (!(*argv)[1]) {
argv++;
break;
}
for (p = *argv + 1; *p; p++) {
- sp = NULL;
- e = NULL;
- dm = 0;
+ char *m = NULL; /* argument of -M option (this one only) */
+ char **sp = NULL; /* the argument to an option should be copied
+ to *sp. */
+ const char *e; /* error message */
switch (*p) {
case 'q':
dat.flags |= CMF_REMOVE;
@@ -661,7 +663,6 @@ bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
case 'M':
sp = &m;
e = "matching specification expected after -%c";
- dm = 1;
break;
case 'X':
sp = &(dat.exp);
@@ -748,14 +749,13 @@ bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
zsfree(mstr);
return 1;
}
- if (dm) {
+ if (m) {
if (mstr) {
char *tmp = tricat(mstr, " ", m);
zsfree(mstr);
mstr = tmp;
} else
mstr = ztrdup(m);
- m = NULL;
}
}
}
@@ -774,10 +774,10 @@ bin_compadd(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
return 1;
dat.match = match = cpcmatcher(match);
- dm = addmatches(&dat, argv);
+ added = addmatches(&dat, argv);
freecmatcher(match);
- return dm;
+ return added;
}
#define CVT_RANGENUM 0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author