From 72b1a773acf4355ae0da22d8ea382f450835f6b3 Mon Sep 17 00:00:00 2001 From: deraadt Date: Sat, 7 Dec 1996 09:09:04 +0000 Subject: [PATCH] handle -t & -l in more cases; netbsd pr#2869, hubert.feyrer@rz.uni-regensburg.de --- bin/df/df.1 | 9 ++++++--- bin/df/df.c | 16 ++++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/bin/df/df.1 b/bin/df/df.1 index b6a06195c78..2011e9f1f17 100644 --- a/bin/df/df.1 +++ b/bin/df/df.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: df.1,v 1.3 1996/06/23 14:19:51 deraadt Exp $ +.\" $OpenBSD: df.1,v 1.4 1996/12/07 09:09:04 deraadt Exp $ .\" $NetBSD: df.1,v 1.12 1995/12/05 02:42:45 jtc Exp $ .\" .\" Copyright (c) 1989, 1990, 1993 @@ -74,7 +74,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 @@ -92,7 +93,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 diff --git a/bin/df/df.c b/bin/df/df.c index 4b6795cfaa5..ebe8df29cb0 100644 --- a/bin/df/df.c +++ b/bin/df/df.c @@ -1,4 +1,4 @@ -/* $OpenBSD: df.c,v 1.4 1996/08/02 12:40:53 deraadt Exp $ */ +/* $OpenBSD: df.c,v 1.5 1996/12/07 09:09:06 deraadt Exp $ */ /* $NetBSD: df.c,v 1.21.2.1 1995/11/01 00:06:11 jtc Exp $ */ /* @@ -49,7 +49,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)df.c 8.7 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: df.c,v 1.4 1996/08/02 12:40:53 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: df.c,v 1.5 1996/12/07 09:09:06 deraadt 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,14 @@ main(argc, argv) * implement nflag here. */ if (!statfs(mntpt, &mntbuf[mntsize])) - ++mntsize; + if (lflag && (mntbuf[mntsize].f_flags & MNT_LOCAL) == 0) + warnx("%s is not a local file system", + *argv); + else if (!selected(mntbuf[mntsize].f_fstypename)) + warnx("%s mounted as a %s file system", + *argv, mntbuf[mntsize].f_fstypename); + else + ++mntsize; else warn("%s", *argv); } -- 2.20.1