+2002-06-03 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
+
+ * umount.cc (version): New global variable.
+ (longopts): Accommodate new --version option.
+ (opts): Ditto.
+ (usage): Standardize usage output.
+ (print_version): New function.
+ (main): Accommodate --help, --version options.
+
2002-06-02 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
* regtool.cc (prog_name): New global variable.
(opts): Ditto.
(usage): Standardize usage output. Rearrange/add descriptions.
(print_version): New function.
- (main): Accomodate longopts and new --help, --version options. Add
+ (main): Accommodate longopts and new --help, --version options. Add
check for (_argv[optind+1] == NULL).
2002-06-02 Christopher Faylor <cgf@redhat.com>
* passwd.c (prog_name): New global variable.
(longopts): Ditto.
(opts): Ditto.
- (usage): Standardize output. Accomodate new options.
+ (usage): Standardize output. Accommodate new options.
(print_version): New function.
- (main): Accomodate longopts and new --help, --version options.
+ (main): Accommodate longopts and new --help, --version options.
2002-05-28 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
(opts): Ditto.
(usage): New function.
(print_version): New function.
- (main): Accomodate longopts and new --help, --version options.
+ (main): Accommodate longopts and new --help, --version options.
2002-05-26 Christopher Faylor <cgf@redhat.com>
2002-05-22 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
* mount.cc (version): New global variable.
- (usage): Standardize usage output. Accomodate new version option.
+ (usage): Standardize usage output. Accommodate new version option.
(print_version): New function.
- (longopts): Accomodate new version option.
+ (longopts): Accommodate new version option.
(opts): Ditto.
(main): Ditto.
* kill.cc (prog_name): New global variable.
(usage): Standardize usage output. Add descriptions.
(print_version): New function.
- (longopts): Accomodate new version option.
+ (longopts): Accommodate new version option.
(opts): Ditto.
(main): Ditto.
/* umount.cc
- Copyright 1996, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
static void remove_all_system_mounts ();
static void remove_cygdrive_prefix (int flags);
+static const char version[] = "$Revision$";
static const char *progname;
struct option longopts[] =
{"remove-user-mounts", no_argument, NULL, 'U'},
{"system", no_argument, NULL, 's'},
{"user", no_argument, NULL, 'u'},
+ {"version", no_argument, NULL, 'v'},
{NULL, 0, NULL, 0}
};
-char opts[] = "hASUsuc";
+char opts[] = "AchsSuUv";
static void
-usage (void)
+usage (FILE *where = stderr)
{
- fprintf (stderr, "Usage %s [OPTION] [<posixpath>]\n\
+ fprintf (where, "\
+Usage: %s [OPTION] [<posixpath>]\n\
-A, --remove-all-mounts remove all mounts\n\
-c, --remove-cygdrive-prefix remove cygdrive prefix\n\
+ -h, --help output usage information and exit\n\
-s, --system remove system mount (default)\n\
-S, --remove-system-mounts remove all system mounts\n\
-u, --user remove user mount\n\
-U, --remove-user-mounts remove all user mounts\n\
+ -v, --version output version information and exit\n\
", progname);
- exit (1);
+ exit (where == stderr ? 1 : 0);
}
static void
exit (1);
}
+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, 1998, 1999, 2000, 2001, 2002\n\
+Compiled on %s", progname, len, v, __DATE__);
+}
+
int
main (int argc, char **argv)
{
int i;
int flags = 0;
int default_flag = MOUNT_SYSTEM;
- progname = argv[0];
enum do_what
{
nada,
saw_remove_all_user_mounts
} do_what = nada;
+ progname = strrchr (argv[0], '/');
+ if (progname == NULL)
+ progname = strrchr (argv[0], '\\');
+ if (progname == NULL)
+ progname = argv[0];
+ else
+ progname++;
+
if (argc == 1)
usage ();
usage ();
do_what = saw_remove_cygdrive_prefix;
break;
+ case 'h':
+ usage (stdout);
case 's':
flags |= MOUNT_SYSTEM;
break;
usage ();
do_what = saw_remove_all_user_mounts;
break;
+ case 'v':
+ print_version ();
+ exit (0);
default:
usage ();
}