Allow cygwin_conv_path(3) and cygpath(1) to emit /proc/cygdrive prefixed path
* include/sys/cygwin.h (CCP_PROC_CYGDRIVE): New flag. * mount.cc (mount_info::cygdrive_posix_path): Take flag values rather than just a trailing_slash_p bool. Emit /proc/cygdrive path if CCP_PROC_CYGDRIVE flag is given. (mount_info::conv_to_posix_path): Take flag values rather than just a keep_rel_p bool. Rename _p variables. Print flag value as hex in debug_printf. Call cygdrive_posix_path with flag values. * mount.h (mount_info::cygdrive_posix_path): Accommodate above change in declaration. (mount_info::conv_to_posix_path): Ditto. * fhandler_process.cc (format_process_exename): Accommodate change to mount_info::conv_to_posix_path. * path.cc (cygwin_conv_path): Ditto. * cygpath.cc (absolute_flag): Initialize to CCP_RELATIVE to simplify expressions. (cygdrive_flag): New global flag. (long_options): Add --proc-cygdrive option. (options): Add -U option. (usage): Add description for -U option. (do_sysfolders): Or cygdrive_flag to cygwin_conv_path call. (do_pathconv): Simply or absolute_flag to conv_func. Or cygdrive_flag to conv_func. (do_options): Initalize absolute_flag to CCP_RELATIVE. Initialize new cygdrive_flag. Set absolute_flag to CCP_ABSOLUTE on -a. Set cygdrive_flag to CCP_PROC_CYGDRIVE on -U. * new-features.xml (ov-new2.4): Document cygpath -U option. * utils.xml (cygpath): Ditto. * path.xml (func-cygwin-path): Add CCP_PROC_CYGDRIVE description. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
3ff65caea5
commit
5aa8817e3a
|
@ -1,3 +1,19 @@
|
||||||
|
2015-12-06 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* include/sys/cygwin.h (CCP_PROC_CYGDRIVE): New flag.
|
||||||
|
* mount.cc (mount_info::cygdrive_posix_path): Take flag values rather
|
||||||
|
than just a trailing_slash_p bool. Emit /proc/cygdrive path if
|
||||||
|
CCP_PROC_CYGDRIVE flag is given.
|
||||||
|
(mount_info::conv_to_posix_path): Take flag values rather than just
|
||||||
|
a keep_rel_p bool. Rename _p variables. Print flag value as hex in
|
||||||
|
debug_printf. Call cygdrive_posix_path with flag values.
|
||||||
|
* mount.h (mount_info::cygdrive_posix_path): Accommodate above change
|
||||||
|
in declaration.
|
||||||
|
(mount_info::conv_to_posix_path): Ditto.
|
||||||
|
* fhandler_process.cc (format_process_exename): Accommodate change to
|
||||||
|
mount_info::conv_to_posix_path.
|
||||||
|
* path.cc (cygwin_conv_path): Ditto.
|
||||||
|
|
||||||
2015-12-03 Corinna Vinschen <corinna@vinschen.de>
|
2015-12-03 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* dcrt0.cc (dll_crt0_0): On 64 bit, set wow64_needs_stack_adjustment
|
* dcrt0.cc (dll_crt0_0): On 64 bit, set wow64_needs_stack_adjustment
|
||||||
|
|
|
@ -540,7 +540,7 @@ format_process_exename (void *data, char *&destbuf)
|
||||||
stpcpy (buf, "<defunct>");
|
stpcpy (buf, "<defunct>");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mount_table->conv_to_posix_path (p->progname, buf, 1);
|
mount_table->conv_to_posix_path (p->progname, buf, CCP_RELATIVE);
|
||||||
len = strlen (buf);
|
len = strlen (buf);
|
||||||
if (len > 4)
|
if (len > 4)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/* sys/cygwin.h
|
/* sys/cygwin.h
|
||||||
|
|
||||||
Copyright 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
|
Copyright 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
|
||||||
2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
|
2009, 2010, 2011, 2012, 2013, 2014, 2015 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
@ -57,8 +57,10 @@ enum
|
||||||
CCP_CONVTYPE_MASK = 3,
|
CCP_CONVTYPE_MASK = 3,
|
||||||
|
|
||||||
/* Or these values to the above as needed. */
|
/* Or these values to the above as needed. */
|
||||||
CCP_ABSOLUTE = 0, /* Request absolute path (default). */
|
CCP_ABSOLUTE = 0, /* Request absolute path (default). */
|
||||||
CCP_RELATIVE = 0x100 /* Request to keep path relative. */
|
CCP_RELATIVE = 0x100, /* Request to keep path relative. */
|
||||||
|
CCP_PROC_CYGDRIVE = 0x200 /* Request to return /proc/cygdrive
|
||||||
|
path (only with CCP_*_TO_POSIX). */
|
||||||
};
|
};
|
||||||
typedef unsigned int cygwin_conv_path_t;
|
typedef unsigned int cygwin_conv_path_t;
|
||||||
|
|
||||||
|
|
|
@ -791,14 +791,28 @@ mount_info::get_mounts_here (const char *parent_dir, int parent_dir_len,
|
||||||
|
|
||||||
/* cygdrive_posix_path: Build POSIX path used as the
|
/* cygdrive_posix_path: Build POSIX path used as the
|
||||||
mount point for cygdrives created when there is no other way to
|
mount point for cygdrives created when there is no other way to
|
||||||
obtain a POSIX path from a Win32 one. */
|
obtain a POSIX path from a Win32 one.
|
||||||
|
|
||||||
|
Recognized flag values:
|
||||||
|
- 0x001: Add trailing slash.
|
||||||
|
- 0x200 == CCP_PROC_CYGDRIVE: Return /proc/cygdrive rather than actual
|
||||||
|
cygdrive prefix. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mount_info::cygdrive_posix_path (const char *src, char *dst, int trailing_slash_p)
|
mount_info::cygdrive_posix_path (const char *src, char *dst, int flags)
|
||||||
{
|
{
|
||||||
int len = cygdrive_len;
|
int len;
|
||||||
|
|
||||||
memcpy (dst, cygdrive, len + 1);
|
if (flags & CCP_PROC_CYGDRIVE)
|
||||||
|
{
|
||||||
|
len = sizeof ("/proc/cygdrive/") - 1;
|
||||||
|
memcpy (dst, "/proc/cygdrive/", len + 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
len = cygdrive_len;
|
||||||
|
memcpy (dst, cygdrive, len + 1);
|
||||||
|
}
|
||||||
|
|
||||||
/* Now finish the path off with the drive letter to be used.
|
/* Now finish the path off with the drive letter to be used.
|
||||||
The cygdrive prefix always ends with a trailing slash so
|
The cygdrive prefix always ends with a trailing slash so
|
||||||
|
@ -816,7 +830,7 @@ mount_info::cygdrive_posix_path (const char *src, char *dst, int trailing_slash_
|
||||||
n = 2;
|
n = 2;
|
||||||
strcpy (dst + len, src + n);
|
strcpy (dst + len, src + n);
|
||||||
}
|
}
|
||||||
slashify (dst, dst, trailing_slash_p);
|
slashify (dst, dst, !!(flags & 0x1));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -855,7 +869,7 @@ mount_info::cygdrive_win32_path (const char *src, char *dst, int& unit)
|
||||||
/* src_path is a wide Win32 path. */
|
/* src_path is a wide Win32 path. */
|
||||||
int
|
int
|
||||||
mount_info::conv_to_posix_path (PWCHAR src_path, char *posix_path,
|
mount_info::conv_to_posix_path (PWCHAR src_path, char *posix_path,
|
||||||
int keep_rel_p)
|
int ccp_flags)
|
||||||
{
|
{
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
if (!wcsncmp (src_path, L"\\\\?\\", 4))
|
if (!wcsncmp (src_path, L"\\\\?\\", 4))
|
||||||
|
@ -870,7 +884,7 @@ mount_info::conv_to_posix_path (PWCHAR src_path, char *posix_path,
|
||||||
tmp_pathbuf tp;
|
tmp_pathbuf tp;
|
||||||
char *buf = tp.c_get ();
|
char *buf = tp.c_get ();
|
||||||
sys_wcstombs (buf, NT_MAX_PATH, src_path);
|
sys_wcstombs (buf, NT_MAX_PATH, src_path);
|
||||||
int ret = conv_to_posix_path (buf, posix_path, keep_rel_p);
|
int ret = conv_to_posix_path (buf, posix_path, ccp_flags);
|
||||||
if (changed)
|
if (changed)
|
||||||
src_path[0] = L'C';
|
src_path[0] = L'C';
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -878,23 +892,22 @@ mount_info::conv_to_posix_path (PWCHAR src_path, char *posix_path,
|
||||||
|
|
||||||
int
|
int
|
||||||
mount_info::conv_to_posix_path (const char *src_path, char *posix_path,
|
mount_info::conv_to_posix_path (const char *src_path, char *posix_path,
|
||||||
int keep_rel_p)
|
int ccp_flags)
|
||||||
{
|
{
|
||||||
int src_path_len = strlen (src_path);
|
int src_path_len = strlen (src_path);
|
||||||
int relative_path_p = !isabspath (src_path);
|
int relative = !isabspath (src_path);
|
||||||
int trailing_slash_p;
|
int append_slash;
|
||||||
|
|
||||||
if (src_path_len <= 1)
|
if (src_path_len <= 1)
|
||||||
trailing_slash_p = 0;
|
append_slash = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char *lastchar = src_path + src_path_len - 1;
|
const char *lastchar = src_path + src_path_len - 1;
|
||||||
trailing_slash_p = isdirsep (*lastchar) && lastchar[-1] != ':';
|
append_slash = isdirsep (*lastchar) && lastchar[-1] != ':';
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_printf ("conv_to_posix_path (%s, %s, %s)", src_path,
|
debug_printf ("conv_to_posix_path (%s, 0x%x, %s)", src_path, ccp_flags,
|
||||||
keep_rel_p ? "keep-rel" : "no-keep-rel",
|
append_slash ? "add-slash" : "no-add-slash");
|
||||||
trailing_slash_p ? "add-slash" : "no-add-slash");
|
|
||||||
MALLOC_CHECK;
|
MALLOC_CHECK;
|
||||||
|
|
||||||
if (src_path_len >= NT_MAX_PATH)
|
if (src_path_len >= NT_MAX_PATH)
|
||||||
|
@ -906,7 +919,7 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path,
|
||||||
/* FIXME: For now, if the path is relative and it's supposed to stay
|
/* FIXME: For now, if the path is relative and it's supposed to stay
|
||||||
that way, skip mount table processing. */
|
that way, skip mount table processing. */
|
||||||
|
|
||||||
if (keep_rel_p && relative_path_p)
|
if ((ccp_flags & CCP_RELATIVE) && relative)
|
||||||
{
|
{
|
||||||
slashify (src_path, posix_path, 0);
|
slashify (src_path, posix_path, 0);
|
||||||
debug_printf ("%s = conv_to_posix_path (%s)", posix_path, src_path);
|
debug_printf ("%s = conv_to_posix_path (%s)", posix_path, src_path);
|
||||||
|
@ -953,8 +966,9 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path,
|
||||||
strcat (posix_path, "/");
|
strcat (posix_path, "/");
|
||||||
if (nextchar)
|
if (nextchar)
|
||||||
slashify (p,
|
slashify (p,
|
||||||
posix_path + addslash + (mi.posix_pathlen == 1 ? 0 : mi.posix_pathlen),
|
posix_path + addslash + (mi.posix_pathlen == 1
|
||||||
trailing_slash_p);
|
? 0 : mi.posix_pathlen),
|
||||||
|
append_slash);
|
||||||
|
|
||||||
if (cygheap->root.exists ())
|
if (cygheap->root.exists ())
|
||||||
{
|
{
|
||||||
|
@ -972,7 +986,7 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path,
|
||||||
{
|
{
|
||||||
const char *p = pathbuf + cygheap->root.native_length ();
|
const char *p = pathbuf + cygheap->root.native_length ();
|
||||||
if (*p)
|
if (*p)
|
||||||
slashify (p, posix_path, trailing_slash_p);
|
slashify (p, posix_path, append_slash);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
posix_path[0] = '/';
|
posix_path[0] = '/';
|
||||||
|
@ -987,12 +1001,12 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path,
|
||||||
caller must want an absolute path (otherwise we would have returned
|
caller must want an absolute path (otherwise we would have returned
|
||||||
above). So we always return an absolute path at this point. */
|
above). So we always return an absolute path at this point. */
|
||||||
if (isdrive (pathbuf))
|
if (isdrive (pathbuf))
|
||||||
cygdrive_posix_path (pathbuf, posix_path, trailing_slash_p);
|
cygdrive_posix_path (pathbuf, posix_path, append_slash | ccp_flags);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* The use of src_path and not pathbuf here is intentional.
|
/* The use of src_path and not pathbuf here is intentional.
|
||||||
We couldn't translate the path, so just ensure no \'s are present. */
|
We couldn't translate the path, so just ensure no \'s are present. */
|
||||||
slashify (src_path, posix_path, trailing_slash_p);
|
slashify (src_path, posix_path, append_slash);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
|
@ -195,16 +195,15 @@ class mount_info
|
||||||
unsigned set_flags_from_win32_path (const char *path);
|
unsigned set_flags_from_win32_path (const char *path);
|
||||||
int conv_to_win32_path (const char *src_path, char *dst, device&,
|
int conv_to_win32_path (const char *src_path, char *dst, device&,
|
||||||
unsigned *flags = NULL);
|
unsigned *flags = NULL);
|
||||||
int conv_to_posix_path (PWCHAR src_path, char *posix_path,
|
int conv_to_posix_path (PWCHAR src_path, char *posix_path, int ccp_flags);
|
||||||
int keep_rel_p);
|
|
||||||
int conv_to_posix_path (const char *src_path, char *posix_path,
|
int conv_to_posix_path (const char *src_path, char *posix_path,
|
||||||
int keep_rel_p);
|
int ccp_flags);
|
||||||
struct mntent *getmntent (int x);
|
struct mntent *getmntent (int x);
|
||||||
|
|
||||||
int write_cygdrive_info (const char *cygdrive_prefix, unsigned flags);
|
int write_cygdrive_info (const char *cygdrive_prefix, unsigned flags);
|
||||||
int get_cygdrive_info (char *user, char *system, char* user_flags,
|
int get_cygdrive_info (char *user, char *system, char* user_flags,
|
||||||
char* system_flags);
|
char* system_flags);
|
||||||
void cygdrive_posix_path (const char *src, char *dst, int trailing_slash_p);
|
void cygdrive_posix_path (const char *src, char *dst, int flags);
|
||||||
int get_mounts_here (const char *parent_dir, int,
|
int get_mounts_here (const char *parent_dir, int,
|
||||||
PUNICODE_STRING mount_points,
|
PUNICODE_STRING mount_points,
|
||||||
PUNICODE_STRING cygd);
|
PUNICODE_STRING cygd);
|
||||||
|
|
|
@ -3342,7 +3342,7 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
PWCHAR path = NULL;
|
PWCHAR path = NULL;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
bool relative = !!(what & CCP_RELATIVE);
|
int how = what & ~CCP_CONVTYPE_MASK;
|
||||||
what &= CCP_CONVTYPE_MASK;
|
what &= CCP_CONVTYPE_MASK;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
|
@ -3360,7 +3360,8 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
||||||
{
|
{
|
||||||
p.check ((const char *) from,
|
p.check ((const char *) from,
|
||||||
PC_POSIX | PC_SYM_FOLLOW | PC_SYM_NOFOLLOW_REP
|
PC_POSIX | PC_SYM_FOLLOW | PC_SYM_NOFOLLOW_REP
|
||||||
| PC_NO_ACCESS_CHECK | PC_NOWARN | (relative ? PC_NOFULL : 0));
|
| PC_NO_ACCESS_CHECK | PC_NOWARN
|
||||||
|
| ((how & CCP_RELATIVE) ? PC_NOFULL : 0));
|
||||||
if (p.error)
|
if (p.error)
|
||||||
{
|
{
|
||||||
set_errno (p.error);
|
set_errno (p.error);
|
||||||
|
@ -3393,7 +3394,7 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
||||||
backslash ".\\" in the Win32 path. That's a result of the
|
backslash ".\\" in the Win32 path. That's a result of the
|
||||||
conversion in normalize_posix_path. This should not occur
|
conversion in normalize_posix_path. This should not occur
|
||||||
so the below code is just a band-aid. */
|
so the below code is just a band-aid. */
|
||||||
if (relative && !strcmp ((const char *) from, ".")
|
if ((how & CCP_RELATIVE) && !strcmp ((const char *) from, ".")
|
||||||
&& !strcmp (buf, ".\\"))
|
&& !strcmp (buf, ".\\"))
|
||||||
{
|
{
|
||||||
lsiz = 2;
|
lsiz = 2;
|
||||||
|
@ -3404,14 +3405,15 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
||||||
case CCP_POSIX_TO_WIN_W:
|
case CCP_POSIX_TO_WIN_W:
|
||||||
p.check ((const char *) from,
|
p.check ((const char *) from,
|
||||||
PC_POSIX | PC_SYM_FOLLOW | PC_SYM_NOFOLLOW_REP
|
PC_POSIX | PC_SYM_FOLLOW | PC_SYM_NOFOLLOW_REP
|
||||||
| PC_NO_ACCESS_CHECK | PC_NOWARN | (relative ? PC_NOFULL : 0));
|
| PC_NO_ACCESS_CHECK | PC_NOWARN
|
||||||
|
| ((how & CCP_RELATIVE) ? PC_NOFULL : 0));
|
||||||
if (p.error)
|
if (p.error)
|
||||||
{
|
{
|
||||||
set_errno (p.error);
|
set_errno (p.error);
|
||||||
__leave;
|
__leave;
|
||||||
}
|
}
|
||||||
/* Relative Windows paths are always restricted to MAX_PATH chars. */
|
/* Relative Windows paths are always restricted to MAX_PATH chars. */
|
||||||
if (relative && !isabspath (p.get_win32 ())
|
if ((how & CCP_RELATIVE) && !isabspath (p.get_win32 ())
|
||||||
&& sys_mbstowcs (NULL, 0, p.get_win32 ()) > MAX_PATH)
|
&& sys_mbstowcs (NULL, 0, p.get_win32 ()) > MAX_PATH)
|
||||||
{
|
{
|
||||||
/* Recreate as absolute path. */
|
/* Recreate as absolute path. */
|
||||||
|
@ -3455,7 +3457,7 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
||||||
lsiz += ro_u_globalroot.Length / sizeof (WCHAR);
|
lsiz += ro_u_globalroot.Length / sizeof (WCHAR);
|
||||||
}
|
}
|
||||||
/* TODO: Same ".\\" band-aid as in CCP_POSIX_TO_WIN_A case. */
|
/* TODO: Same ".\\" band-aid as in CCP_POSIX_TO_WIN_A case. */
|
||||||
if (relative && !strcmp ((const char *) from, ".")
|
if ((how & CCP_RELATIVE) && !strcmp ((const char *) from, ".")
|
||||||
&& !wcscmp (path, L".\\"))
|
&& !wcscmp (path, L".\\"))
|
||||||
{
|
{
|
||||||
lsiz = 2;
|
lsiz = 2;
|
||||||
|
@ -3466,7 +3468,7 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
||||||
case CCP_WIN_A_TO_POSIX:
|
case CCP_WIN_A_TO_POSIX:
|
||||||
buf = tp.c_get ();
|
buf = tp.c_get ();
|
||||||
error = mount_table->conv_to_posix_path ((const char *) from, buf,
|
error = mount_table->conv_to_posix_path ((const char *) from, buf,
|
||||||
relative);
|
how);
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
set_errno (p.error);
|
set_errno (p.error);
|
||||||
|
@ -3477,7 +3479,7 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
||||||
case CCP_WIN_W_TO_POSIX:
|
case CCP_WIN_W_TO_POSIX:
|
||||||
buf = tp.c_get ();
|
buf = tp.c_get ();
|
||||||
error = mount_table->conv_to_posix_path ((const PWCHAR) from, buf,
|
error = mount_table->conv_to_posix_path ((const PWCHAR) from, buf,
|
||||||
relative);
|
how);
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
set_errno (error);
|
set_errno (error);
|
||||||
|
|
|
@ -22,6 +22,9 @@ What's new:
|
||||||
who created the file. This only works for files and directories
|
who created the file. This only works for files and directories
|
||||||
created by Cygwin processes.
|
created by Cygwin processes.
|
||||||
|
|
||||||
|
- cygpath has a new -U option, which creates cygdrive paths using the
|
||||||
|
unambiguous /proc/cygdrive prefix.
|
||||||
|
|
||||||
- New API: rpmatch.
|
- New API: rpmatch.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
2015-12-06 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* new-features.xml (ov-new2.4): Document cygpath -U option.
|
||||||
|
* utils.xml (cygpath): Ditto.
|
||||||
|
* path.xml (func-cygwin-path): Add CCP_PROC_CYGDRIVE description.
|
||||||
|
|
||||||
2015-11-25 David Macek <david.macek.0@gmail.com>
|
2015-11-25 David Macek <david.macek.0@gmail.com>
|
||||||
|
|
||||||
* faq-using.xml: Add MacType to the BLODA. Fix formatting.
|
* faq-using.xml: Add MacType to the BLODA. Fix formatting.
|
||||||
|
|
|
@ -31,6 +31,11 @@ who created the file. This only works for files and directories
|
||||||
created by Cygwin processes.
|
created by Cygwin processes.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
|
|
||||||
|
<listitem><para>
|
||||||
|
cygpath has a new -U option, which creates cygdrive paths using the
|
||||||
|
unambiguous /proc/cygdrive prefix.
|
||||||
|
</para></listitem>
|
||||||
|
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
New API: rpmatch.
|
New API: rpmatch.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
|
|
|
@ -54,8 +54,10 @@ relative paths in relative notation. Creating absolute paths is the
|
||||||
default.</para>
|
default.</para>
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
CCP_ABSOLUTE = 0, /* Request absolute path (default). */
|
CCP_ABSOLUTE = 0, /* Request absolute path (default). */
|
||||||
CCP_RELATIVE = 0x100 /* Request to keep path relative. */
|
CCP_RELATIVE = 0x100 /* Request to keep path relative. */
|
||||||
|
CCP_PROC_CYGDRIVE = 0x200 /* Request to return /proc/cygdrive path
|
||||||
|
(only with CCP_*_TO_POSIX). */
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
<para><parameter>size</parameter> is the size of the buffer pointed to
|
<para><parameter>size</parameter> is the size of the buffer pointed to
|
||||||
|
|
|
@ -315,6 +315,8 @@ Path conversion options:
|
||||||
-a, --absolute output absolute path
|
-a, --absolute output absolute path
|
||||||
-l, --long-name print Windows long form of NAMEs (with -w, -m only)
|
-l, --long-name print Windows long form of NAMEs (with -w, -m only)
|
||||||
-p, --path NAME is a PATH list (i.e., '/bin:/usr/bin')
|
-p, --path NAME is a PATH list (i.e., '/bin:/usr/bin')
|
||||||
|
-U, --proc-cygdrive Emit /proc/cygdrive path instead of cygdrive prefix
|
||||||
|
when converting Windows path to UNIX path.
|
||||||
-s, --short-name print DOS (short) form of NAMEs (with -w, -m only)
|
-s, --short-name print DOS (short) form of NAMEs (with -w, -m only)
|
||||||
-C, --codepage CP print DOS, Windows, or mixed pathname in Windows
|
-C, --codepage CP print DOS, Windows, or mixed pathname in Windows
|
||||||
codepage CP. CP can be a numeric codepage identifier,
|
codepage CP. CP can be a numeric codepage identifier,
|
||||||
|
@ -380,6 +382,16 @@ Other options:
|
||||||
graphical tools like Windows Explorer might expect pathnames in the
|
graphical tools like Windows Explorer might expect pathnames in the
|
||||||
current ANSI codepage.</para>
|
current ANSI codepage.</para>
|
||||||
|
|
||||||
|
<para>The <literal>-U</literal> option allows to use cygpath to create
|
||||||
|
unambiguous Unix paths pointing outside the Cygwin tree andf thus having
|
||||||
|
no explicit POSIX path. Those paths usually use the cygdrive prefix.
|
||||||
|
However, the cygdrive prefix can be changed by the user, so symbolic links
|
||||||
|
created using the cygdrive prefix are not foolproof. With
|
||||||
|
<literal>-U</literal> cygpath will generate such paths prepended by the
|
||||||
|
virtual <pathname>/proc/cygdrive</pathname> symbolic link, which will
|
||||||
|
never change, so the created path is safe against changing the cygdrive
|
||||||
|
prefix.</para>
|
||||||
|
|
||||||
<para>The <literal>-C</literal> option takes a single parameter:</para>
|
<para>The <literal>-C</literal> option takes a single parameter:</para>
|
||||||
<itemizedlist spacing="compact">
|
<itemizedlist spacing="compact">
|
||||||
<listitem>
|
<listitem>
|
||||||
|
|
|
@ -1,3 +1,18 @@
|
||||||
|
2015-12-06 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* cygpath.cc (absolute_flag): Initialize to CCP_RELATIVE to simplify
|
||||||
|
expressions.
|
||||||
|
(cygdrive_flag): New global flag.
|
||||||
|
(long_options): Add --proc-cygdrive option.
|
||||||
|
(options): Add -U option.
|
||||||
|
(usage): Add description for -U option.
|
||||||
|
(do_sysfolders): Or cygdrive_flag to cygwin_conv_path call.
|
||||||
|
(do_pathconv): Simply or absolute_flag to conv_func. Or
|
||||||
|
cygdrive_flag to conv_func.
|
||||||
|
(do_options): Initalize absolute_flag to CCP_RELATIVE. Initialize new
|
||||||
|
cygdrive_flag. Set absolute_flag to CCP_ABSOLUTE on -a. Set
|
||||||
|
cygdrive_flag to CCP_PROC_CYGDRIVE on -U.
|
||||||
|
|
||||||
2015-11-26 Michael Kwasigroch <mkwasigr@web.de>
|
2015-11-26 Michael Kwasigroch <mkwasigr@web.de>
|
||||||
|
|
||||||
* kill.cc (strsigno): Don't call sys_sigabbrev for signal 0.
|
* kill.cc (strsigno): Don't call sys_sigabbrev for signal 0.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* cygpath.cc -- convert pathnames between Windows and Unix format
|
/* cygpath.cc -- convert pathnames between Windows and Unix format
|
||||||
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
|
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
|
||||||
2009, 2010, 2011, 2012, 2013 Red Hat, Inc.
|
2009, 2010, 2011, 2012, 2013, 2015 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ details. */
|
||||||
|
|
||||||
static char *prog_name;
|
static char *prog_name;
|
||||||
static char *file_arg, *output_arg;
|
static char *file_arg, *output_arg;
|
||||||
static int path_flag, unix_flag, windows_flag, absolute_flag;
|
static int path_flag, unix_flag, windows_flag, absolute_flag, cygdrive_flag;
|
||||||
static int shortname_flag, longname_flag;
|
static int shortname_flag, longname_flag;
|
||||||
static int ignore_flag, allusers_flag, output_flag;
|
static int ignore_flag, allusers_flag, output_flag;
|
||||||
static int mixed_flag, options_from_file_flag, mode_flag;
|
static int mixed_flag, options_from_file_flag, mode_flag;
|
||||||
|
@ -56,6 +56,7 @@ static struct option long_options[] = {
|
||||||
{(char *) "mode", no_argument, NULL, 'M'},
|
{(char *) "mode", no_argument, NULL, 'M'},
|
||||||
{(char *) "option", no_argument, NULL, 'o'},
|
{(char *) "option", no_argument, NULL, 'o'},
|
||||||
{(char *) "path", no_argument, NULL, 'p'},
|
{(char *) "path", no_argument, NULL, 'p'},
|
||||||
|
{(char *) "proc-cygdrive", no_argument, NULL, 'U'},
|
||||||
{(char *) "short-name", no_argument, NULL, 's'},
|
{(char *) "short-name", no_argument, NULL, 's'},
|
||||||
{(char *) "type", required_argument, NULL, 't'},
|
{(char *) "type", required_argument, NULL, 't'},
|
||||||
{(char *) "unix", no_argument, NULL, 'u'},
|
{(char *) "unix", no_argument, NULL, 'u'},
|
||||||
|
@ -73,7 +74,7 @@ static struct option long_options[] = {
|
||||||
{0, no_argument, 0, 0}
|
{0, no_argument, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static char options[] = "ac:df:hilmMopst:uVwAC:DHOPSWF:";
|
static char options[] = "ac:df:hilmMopst:uUVwAC:DHOPSWF:";
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage (FILE * stream, int status)
|
usage (FILE * stream, int status)
|
||||||
|
@ -101,6 +102,8 @@ Path conversion options:\n\
|
||||||
-a, --absolute output absolute path\n\
|
-a, --absolute output absolute path\n\
|
||||||
-l, --long-name print Windows long form of NAMEs (with -w, -m only)\n\
|
-l, --long-name print Windows long form of NAMEs (with -w, -m only)\n\
|
||||||
-p, --path NAME is a PATH list (i.e., '/bin:/usr/bin')\n\
|
-p, --path NAME is a PATH list (i.e., '/bin:/usr/bin')\n\
|
||||||
|
-U, --proc-cygdrive Emit /proc/cygdrive path instead of cygdrive prefix\n\
|
||||||
|
when converting Windows path to UNIX path.\n\
|
||||||
-s, --short-name print DOS (short) form of NAMEs (with -w, -m only)\n\
|
-s, --short-name print DOS (short) form of NAMEs (with -w, -m only)\n\
|
||||||
-C, --codepage CP print DOS, Windows, or mixed pathname in Windows\n\
|
-C, --codepage CP print DOS, Windows, or mixed pathname in Windows\n\
|
||||||
codepage CP. CP can be a numeric codepage identifier,\n\
|
codepage CP. CP can be a numeric codepage identifier,\n\
|
||||||
|
@ -607,7 +610,8 @@ do_sysfolders (char option)
|
||||||
}
|
}
|
||||||
else if (!windows_flag)
|
else if (!windows_flag)
|
||||||
{
|
{
|
||||||
if (cygwin_conv_path (CCP_WIN_W_TO_POSIX, wbuf, buf, PATH_MAX))
|
if (cygwin_conv_path (CCP_WIN_W_TO_POSIX | cygdrive_flag,
|
||||||
|
wbuf, buf, PATH_MAX))
|
||||||
fprintf (stderr, "%s: error converting \"%ls\" - %s\n",
|
fprintf (stderr, "%s: error converting \"%ls\" - %s\n",
|
||||||
prog_name, wbuf, strerror (errno));
|
prog_name, wbuf, strerror (errno));
|
||||||
}
|
}
|
||||||
|
@ -652,7 +656,7 @@ do_pathconv (char *filename)
|
||||||
bool print_tmp = false;
|
bool print_tmp = false;
|
||||||
cygwin_conv_path_t conv_func =
|
cygwin_conv_path_t conv_func =
|
||||||
(unix_flag ? CCP_WIN_W_TO_POSIX : CCP_POSIX_TO_WIN_W)
|
(unix_flag ? CCP_WIN_W_TO_POSIX : CCP_POSIX_TO_WIN_W)
|
||||||
| (absolute_flag ? CCP_ABSOLUTE : CCP_RELATIVE);
|
| absolute_flag | cygdrive_flag;
|
||||||
|
|
||||||
if (!filename || !filename[0])
|
if (!filename || !filename[0])
|
||||||
{
|
{
|
||||||
|
@ -792,6 +796,8 @@ do_options (int argc, char **argv, int from_file)
|
||||||
output_flag = 0;
|
output_flag = 0;
|
||||||
mode_flag = 0;
|
mode_flag = 0;
|
||||||
codepage = 0;
|
codepage = 0;
|
||||||
|
cygdrive_flag = 0;
|
||||||
|
absolute_flag = CCP_RELATIVE;
|
||||||
if (!from_file)
|
if (!from_file)
|
||||||
options_from_file_flag = 0;
|
options_from_file_flag = 0;
|
||||||
optind = 0;
|
optind = 0;
|
||||||
|
@ -801,7 +807,7 @@ do_options (int argc, char **argv, int from_file)
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case 'a':
|
case 'a':
|
||||||
absolute_flag = 1;
|
absolute_flag = CCP_ABSOLUTE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
|
@ -883,6 +889,10 @@ do_options (int argc, char **argv, int from_file)
|
||||||
allusers_flag = 1;
|
allusers_flag = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'U':
|
||||||
|
cygdrive_flag = CCP_PROC_CYGDRIVE;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
if (!optarg)
|
if (!optarg)
|
||||||
usage (stderr, 1);
|
usage (stderr, 1);
|
||||||
|
|
Loading…
Reference in New Issue