summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2014-07-20 00:34:54 +0000
committerbapt <bapt@FreeBSD.org>2014-07-20 00:34:54 +0000
commitcfcdf0efefd4211f26a26de8957bf5501a7df809 (patch)
tree3124d1db44cbaff5c811ec9d00e0e7ca3f237360
parentd4cd64d84a00721d688a2cb16cdac0a7919f9e7e (diff)
downloadFreeBSD-src-cfcdf0efefd4211f26a26de8957bf5501a7df809.zip
FreeBSD-src-cfcdf0efefd4211f26a26de8957bf5501a7df809.tar.gz
MFC: r261032
Add quiet support for kldstat -n PR: bin/180014 Submitted by: Olivier Cochard-Labbé <olivier at cochard.me>
-rw-r--r--sbin/kldstat/kldstat.83
-rw-r--r--sbin/kldstat/kldstat.c11
2 files changed, 10 insertions, 4 deletions
diff --git a/sbin/kldstat/kldstat.8 b/sbin/kldstat/kldstat.8
index 6f040e2..bebabe8 100644
--- a/sbin/kldstat/kldstat.8
+++ b/sbin/kldstat/kldstat.8
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 23, 2005
+.Dd January 22, 2014
.Dt KLDSTAT 8
.Os
.Sh NAME
@@ -33,6 +33,7 @@
.Nd display status of dynamic kernel linker
.Sh SYNOPSIS
.Nm
+.Op Fl q
.Op Fl v
.Op Fl i Ar id
.Op Fl n Ar filename
diff --git a/sbin/kldstat/kldstat.c b/sbin/kldstat/kldstat.c
index 575fca8..8785c00 100644
--- a/sbin/kldstat/kldstat.c
+++ b/sbin/kldstat/kldstat.c
@@ -78,7 +78,7 @@ printfile(int fileid, int verbose)
static void
usage(void)
{
- fprintf(stderr, "usage: kldstat [-v] [-i id] [-n filename]\n");
+ fprintf(stderr, "usage: kldstat [-q] [-v] [-i id] [-n filename]\n");
fprintf(stderr, " kldstat [-q] [-m modname]\n");
exit(1);
}
@@ -146,8 +146,13 @@ main(int argc, char** argv)
}
if (filename != NULL) {
- if ((fileid = kldfind(filename)) < 0)
- err(1, "can't find file %s", filename);
+ if ((fileid = kldfind(filename)) < 0) {
+ if (!quiet)
+ warn("can't find file %s", filename);
+ return 1;
+ } else if (quiet) {
+ return 0;
+ }
}
printf("Id Refs Address%*c Size Name\n", POINTER_WIDTH - 7, ' ');
OpenPOWER on IntegriCloud