Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com Date: Mon, 6 Nov 2000 23:28:58 -0500 From: Jason Tishler To: Cygwin-Developers Subject: mount --show-cygdrive-prefixes patch Message-ID: <20001106232857.A108@dothill.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MSViGOPLIilc/S2P" Content-Disposition: inline User-Agent: Mutt/1.2.5i Organization: Dot Hill Systems Corp. --MSViGOPLIilc/S2P Content-Type: text/plain; charset=us-ascii Content-Disposition: inline See attached for the patch that enhances mount --show-cygdrive-prefixes to display the flags too. The following is the cygwin ChangeLog: Mon Nov 6 22:22:42 2000 Jason Tishler * external.cc (get_cygdrive_prefixes): Enhance to return user and system flags too. * external.cc (cygwin_internal): Ditto. * path.cc (mount_info::get_cygdrive_prefixes): Ditto. * shared_info.h (get_cygdrive_prefixes): Ditto. The following is the utils ChangeLog: Mon Nov 6 22:22:42 2000 Jason Tishler * mount.cc (show_cygdrive_prefixes): Enhance to display user and system flags too. Thanks, Jason -- Jason Tishler Director, Software Engineering Phone: +1 (732) 264-8770 x235 Dot Hill Systems Corporation Fax: +1 (732) 264-8798 82 Bethany Road, Suite 7 Email: Jason DOT Tishler AT dothill DOT com Hazlet, NJ 07730 USA WWW: http://www.dothill.com --MSViGOPLIilc/S2P Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="MountShowCygdrive.patch" Index: cygwin/external.cc =================================================================== RCS file: /cvs/src/src/winsup/cygwin/external.cc,v retrieving revision 1.18 diff -u -p -r1.18 external.cc --- external.cc 2000/11/05 06:42:23 1.18 +++ external.cc 2000/11/07 04:19:39 @@ -88,10 +88,12 @@ fillout_pinfo (pid_t pid, int winpid) } static DWORD -get_cygdrive_prefixes (char *user, char *system) +get_cygdrive_prefixes (char *user, char *system, char *user_flags, + char *system_flags) { shared_info *info = cygwin_getshared(); - int res = info->mount.get_cygdrive_prefixes(user, system); + int res = info->mount.get_cygdrive_prefixes(user, system, user_flags, + system_flags); return (res == ERROR_SUCCESS) ? 1 : 0; } @@ -141,7 +143,9 @@ cygwin_internal (cygwin_getinfo_types t, { char *user = va_arg (arg, char *); char *system = va_arg (arg, char *); - return get_cygdrive_prefixes (user, system); + char *user_flags = va_arg (arg, char *); + char *system_flags = va_arg (arg, char *); + return get_cygdrive_prefixes (user, system, user_flags, system_flags); } case CW_GETPINFO_FULL: Index: cygwin/path.cc =================================================================== RCS file: /cvs/src/src/winsup/cygwin/path.cc,v retrieving revision 1.78 diff -u -p -r1.78 path.cc --- path.cc 2000/11/06 16:40:29 1.78 +++ path.cc 2000/11/07 04:19:45 @@ -1623,12 +1623,20 @@ mount_info::remove_cygdrive_info_from_re } int -mount_info::get_cygdrive_prefixes (char *user, char *system) +mount_info::get_cygdrive_prefixes (char *user, char *system, char* user_flags, + char* system_flags) { /* Get the user path prefix from HKEY_CURRENT_USER. */ reg_key r; int res = r.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, user, MAX_PATH, ""); + /* Get the user flags, if appropriate */ + if (res == ERROR_SUCCESS) + { + int flags = r.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, MOUNT_AUTO); + strcpy (user_flags, (flags & MOUNT_BINARY) ? "binmode" : "textmode"); + } + /* Get the system path prefix from HKEY_LOCAL_MACHINE. */ reg_key r2 (HKEY_LOCAL_MACHINE, KEY_ALL_ACCESS, "SOFTWARE", CYGWIN_INFO_CYGNUS_REGISTRY_NAME, @@ -1636,6 +1644,13 @@ mount_info::get_cygdrive_prefixes (char CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, NULL); int res2 = r2.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, system, MAX_PATH, ""); + + /* Get the system flags, if appropriate */ + if (res2 == ERROR_SUCCESS) + { + int flags = r2.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, MOUNT_AUTO); + strcpy (system_flags, (flags & MOUNT_BINARY) ? "binmode" : "textmode"); + } return (res != ERROR_SUCCESS) ? res : res2; } Index: cygwin/shared_info.h =================================================================== RCS file: /cvs/src/src/winsup/cygwin/shared_info.h,v retrieving revision 1.2 diff -u -p -r1.2 shared_info.h --- shared_info.h 2000/09/08 02:56:55 1.2 +++ shared_info.h 2000/11/07 04:19:45 @@ -85,7 +85,8 @@ public: int write_cygdrive_info_to_registry (const char *cygdrive_prefix, unsigned flags); int remove_cygdrive_info_from_registry (const char *cygdrive_prefix, unsigned flags); - int get_cygdrive_prefixes (char *user, char *system); + int get_cygdrive_prefixes (char *user, char *system, char* user_flags, + char* system_flags); void import_v1_mounts (); Index: utils/mount.cc =================================================================== RCS file: /cvs/src/src/winsup/utils/mount.cc,v retrieving revision 1.9 diff -u -p -r1.9 mount.cc --- mount.cc 2000/10/28 05:00:00 1.9 +++ mount.cc 2000/11/07 04:19:49 @@ -267,19 +267,22 @@ change_cygdrive_prefix (const char *new_ static void show_cygdrive_prefixes () { - /* Get the Cygdrive user and system path prefixes */ + /* Get the Cygdrive user and system path prefixes and flags */ char user[MAX_PATH]; char system[MAX_PATH]; - cygwin_internal (CW_GET_CYGDRIVE_PREFIXES, user, system); + char user_flags[MAX_PATH]; + char system_flags[MAX_PATH]; + cygwin_internal (CW_GET_CYGDRIVE_PREFIXES, user, system, user_flags, + system_flags); /* Display the user and system cygdrive path prefixes, if necessary (ie, not empty) */ - const char *format = "%-18s %-11s\n"; - printf (format, "Prefix", "Type"); + const char *format = "%-18s %-11s %s\n"; + printf (format, "Prefix", "Type", "Flags"); if (strlen (user) > 0) - printf (format, user, "user"); + printf (format, user, "user", user_flags); if (strlen (system) > 0) - printf (format, system, "system"); + printf (format, system, "system", system_flags); exit (0); } --MSViGOPLIilc/S2P--