Make df(1) more liberal (and intelligent) about what it accepts
as arguments (for -t and -l flags, specifically). From Hubert Feyrer <feyrer@rfhs8002.fh-regensburg.de>, PR #2869.
This commit is contained in:
parent
51175461d6
commit
0097f7bcc8
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: df.1,v 1.12 1995/12/05 02:42:45 jtc Exp $
|
||||
.\" $NetBSD: df.1,v 1.13 1996/12/11 03:48:42 thorpej Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1989, 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -73,7 +73,8 @@ The
|
|||
option causes the numbers to be reported in kilobyte counts.
|
||||
.It Fl l
|
||||
Display statistics only about mounted file systems with the MNT_LOCAL
|
||||
flag set.
|
||||
flag set. If a non-local file system is given as an argument, a
|
||||
warning is issued and no information is given on that file system.
|
||||
.It Fl n
|
||||
Print out the previously obtained statistics from the file systems.
|
||||
This option should be used if it is possible that one or more
|
||||
|
@ -91,7 +92,9 @@ The list of filesystem types can be prefixed with
|
|||
.Dq no
|
||||
to specify the filesystem types for which action should
|
||||
.Em not
|
||||
be taken.
|
||||
be taken. If a file system is given on the command line that is not of
|
||||
the specified type, a warning is issued and no information is given on
|
||||
that file system.
|
||||
.El
|
||||
.Sh ENVIRONMENT VARIABLES
|
||||
.Bl -tag -width BLOCKSIZE
|
||||
|
|
20
bin/df/df.c
20
bin/df/df.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: df.c,v 1.22 1995/11/28 05:12:44 jtc Exp $ */
|
||||
/* $NetBSD: df.c,v 1.23 1996/12/11 03:48:42 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1990, 1993, 1994
|
||||
|
@ -48,7 +48,7 @@ static char copyright[] =
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)df.c 8.7 (Berkeley) 4/2/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: df.c,v 1.22 1995/11/28 05:12:44 jtc Exp $";
|
||||
static char rcsid[] = "$NetBSD: df.c,v 1.23 1996/12/11 03:48:42 thorpej Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -114,9 +114,6 @@ main(argc, argv)
|
|||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (*argv && (lflag || typelist != NULL))
|
||||
errx(1, "-l or -t does not make sense with list of mount points");
|
||||
|
||||
mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
|
||||
if (mntsize == 0)
|
||||
err(1, "retrieving information on mounted file systems");
|
||||
|
@ -166,7 +163,18 @@ main(argc, argv)
|
|||
* implement nflag here.
|
||||
*/
|
||||
if (!statfs(mntpt, &mntbuf[mntsize]))
|
||||
++mntsize;
|
||||
if (lflag &&
|
||||
(mntbuf[mntsize].f_flags & MNT_LOCAL) == 0)
|
||||
warnx("Warning: %s is not a local %s",
|
||||
*argv, "file system");
|
||||
else if
|
||||
(!selected(mntbuf[mntsize].f_fstypename))
|
||||
warnx("Warning: %s mounted as a %s %s",
|
||||
*argv,
|
||||
mntbuf[mntsize].f_fstypename,
|
||||
"file system");
|
||||
else
|
||||
++mntsize;
|
||||
else
|
||||
warn("%s", *argv);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue