diff options
author | Christopher Faylor <me@cgf.cx> | 2001-11-21 09:47:57 +0300 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-11-21 09:47:57 +0300 |
commit | 7903ee6955c3add49c2aa341ac1fd15adce1025e (patch) | |
tree | 39f70e3c053f8440791daf24e80987148cd037bd /winsup/cygwin/path.cc | |
parent | f6a6c2a358f81a8d7c550bdcba2990c16c0d54ef (diff) |
* Makefile.in (DLL_OFILES): Add fhandler_disk_file.o.
* cygheap.h (cygheap_fdnew::operator =): New operator.
* dir.cc: Add invalid struct checking throughout. Use methods for all
directory manipulation throughout.
* fhandler.cc: Move fhandler_disk_file stuff to own file.
(fhandler_base::opendir): New method.
(fhandler_base::readdir): New method.
(fhandler_base::telldir): New method.
(fhandler_base::seekdir): New method.
(fhandler_base::rewinddir): New method.
(fhandler_base::closedir): New method.
* fhandler_disk_file.cc: New file.
* fhandler.h (fhandler_base): Declare new virtual methods.
(fhandler_disk_file): Ditto.
(fhandler_cygdrive): New class.
* path.cc (conv_path_list): Use strccpy to break apart path.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r-- | winsup/cygwin/path.cc | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index f724a47e6..840558269 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -1234,31 +1234,24 @@ conv_path_list (const char *src, char *dst, int to_posix_p) int (*conv_fn) (const char *, char *) = (to_posix_p ? cygwin_conv_to_posix_path : cygwin_conv_to_win32_path); - char srcbuf[MAX_PATH]; - int len; + + char *srcbuf = (char *) alloca (strlen (src) + 1); do { - s = strchr (src, src_delim); - if (s) + s = strccpy (srcbuf, &src, src_delim); + int len = s - srcbuf; + if (len >= MAX_PATH) + srcbuf[MAX_PATH - 1] = '\0'; + (*conv_fn) (len ? srcbuf : ".", d); + src += len; + if (*src) { - len = s - src; - if (len >= MAX_PATH) - len = MAX_PATH - 1; - memcpy (srcbuf, src, len); - srcbuf[len] = 0; - (*conv_fn) (len ? srcbuf : ".", d); - d += strlen (d); + d = strchr (d, '\0'); *d++ = dst_delim; - src = s + 1; - } - else - { - /* Last one. */ - (*conv_fn) (src[0] != 0 ? src : ".", d); } } - while (s != NULL); + while (*src++); } /* init: Initialize the mount table. */ |