* environ.cc (env_win32_to_posix_path_list): Declare.

(conv_envvars): Use env_win32_to_posix_path_list rather than
cygwin_win32_to_posix_path_list.
(posify): Translate back to win32 path if errno is EIDRM.
* environ.h: Update copyright.  Define ENV_CVT.
* path.cc (conv_path_list): If converting for the environment and removed an
element set errno to ENV_CVT.
(env_win32_to_posix_path_list): New function.
This commit is contained in:
Christopher Faylor
2006-08-02 15:11:48 +00:00
parent 2dba45f4aa
commit 6f1d48621e
4 changed files with 44 additions and 5 deletions

View File

@@ -75,6 +75,7 @@ details. */
#include "shared_info.h"
#include "registry.h"
#include "cygtls.h"
#include "environ.h"
#include <assert.h>
bool dos_file_warning = true;
@@ -1329,6 +1330,7 @@ conv_path_list (const char *src, char *dst, int to_posix)
int err = 0;
char *d = dst - 1;
bool saw_empty = false;
do
{
char *s = strccpy (srcbuf, &src, src_delim);
@@ -1343,7 +1345,11 @@ conv_path_list (const char *src, char *dst, int to_posix)
else if (!to_posix)
err = conv_fn (".", ++d);
else
continue;
{
if (to_posix == ENV_CVT)
saw_empty = true;
continue;
}
if (err)
break;
d = strchr (d, '\0');
@@ -1351,6 +1357,9 @@ conv_path_list (const char *src, char *dst, int to_posix)
}
while (*src++);
if (saw_empty)
err = EIDRM;
if (d < dst)
d++;
*d = '\0';
@@ -3885,6 +3894,12 @@ cygwin_posix_to_win32_path_list_buf_size (const char *path_list)
return conv_path_list_buf_size (path_list, false);
}
extern "C" int
env_win32_to_posix_path_list (const char *win32, char *posix)
{
return_with_errno (conv_path_list (win32, posix, ENV_CVT));
}
extern "C" int
cygwin_win32_to_posix_path_list (const char *win32, char *posix)
{