Date: Wed, 26 Jun 2013 22:44:08 GMT From: Olivier Cochard-Labbé <olivier@cochard.me> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/180014: Patch for kldstat: add quiet option to filename mode Message-ID: <201306262244.r5QMi8nK002127@oldred.freebsd.org> Resent-Message-ID: <201306262250.r5QMo0VK037576@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 180014
>Category: bin
>Synopsis: Patch for kldstat: add quiet option to filename mode
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Jun 26 22:50:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Olivier Cochard-Labbé
>Release: current
>Organization:
BSD Router Project
>Environment:
FreeBSD orange.bsdrp.net 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r252056M: Fri Jun 21 17:24:08 CEST 2013 root@orange.bsdrp.net:/usr/obj/usr/local/BSDRP/BSDRPcur/FreeBSD/src/sys/PROD amd64
>Description:
kldstat have a quiet (-q) option, but it's supported only for modulname (-m) and not for filename (-n).
This patch add quiet option for filename too.
>How-To-Repeat:
>Fix:
Patch attached with submission follows:
--- kldstat.c.orig 2013-06-27 00:19:44.339868707 +0200
+++ kldstat.c 2013-06-27 00:34:52.730802738 +0200
@@ -78,7 +78,7 @@
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 @@
}
if (filename != NULL) {
- if ((fileid = kldfind(filename)) < 0)
- err(1, "can't find file %s", filename);
+ if ((fileid = kldfind(filename)) < 0) {
+ if (!quiet)
+ err(1, "can't find file %s", filename);
+ return 1;
+ } else if (quiet) {
+ return 0;
+ }
}
printf("Id Refs Address%*c Size Name\n", POINTER_WIDTH - 7, ' ');
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306262244.r5QMi8nK002127>
