Add flag -n to suppress the first column of drvctl -l output.
This commit is contained in:
parent
25057a0393
commit
0f6df043c6
@ -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 @@ List the children of the device specified by the
|
||||
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
|
||||
|
@ -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 @@ usage(void)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
bool nflag = false;
|
||||
int c, mode;
|
||||
char *attr = 0;
|
||||
extern char *optarg;
|
||||
@ -95,6 +97,9 @@ main(int argc, char **argv)
|
||||
case 'a':
|
||||
attr = optarg;
|
||||
break;
|
||||
case 'n':
|
||||
nflag = true;
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
@ -153,8 +158,11 @@ main(int argc, char **argv)
|
||||
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':
|
||||
|
Loading…
Reference in New Issue
Block a user