aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2004-03-25 15:15:27 +0000
committerChristopher Faylor <me@cgf.cx>2004-03-25 15:15:27 +0000
commit474048c26edf5ad4fa269ab1801bf4994bf95083 (patch)
tree981ea5d735294c489fcd7b6edf4bf7a4317f65c2 /winsup/cygwin/path.cc
parent3ca0d9b61344f0112d218af4f0f3833ba33a41ee (diff)
downloadnewlib-474048c26edf5ad4fa269ab1801bf4994bf95083.zip
newlib-474048c26edf5ad4fa269ab1801bf4994bf95083.tar.gz
newlib-474048c26edf5ad4fa269ab1801bf4994bf95083.tar.bz2
* path.cc (normalize_posix_path): Reorganize to short circuit to DOS path
handling whenever a '\' is detected. * signal.cc (sigaction): Make strace output more informative. * sigproc.cc (pending_signals::add): Just index directly into signal array rather than treating the array as a heap. (pending_signals::del): Ditto. (wait_sig): Don't send signal if we already have a similar signal queued. * sigproc.h (call_signal_handler_now): Remove obsolete declaration.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index e602c5e..96fa062 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -188,7 +188,6 @@ pathmatch (const char *path1, const char *path2)
#define isslash(c) ((c) == '/')
/* Normalize a POSIX path.
- \'s are converted to /'s in the process.
All duplicate /'s, except for 2 leading /'s, are deleted.
The result is 0 for success, or an errno error value. */
@@ -200,14 +199,11 @@ normalize_posix_path (const char *src, char *dst)
syscall_printf ("src %s", src);
+ const char *in_src = src;
+ char *in_dst = dst;
+
if (isdrive (src) || slash_unc_prefix_p (src))
- {
- int err = normalize_win32_path (src, dst);
- if (!err)
- for (char *p = dst; (p = strchr (p, '\\')); p++)
- *p = '/';
- return err;
- }
+ goto win32_path;
if (!isslash (src[0]))
{
@@ -247,6 +243,8 @@ normalize_posix_path (const char *src, char *dst)
while (*src)
{
+ if (*src == '\\')
+ goto win32_path;
/* Strip runs of /'s. */
if (!isslash (*src))
*dst++ = *src++;
@@ -309,6 +307,13 @@ done:
debug_printf ("%s = normalize_posix_path (%s)", dst_start, src_start);
return 0;
+
+win32_path:
+ int err = normalize_win32_path (in_src, in_dst);
+ if (!err)
+ for (char *p = in_dst; (p = strchr (p, '\\')); p++)
+ *p = '/';
+ return err;
}
inline void