change `-a'' to be a synonym for `-A''.

addresses PR 7629.
This commit is contained in:
chs 2000-06-06 07:09:14 +00:00
parent 602ebf1e8d
commit 09218270f0
2 changed files with 9 additions and 50 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: umount.8,v 1.7 1998/04/17 01:19:42 fair Exp $
.\" $NetBSD: umount.8,v 1.8 2000/06/06 07:09:14 chs Exp $
.\"
.\" Copyright (c) 1980, 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -69,11 +69,10 @@ file.
The options are as follows:
.Bl -tag -width indent
.It Fl a
All the filesystems described in
.Xr fstab 5
are unmounted.
.It Fl A
All the currently mounted filesystems except the root are unmounted.
.It Fl A
Synonym for
.Fl a .
.It Fl f
The filesystem is forcibly unmounted.
Active special devices continue to work,

View File

@ -1,4 +1,4 @@
/* $NetBSD: umount.c,v 1.26 1999/11/09 15:06:34 drochner Exp $ */
/* $NetBSD: umount.c,v 1.27 2000/06/06 07:09:15 chs Exp $ */
/*-
* Copyright (c) 1980, 1989, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)umount.c 8.8 (Berkeley) 5/8/95";
#else
__RCSID("$NetBSD: umount.c,v 1.26 1999/11/09 15:06:34 drochner Exp $");
__RCSID("$NetBSD: umount.c,v 1.27 2000/06/06 07:09:15 chs Exp $");
#endif
#endif /* not lint */
@ -77,7 +77,6 @@ char **makevfslist __P((char *));
int main __P((int, char *[]));
int namematch __P((struct hostent *));
int selected __P((int));
int umountall __P((char **));
int umountfs __P((char *, char **));
void usage __P((void));
int xdr_dir __P((XDR *, char *));
@ -98,8 +97,6 @@ main(argc, argv)
while ((ch = getopt(argc, argv, "AaFfRh:t:v")) != -1)
switch (ch) {
case 'A':
all = 2;
break;
case 'a':
all = 1;
break;
@ -110,7 +107,7 @@ main(argc, argv)
fflag = MNT_FORCE;
break;
case 'h': /* -h implies -A. */
all = 2;
all = 1;
nfshost = optarg;
break;
case 'R':
@ -139,12 +136,10 @@ main(argc, argv)
typelist = makevfslist("nfs");
errs = 0;
switch (all) {
case 2:
if (all) {
if ((mnts = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) {
warn("getmntinfo");
errs = 1;
break;
}
for (errs = 0, mnts--; mnts > 0; mnts--) {
if (checkvfsname(mntbuf[mnts].f_fstypename, typelist))
@ -152,49 +147,14 @@ main(argc, argv)
if (umountfs(mntbuf[mnts].f_mntonname, typelist) != 0)
errs = 1;
}
break;
case 1:
if (setfsent() == 0)
err(1, "%s", _PATH_FSTAB);
errs = umountall(typelist);
break;
case 0:
} else {
for (errs = 0; *argv != NULL; ++argv)
if (umountfs(*argv, typelist) != 0)
errs = 1;
break;
}
exit(errs);
}
int
umountall(typelist)
char **typelist;
{
struct statfs *fs;
int n;
int rval;
n = getmntinfo(&fs, MNT_NOWAIT);
if (n == 0)
err(1, NULL);
rval = 0;
while (--n >= 0) {
/* Ignore the root. */
if (strncmp(fs[n].f_mntonname, "/", MNAMELEN) == 0)
continue;
if (checkvfsname(fs[n].f_fstypename, typelist))
continue;
if (umountfs(fs[n].f_mntonname, typelist))
rval = 1;
}
return (rval);
}
int
umountfs(name, typelist)
char *name;