* path.cc (special_name): Reorganize to always detect the use of special names

first, before detecting special characters.
This commit is contained in:
Christopher Faylor 2005-03-06 20:15:07 +00:00
parent 5f8e4efa67
commit a50b6b2dcd
2 changed files with 16 additions and 14 deletions

View File

@ -1,3 +1,8 @@
2005-03-06 Christopher Faylor <cgf@timesys.com>
* path.cc (special_name): Reorganize to always detect the use of
special names first, before detecting special characters.
2005-03-04 Christopher Faylor <cgf@timesys.com>
* fhandler_clipboard.cc: Use int for cygnativeformat rather than UINT

View File

@ -1255,29 +1255,26 @@ special_name (const char *s, int inc = 1)
return false;
s += inc;
if (strpbrk (s, special_chars))
return !strncasematch (s, "%2f", 3);
if (strcasematch (s, ".") || strcasematch (s, ".."))
if (strcmp (s, ".") == 0 || strcmp (s, "..") == 0)
return false;
if (s[strlen (s)-1] == '.')
return true;
const char *p;
if (strcasematch (s, "conin$") || strcasematch (s, "conout$"))
return -1;
if (strncasematch (s, "nul", 3)
int n;
const char *p = NULL;
if (strncasematch (s, "conin$", n = 5)
|| strncasematch (s, "conout$", n = 7)
|| strncasematch (s, "nul", n = 3)
|| strncasematch (s, "aux", 3)
|| strncasematch (s, "prn", 3)
|| strncasematch (s, "con", 3))
p = s + 3;
p = s + n;
else if (strncasematch (s, "com", 3) || strncasematch (s, "lpt", 3))
(void) strtoul (s + 3, (char **) &p, 10);
else
return false;
if (p && (*p == '\0' || *p == '.'))
return -1;
return (*p == '\0' || *p == '.') ? -1 : false;
return (strchr (s, '\0')[-1] == '.')
|| (strpbrk (s, special_chars) && !strncasematch (s, "%2f", 3));
}
bool