1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-07 09:21:18 +02:00

users/14732: Test X:/ rather than X: in Cygwin

This commit is contained in:
Peter Stephenson 2010-01-22 20:42:09 +00:00
parent f0287c6e17
commit ec46ff026e
2 changed files with 40 additions and 10 deletions

View file

@ -1,3 +1,8 @@
2010-01-22 Peter Stephenson <p.w.stephenson@ntlworld.com>
* users/14732: Src/Zle/computil.c: we need to test X:/ rather
than X: for recent versions of Cygwin.
2010-01-21 Peter Stephenson <pws@csr.com> 2010-01-21 Peter Stephenson <pws@csr.com>
* users/14723: Src/pattern.c: invalid character conversions * users/14723: Src/pattern.c: invalid character conversions
@ -12623,5 +12628,5 @@
***************************************************** *****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL * This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.4870 $ * $Revision: 1.4871 $
***************************************************** *****************************************************

View file

@ -4050,19 +4050,44 @@ cfp_test_exact(LinkList names, char **accept, char *skipped)
for (node = firstnode(names); node; incnode(node)) { for (node = firstnode(names); node; incnode(node)) {
l = strlen(p = (char *) getdata(node)); l = strlen(p = (char *) getdata(node));
if (l + sl < PATH_MAX2) { if (l + sl < PATH_MAX2) {
#ifdef __CYGWIN__
char *testbuf;
#define TESTBUF testbuf
#else
#define TESTBUF buf
#endif
strcpy(buf, p); strcpy(buf, p);
strcpy(buf + l, suf); strcpy(buf + l, suf);
#ifdef __CYGWIN__ #ifdef __CYGWIN__
/* if (accept_off) {
* If accept-exact is not set, accept this only if int sl = strlen(buf);
* it looks like a special file such as a drive. /*
* We still test if it exists. * If accept-exact is not set, accept this only if
*/ * it looks like a special file such as a drive.
if (accept_off && * We still test if it exists.
(strchr(buf, '/') || buf[strlen(buf)-1] != ':')) */
continue; if (!sl || strchr(buf, '/') || buf[sl-1] != ':')
continue;
if (sl == 2) {
/*
* Recent versions of Cygwin only recognise "c:/",
* but not "c:", as special directories. So
* we have to append the slash for the purpose of
* the test.
*/
testbuf = zhalloc(sl + 2);
strcpy(testbuf, buf);
testbuf[sl] = '/';
testbuf[sl+1] = '\0';
} else {
/* Don't do this with stuff like PRN: */
testbuf = buf;
}
} else {
testbuf = buf;
}
#endif #endif
if (!ztat(buf, &st, 0)) { if (!ztat(TESTBUF, &st, 0)) {
/* /*
* File exists; if accept-exact contained non-boolean * File exists; if accept-exact contained non-boolean
* values it must match those, too. * values it must match those, too.