mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-09-28 15:01:21 +02:00
22660: unmetafy directory for opendir() etc. in compctl
This commit is contained in:
parent
6c887892f9
commit
7b927aeac7
@ -26,6 +26,11 @@
|
||||
Functions/Prompts/prompt_zefram_setup: broken when KSH_ARRAYS
|
||||
is on.
|
||||
|
||||
2006-08-30 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 22660 [slightly tweaked]: Src/Zle/compctl.c: unmetafy
|
||||
directory prefix for passing to opendir() and stat().
|
||||
|
||||
2006-08-22 Clint Adams <clint@zsh.org>
|
||||
|
||||
* 22657: Completion/Unix/Command/_tla: update for tla 1.3.5.
|
||||
|
@ -2127,9 +2127,9 @@ gen_matches_files(int dirs, int execs, int all)
|
||||
{
|
||||
DIR *d;
|
||||
struct stat buf;
|
||||
char *n, p[PATH_MAX], *q = NULL, *e;
|
||||
char *n, p[PATH_MAX], *q = NULL, *e, *pathpref;
|
||||
LinkList l = NULL;
|
||||
int ns = 0, ng = opts[NULLGLOB], test, aw = addwhat;
|
||||
int ns = 0, ng = opts[NULLGLOB], test, aw = addwhat, pathpreflen;
|
||||
|
||||
opts[NULLGLOB] = 1;
|
||||
|
||||
@ -2145,12 +2145,22 @@ gen_matches_files(int dirs, int execs, int all)
|
||||
all = execs = 0;
|
||||
}
|
||||
/* Open directory. */
|
||||
if ((d = opendir((prpre && *prpre) ? prpre : "."))) {
|
||||
if (prpre && *prpre) {
|
||||
pathpref = dupstring(prpre);
|
||||
unmetafy(pathpref, &pathpreflen);
|
||||
/* system needs NULL termination, not provided by unmetafy */
|
||||
pathpref[pathpreflen] = '\0';
|
||||
} else {
|
||||
pathpref = NULL;
|
||||
pathpreflen = 0;
|
||||
}
|
||||
if ((d = opendir(pathpref ? pathpref : "."))) {
|
||||
/* If we search only special files, prepare a path buffer for stat. */
|
||||
if (!all && prpre) {
|
||||
strcpy(p, prpre);
|
||||
q = p + strlen(prpre);
|
||||
if (!all && pathpreflen) {
|
||||
/* include null byte we carefully added */
|
||||
memcpy(p, pathpref, pathpreflen+1);
|
||||
}
|
||||
q = p + pathpreflen;
|
||||
/* Fine, now read the directory. */
|
||||
while ((n = zreaddir(d, 1)) && !errflag) {
|
||||
/* Ignore files beginning with `.' unless the thing we found on *
|
||||
|
Loading…
Reference in New Issue
Block a user