From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15062 invoked from network); 9 Mar 1999 10:34:34 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 9 Mar 1999 10:34:34 -0000 Received: (qmail 2761 invoked by alias); 9 Mar 1999 10:33:26 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5699 Received: (qmail 2751 invoked from network); 9 Mar 1999 10:33:21 -0000 Date: Tue, 9 Mar 1999 11:32:33 +0100 (MET) Message-Id: <199903091032.LAA13868@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Andrej Borsenkow"'s message of Tue, 9 Mar 1999 11:12:37 +0300 Subject: PATCH: (was Re: _configure does not work) Andrej Borsenkow wrote: > (patches up to and including 5962) > > bor@itsrm2:~%> zsh -f > itsrm2% cd /tools/src > itsrm2% cd zsh-3.1.5-pws-11 > itsrm2% fpath=($PWD/Completion/*(/)) > itsrm2% source Completion/Core/compinit > itsrm2% ./configure --prefix=/t > B-e-e-p The reason for this was that `_configure' didn't give a pattern and action for things like `=PREFIX'. That's why I said I would like to know about more patterns that should be used in the functions using `_long_options'. > itsrm2% ./configure --e-d > itsrm2% ./configure > (the whole stuff deleted) > > I'd thought, it completed to at least --enable-dynamic before. I think it didn't, I think it generated a list containing `--enable-dynamic', `--enable-zsh-debug' and others. This was wrong in the matching code in zle_tricky.c. Ok, the patch below changes zle_tricky.c to match only a sub-string up to a partial-word-separator for each such match spec and it changes `_configure' to accept some more patterns. Bye Sven diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c --- os/Zle/zle_tricky.c Mon Mar 8 10:23:41 1999 +++ Src/Zle/zle_tricky.c Tue Mar 9 11:00:03 1999 @@ -3453,11 +3453,20 @@ * characters are matched by the `*' pattern. * We do this by looping over the string * and calling this function recursively. */ - int i = 0, j = iw, k = lw; + int i = 0, j = iw, k = lw, m = 0; int jj = il + mp->llen, kk = ll - mp->llen; char *p = l + mp->llen, *q = w; for (; k; i++, j++, k--, q++) { + if ((mp->flags & CMF_RIGHT) && + (mp->right && k >= mp->ralen && + pattern_match(mp->right, q, + NULL, NULL))) { + if (m++) { + k = 0; + break; + } + } if (match_pfx(p, q, NULL, NULL, NULL, NULL)) break; } @@ -3679,13 +3688,23 @@ !pattern_match(mp->left, w - mp->lalen, NULL, NULL)); if (t) { - int i = 0, j = iw, k = lw; + int i = 0, j = iw, k = lw, m = 0; int jj = il + mp->llen, kk = ll - mp->llen; char *p = l - mp->llen - 1, *q = w - 1; - for (; k; i++, j++, k--, q--) + for (; k; i++, j++, k--, q--) { + if ((mp->flags & CMF_LEFT) && + (mp->left && k >= mp->lalen && + pattern_match(mp->left, q - mp->lalen, + NULL, NULL))) { + if (m++) { + k = 0; + break; + } + } if (match_pfx(p, q, NULL, NULL, NULL, NULL)) break; + } if (k && i) { if (nlp) { nw = addtoword(&rw, &rwlen, nw, mp, @@ -4195,7 +4214,6 @@ t = s; if (ppre) t = dyncat(ppre, t); - lc = NULL; if (!cp && !ms && (mstack || psuf)) { int bl = ((aflags & CAF_MATCH) ? llpl : 0); Cline *clp = &lc, tlc; diff -u oc/User/_configure Completion/User/_configure --- oc/User/_configure Mon Mar 8 11:05:13 1999 +++ Completion/User/_configure Tue Mar 9 11:02:02 1999 @@ -1,3 +1,4 @@ #defcomp configure -_long_options +_long_options '*=(E|)PREFIX*' '_files -/' \ + '*=PROGRAM*' '_command_names' -- Sven Wischnowsky wischnow@informatik.hu-berlin.de