From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: PATCH: (#?) glob with empty path segment
Date: Tue, 13 Apr 1999 14:12:05 +0200 [thread overview]
Message-ID: <9904131212.AA32642@ibmth.df.unipi.it> (raw)
This should fix the problem that things like /lib/(#l)l*/ didn't work. It
was trying to match the empty path segment at the end by a pattern match.
--- Src/glob.c.cstr Wed Mar 24 10:20:10 1999
+++ Src/glob.c Tue Apr 13 14:06:14 1999
@@ -397,6 +397,7 @@
int pbcwdsav = pathbufcwd;
int errssofar = errsfound;
struct dirsav ds;
+ char *str;
ds.ino = ds.dev = 0;
ds.dirname = NULL;
@@ -412,17 +413,18 @@
scanner(q->next);
}
c = q->comp;
+ str = c->str;
/* Now the actual matching for the current path section. */
- if (!(c->next || c->left) && !haswilds(c->str)
+ if (!(c->next || c->left) && !haswilds(str)
&& (!((c->stat & (C_LCMATCHUC|C_IGNCASE)) || c->errsmax)
- || !strcmp(".", c->str) || !strcmp("..", c->str))) {
+ || !*str || !strcmp(".", str) || !strcmp("..", str))) {
/*
* We always need to match . and .. explicitly, even if we're
* checking other strings for case-insensitive matches.
*
* It's a straight string to the end of the path section.
*/
- int l = strlen(c->str);
+ int l = strlen(str);
if (l + !l + pathpos - pathbufcwd >= PATH_MAX) {
int err;
@@ -442,14 +444,14 @@
/* Not the last path section. Just add it to the path. */
int oppos = pathpos;
- if (!errflag && !(q->closure && !strcmp(c->str, "."))) {
- addpath(c->str);
+ if (!errflag && !(q->closure && !strcmp(str, "."))) {
+ addpath(str);
if (!closure || statfullpath("", NULL, 1))
scanner((q->closure) ? q : q->next);
pathbuf[pathpos = oppos] = '\0';
}
} else
- insert(c->str, 0);
+ insert(str, 0);
} else {
/* Do pattern matching on current path section. */
char *fn = pathbuf[pathbufcwd] ? unmeta(pathbuf + pathbufcwd) : ".";
--
Peter Stephenson <pws@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
reply other threads:[~1999-04-13 12:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9904131212.AA32642@ibmth.df.unipi.it \
--to=pws@ibmth.df.unipi.it \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).