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:
Corinna Vinschen
2015-12-06 17:25:48 +01:00
parent 3ff65caea5
commit 5aa8817e3a
13 changed files with 131 additions and 45 deletions

View File

@ -2,7 +2,7 @@
/* sys/cygwin.h
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.
@ -57,8 +57,10 @@ enum
CCP_CONVTYPE_MASK = 3,
/* Or these values to the above as needed. */
CCP_ABSOLUTE = 0, /* Request absolute path (default). */
CCP_RELATIVE = 0x100 /* Request to keep path relative. */
CCP_ABSOLUTE = 0, /* Request absolute path (default). */
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;