Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-03-06 23:15:07 +0300
committerChristopher Faylor <me@cgf.cx>2005-03-06 23:15:07 +0300
commita50b6b2dcd76cfb494617c37f93ebed175d60560 (patch)
tree5c076baf9e0ebcd75f44ee6387ce875949112406
parent5f8e4efa678ccb7b699a04f980b2a60e776c90da (diff)
* path.cc (special_name): Reorganize to always detect the use of special names
first, before detecting special characters.
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/path.cc25
2 files changed, 16 insertions, 14 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 7c5d314ff..a36dfb898 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 10a174838..6d4228d63 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -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