Module Name:    src
Committed By:   dyoung
Date:           Mon Apr 20 21:40:42 UTC 2009

Modified Files:
        src/sbin/drvctl: drvctl.8 drvctl.c

Log Message:
Add flag -n to suppress the first column of drvctl -l output.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sbin/drvctl/drvctl.8
cvs rdiff -u -r1.8 -r1.9 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.6 src/sbin/drvctl/drvctl.8:1.7
--- src/sbin/drvctl/drvctl.8:1.6	Sat Apr  4 22:05:47 2009
+++ src/sbin/drvctl/drvctl.8	Mon Apr 20 21:40:42 2009
@@ -1,4 +1,4 @@
-.\" $NetBSD: drvctl.8,v 1.6 2009/04/04 22:05:47 joerg Exp $
+.\" $NetBSD: drvctl.8,v 1.7 2009/04/20 21:40:42 dyoung Exp $
 .\"
 .\" Copyright (c) 2004
 .\" 	Matthias Drochner.  All rights reserved.
@@ -80,7 +80,16 @@
 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 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.8 src/sbin/drvctl/drvctl.c:1.9
--- src/sbin/drvctl/drvctl.c:1.8	Sat Apr  4 22:05:47 2009
+++ src/sbin/drvctl/drvctl.c	Mon Apr 20 21:40:42 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: drvctl.c,v 1.8 2009/04/04 22:05:47 joerg Exp $ */
+/* $NetBSD: drvctl.c,v 1.9 2009/04/20 21:40:42 dyoung 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			\
@@ -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();
@@ -153,8 +158,11 @@
 			err(6, "DRVLISTDEV: number of children grew");
 
 		for (i = 0; i < (int)laa.l_children; i++) {
-			printf("%s%s%s\n", laa.l_devname, (argc ? " " : ""),
-			    laa.l_childname[i]);
+			if (!nflag) {
+				printf("%s ",
+				    (argc == 0) ? "root" : laa.l_devname);
+			}
+			printf("%s\n", laa.l_childname[i]);
 		}
 		break;
 	case 'r':

Reply via email to