From 959e1bac1366264d836d298589d5ea8d24bb675f Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 28 Jul 2000 22:34:24 +0000 Subject: * utils/mount.cc (main): Add --show-cygdrive-prefixes option. (show_cygdrive_prefixes): New function. * utils/umount.cc (main): Add --remove-cygdrive-prefix option. (error): Change signature from 'char *' to 'const char *'. (remove_cygdrive_prefix): New function. --- winsup/utils/umount.cc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'winsup/utils/umount.cc') diff --git a/winsup/utils/umount.cc b/winsup/utils/umount.cc index 7623c5f97..d79aaca33 100644 --- a/winsup/utils/umount.cc +++ b/winsup/utils/umount.cc @@ -19,6 +19,7 @@ static void remove_all_mounts (); static void remove_all_automounts (); static void remove_all_user_mounts (); static void remove_all_system_mounts (); +static void remove_cygdrive_prefix (int flags); static const char *progname; @@ -31,12 +32,13 @@ usage (void) fprintf (stderr, "--remove-all-mounts = remove all mounts\n"); fprintf (stderr, "--remove-auto-mounts = remove all automatically mounted mounts\n"); fprintf (stderr, "--remove-user-mounts = remove all mounts in the current user mount registry area, including auto mounts\n"); - fprintf (stderr, "--remove-system-mounts = Remove all mounts in the system-wide mount registry area\n"); + fprintf (stderr, "--remove-system-mounts = remove all mounts in the system-wide mount registry area\n"); + fprintf (stderr, "[-s] --remove-cygdrive-prefix = remove cygdrive path prefix\n"); exit (1); } static void -error (char *path) +error (const char *path) { fprintf (stderr, "%s: %s: %s\n", progname, path, strerror (errno)); exit (1); @@ -81,6 +83,11 @@ main (int argc, char **argv) remove_all_automounts (); exit (0); } + else if (strcmp (argv[i], "--remove-cygdrive-prefix") == 0) + { + remove_cygdrive_prefix (flags); + exit (0); + } else usage (); } @@ -182,3 +189,12 @@ remove_all_system_mounts () endmntent (m); } + +/* remove_cygdrive_prefix: Remove cygdrive user or system path prefix. */ +static void +remove_cygdrive_prefix (int flags) +{ + int res = cygwin_umount(NULL, flags | MOUNT_AUTO); + if (res) + error ("remove_cygdrive_prefix"); +} -- cgit v1.2.3