Module Name: src
Committed By: bouyer
Date: Sat Jun 6 21:59:18 UTC 2009
Modified Files:
src/sbin/drvctl [netbsd-5]: drvctl.8 drvctl.c
Log Message:
Pull up following revision(s) (requested by dyoung in ticket #736):
sbin/drvctl/drvctl.8: revisions 1.7 - 1.10
sbin/drvctl/drvctl.c: revision 1.7 via patch, 1.9, 1.10
fix sign-compare issues
Add flag -n to suppress the first column of drvctl -l output.
Mention -n in usage.
Bump date for previous. Remove trailing whitespace.
Add -n to usage. Now it just needs to be documented.
Document -n.
To generate a diff of this commit:
cvs rdiff -u -r1.5.10.1 -r1.5.10.2 src/sbin/drvctl/drvctl.8
cvs rdiff -u -r1.6.10.1 -r1.6.10.2 src/sbin/drvctl/drvctl.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/drvctl/drvctl.8
diff -u src/sbin/drvctl/drvctl.8:1.5.10.1 src/sbin/drvctl/drvctl.8:1.5.10.2
--- src/sbin/drvctl/drvctl.8:1.5.10.1 Sun May 3 22:49:51 2009
+++ src/sbin/drvctl/drvctl.8 Sat Jun 6 21:59:18 2009
@@ -1,4 +1,4 @@
-.\" $NetBSD: drvctl.8,v 1.5.10.1 2009/05/03 22:49:51 snj Exp $
+.\" $NetBSD: drvctl.8,v 1.5.10.2 2009/06/06 21:59:18 bouyer Exp $
.\"
.\" Copyright (c) 2004
.\" Matthias Drochner. All rights reserved.
@@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd April 4, 2009
+.Dd April 20, 2009
.Dt DRVCTL 8
.Os
.Sh NAME
@@ -40,6 +40,7 @@
.Fl d
.Ar device
.Nm
+.Op Fl n
.Fl l
.Op Ar device
.Nm
@@ -80,7 +81,20 @@
argument.
If
.Ar device
-is not specified, query for roots of the device tree instead.
+is not specified, list roots of the device tree instead.
+Output comes in two columns.
+The first column is
+.Ar device ,
+or
+.Dq root
+if
+.Ar device
+is not specified.
+The second column is the child.
+.It Fl n
+Suppress first column in
+.Fl l
+output.
.It Fl p
Get the properties for the device specified by the
.Ar device
Index: src/sbin/drvctl/drvctl.c
diff -u src/sbin/drvctl/drvctl.c:1.6.10.1 src/sbin/drvctl/drvctl.c:1.6.10.2
--- src/sbin/drvctl/drvctl.c:1.6.10.1 Sun May 3 22:49:51 2009
+++ src/sbin/drvctl/drvctl.c Sat Jun 6 21:59:18 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: drvctl.c,v 1.6.10.1 2009/05/03 22:49:51 snj Exp $ */
+/* $NetBSD: drvctl.c,v 1.6.10.2 2009/06/06 21:59:18 bouyer Exp $ */
/*
* Copyright (c) 2004
@@ -26,6 +26,7 @@
* SUCH DAMAGE.
*/
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -35,7 +36,7 @@
#include <sys/ioctl.h>
#include <sys/drvctlio.h>
-#define OPTS "QRSa:dlpr"
+#define OPTS "QRSa:dlnpr"
#define OPEN_MODE(mode) \
(((mode) == 'd' || (mode) == 'r') ? O_RDWR \
@@ -49,7 +50,7 @@
fprintf(stderr, "Usage: %s -r [-a attribute] busdevice [locator ...]\n"
" %s -d device\n"
- " %s -l [device]\n"
+ " %s [-n] -l [device]\n"
" %s -p device\n"
" %s -Q device\n"
" %s -R device\n"
@@ -62,6 +63,7 @@
int
main(int argc, char **argv)
{
+ bool nflag = false;
int c, mode;
char *attr = 0;
extern char *optarg;
@@ -95,6 +97,9 @@
case 'a':
attr = optarg;
break;
+ case 'n':
+ nflag = true;
+ break;
case '?':
default:
usage();
@@ -152,9 +157,12 @@
if (laa.l_children > children)
err(6, "DRVLISTDEV: number of children grew");
- for (i = 0; i < laa.l_children; i++) {
- printf("%s%s%s\n", laa.l_devname, (argc ? " " : ""),
- laa.l_childname[i]);
+ for (i = 0; i < (int)laa.l_children; i++) {
+ if (!nflag) {
+ printf("%s ",
+ (argc == 0) ? "root" : laa.l_devname);
+ }
+ printf("%s\n", laa.l_childname[i]);
}
break;
case 'r':