* mount.cc (version) New global variable.
(usage) Standardize usage output. Accomodate new version option. (print_version) New function. (longopts) Accomodate new version option. (opts) Ditto. (main) Ditto.
This commit is contained in:
parent
fc240f584b
commit
8704ad9da9
@ -1,3 +1,12 @@
|
|||||||
|
2002-05-22 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
|
||||||
|
|
||||||
|
* mount.cc (version) New global variable.
|
||||||
|
(usage) Standardize usage output. Accomodate new version option.
|
||||||
|
(print_version) New function.
|
||||||
|
(longopts) Accomodate new version option.
|
||||||
|
(opts) Ditto.
|
||||||
|
(main) Ditto.
|
||||||
|
|
||||||
2002-05-22 Corinna Vinschen <corinna@vinschen.de>
|
2002-05-22 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* cygpath.cc (usage): Change usage output slightly.
|
* cygpath.cc (usage): Change usage output slightly.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* mount.cc
|
/* mount.cc
|
||||||
|
|
||||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
|
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
@ -33,6 +33,7 @@ static int mount_already_exists (const char *posix_path, int flags);
|
|||||||
// static short create_missing_dirs = FALSE;
|
// static short create_missing_dirs = FALSE;
|
||||||
static short force = FALSE;
|
static short force = FALSE;
|
||||||
|
|
||||||
|
static const char version[] = "$Revision$";
|
||||||
static const char *progname;
|
static const char *progname;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -111,46 +112,73 @@ do_mount (const char *dev, const char *where, int flags)
|
|||||||
|
|
||||||
static struct option longopts[] =
|
static struct option longopts[] =
|
||||||
{
|
{
|
||||||
{"help", no_argument, NULL, 'h' },
|
|
||||||
{"binary", no_argument, NULL, 'b'},
|
{"binary", no_argument, NULL, 'b'},
|
||||||
|
{"change-cygdrive-prefix", no_argument, NULL, 'c'},
|
||||||
|
{"cygwin-executable", no_argument, NULL, 'X'},
|
||||||
|
{"executable", no_argument, NULL, 'x'},
|
||||||
{"force", no_argument, NULL, 'f'},
|
{"force", no_argument, NULL, 'f'},
|
||||||
|
{"help", no_argument, NULL, 'h' },
|
||||||
|
{"import-old-mounts", no_argument, NULL, 'i'},
|
||||||
|
{"mount-commands", no_argument, NULL, 'm'},
|
||||||
|
{"no-executable", no_argument, NULL, 'E'},
|
||||||
|
{"show-cygdrive-prefix", no_argument, NULL, 'p'},
|
||||||
{"system", no_argument, NULL, 's'},
|
{"system", no_argument, NULL, 's'},
|
||||||
{"text", no_argument, NULL, 't'},
|
{"text", no_argument, NULL, 't'},
|
||||||
{"user", no_argument, NULL, 'u'},
|
{"user", no_argument, NULL, 'u'},
|
||||||
{"executable", no_argument, NULL, 'x'},
|
{"version", no_argument, NULL, 'v'},
|
||||||
{"no-executable", no_argument, NULL, 'E'},
|
|
||||||
{"change-cygdrive-prefix", no_argument, NULL, 'c'},
|
|
||||||
{"cygwin-executable", no_argument, NULL, 'X'},
|
|
||||||
{"show-cygdrive-prefix", no_argument, NULL, 'p'},
|
|
||||||
{"import-old-mounts", no_argument, NULL, 'i'},
|
|
||||||
{"mount-commands", no_argument, NULL, 'm'},
|
|
||||||
{NULL, 0, NULL, 0}
|
{NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static char opts[] = "hbfstuxXEpicm";
|
static char opts[] = "bcfhimpstuvxEX";
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage (void)
|
usage (FILE *where = stderr)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Usage: %s [OPTION] [<win32path> <posixpath>]\n\
|
fprintf (where, "Usage: %s [OPTION] [<win32path> <posixpath>]\n\
|
||||||
-b, --binary text files are equivalent to binary files\n\
|
-b, --binary text files are equivalent to binary files\n\
|
||||||
(newline = \\n)\n\
|
(newline = \\n)\n\
|
||||||
-c, --change-cygdrive-prefix change the cygdrive path prefix to <posixpath>\n\
|
-c, --change-cygdrive-prefix change the cygdrive path prefix to <posixpath>\n\
|
||||||
-f, --force force mount, don't warn about missing mount\n\
|
-f, --force force mount, don't warn about missing mount\n\
|
||||||
point directories\n\
|
point directories\n\
|
||||||
|
-h, --help output usage information and exit\n\
|
||||||
-i, --import-old-mounts copy old registry mount table mounts into the\n\
|
-i, --import-old-mounts copy old registry mount table mounts into the\n\
|
||||||
current mount areas\n\
|
current mount areas\n\
|
||||||
|
-m, --mount-commands write mount commands to replace user and\n\
|
||||||
|
system mount points and cygdrive prefixes\n\
|
||||||
-p, --show-cygdrive-prefix show user and/or system cygdrive path prefix\n\
|
-p, --show-cygdrive-prefix show user and/or system cygdrive path prefix\n\
|
||||||
-s, --system (default) add system-wide mount point\n\
|
-s, --system (default) add system-wide mount point\n\
|
||||||
-t, --text (default) text files get \\r\\n line endings\n\
|
-t, --text (default) text files get \\r\\n line endings\n\
|
||||||
-u, --user add user-only mount point\n\
|
-u, --user add user-only mount point\n\
|
||||||
|
-v, --version output version information and exit\n\
|
||||||
-x, --executable treat all files under mount point as executables\n\
|
-x, --executable treat all files under mount point as executables\n\
|
||||||
|
-E, --no-executable treat all files under mount point as \n\
|
||||||
|
non-executables\n\
|
||||||
-X, --cygwin-executable treat all files under mount point as cygwin\n\
|
-X, --cygwin-executable treat all files under mount point as cygwin\n\
|
||||||
executables\n\
|
executables\n\
|
||||||
-m, --mount-commands write mount commands to replace user and\n\
|
|
||||||
system mount points and cygdrive prefixes\n\
|
|
||||||
", progname);
|
", progname);
|
||||||
exit (1);
|
exit (where == stderr ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_version ()
|
||||||
|
{
|
||||||
|
const char *v = strchr (version, ':');
|
||||||
|
int len;
|
||||||
|
if (!v)
|
||||||
|
{
|
||||||
|
v = "?";
|
||||||
|
len = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v += 2;
|
||||||
|
len = strchr (v, ' ') - v;
|
||||||
|
}
|
||||||
|
printf ("\
|
||||||
|
%s (cygwin) %.*s\n\
|
||||||
|
Filesystem Utility\n\
|
||||||
|
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.\n\
|
||||||
|
Compiled on %s", progname, len, v, __DATE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -168,7 +196,13 @@ main (int argc, char **argv)
|
|||||||
saw_mount_commands
|
saw_mount_commands
|
||||||
} do_what = nada;
|
} do_what = nada;
|
||||||
|
|
||||||
progname = argv[0];
|
progname = strrchr (argv[0], '/');
|
||||||
|
if (progname == NULL)
|
||||||
|
progname = strrchr (argv[0], '\\');
|
||||||
|
if (progname == NULL)
|
||||||
|
progname = argv[0];
|
||||||
|
else
|
||||||
|
progname++;
|
||||||
|
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
{
|
{
|
||||||
@ -191,12 +225,21 @@ main (int argc, char **argv)
|
|||||||
case 'f':
|
case 'f':
|
||||||
force = TRUE;
|
force = TRUE;
|
||||||
break;
|
break;
|
||||||
|
case 'h':
|
||||||
|
usage (stdout);
|
||||||
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
if (do_what == nada)
|
if (do_what == nada)
|
||||||
do_what = saw_import_old_mounts;
|
do_what = saw_import_old_mounts;
|
||||||
else
|
else
|
||||||
usage ();
|
usage ();
|
||||||
break;
|
break;
|
||||||
|
case 'm':
|
||||||
|
if (do_what == nada)
|
||||||
|
do_what = saw_mount_commands;
|
||||||
|
else
|
||||||
|
usage ();
|
||||||
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
if (do_what == nada)
|
if (do_what == nada)
|
||||||
do_what = saw_show_cygdrive_prefix;
|
do_what = saw_show_cygdrive_prefix;
|
||||||
@ -213,8 +256,9 @@ main (int argc, char **argv)
|
|||||||
flags &= ~MOUNT_SYSTEM;
|
flags &= ~MOUNT_SYSTEM;
|
||||||
default_flag = 0;
|
default_flag = 0;
|
||||||
break;
|
break;
|
||||||
case 'X':
|
case 'v':
|
||||||
flags |= MOUNT_CYGWIN_EXEC;
|
print_version ();
|
||||||
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
flags |= MOUNT_EXEC;
|
flags |= MOUNT_EXEC;
|
||||||
@ -222,11 +266,8 @@ main (int argc, char **argv)
|
|||||||
case 'E':
|
case 'E':
|
||||||
flags |= MOUNT_NOTEXEC;
|
flags |= MOUNT_NOTEXEC;
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'X':
|
||||||
if (do_what == nada)
|
flags |= MOUNT_CYGWIN_EXEC;
|
||||||
do_what = saw_mount_commands;
|
|
||||||
else
|
|
||||||
usage ();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage ();
|
usage ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user