Add -v flag which prints the full path of each device node when dumping
the full tree.
This commit is contained in:
parent
c9b64841e5
commit
5c5ebc1dee
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: ofctl.8,v 1.4 2008/09/25 22:44:51 reed Exp $
|
||||
.\" $NetBSD: ofctl.8,v 1.5 2018/05/26 10:21:41 jmcneill Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd September 29, 2006
|
||||
.Dd May 26, 2018
|
||||
.Dt OFCTL 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -36,6 +36,7 @@
|
|||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl p
|
||||
.Op Fl v
|
||||
.Op Fl f Ar file
|
||||
.Op Ar node
|
||||
.Sh DESCRIPTION
|
||||
|
@ -66,6 +67,8 @@ instead of the default
|
|||
.Pa /dev/openfirm .
|
||||
.It Fl p
|
||||
Display each node's properties.
|
||||
.It Fl v
|
||||
Display the full path name for each node.
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width "/dev/openprom "
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ofctl.c,v 1.12 2015/12/23 13:42:24 jmcneill Exp $ */
|
||||
/* $NetBSD: ofctl.c,v 1.13 2018/05/26 10:21:41 jmcneill Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -34,7 +34,7 @@
|
|||
#ifndef lint
|
||||
__COPYRIGHT("@(#) Copyright (c) 2006, 2007\
|
||||
The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: ofctl.c,v 1.12 2015/12/23 13:42:24 jmcneill Exp $");
|
||||
__RCSID("$NetBSD: ofctl.c,v 1.13 2018/05/26 10:21:41 jmcneill Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -62,6 +62,7 @@ static int isstrprint(const char *, size_t, int);
|
|||
|
||||
static int lflag;
|
||||
static int pflag;
|
||||
static int vflag;
|
||||
|
||||
struct of_node {
|
||||
TAILQ_ENTRY(of_node) of_sibling;
|
||||
|
@ -500,10 +501,11 @@ main(int argc, char **argv)
|
|||
const char *propfilein = NULL;
|
||||
const char *propfileout = NULL;
|
||||
|
||||
while ((c = getopt(argc, argv, "f:lpr:w:")) != EOF) {
|
||||
while ((c = getopt(argc, argv, "f:lpr:vw:")) != EOF) {
|
||||
switch (c) {
|
||||
case 'l': lflag++; break;
|
||||
case 'p': pflag++; break;
|
||||
case 'v': vflag++; break;
|
||||
case 'f': file = optarg; break;
|
||||
case 'r': propfilein = optarg; break;
|
||||
case 'w': propfileout = optarg; break;
|
||||
|
@ -511,7 +513,7 @@ main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
if (errflag)
|
||||
errx(1, "usage: ofctl [-pl] [-f file] [-r propfile] [-w propfile] [node...]");
|
||||
errx(1, "usage: ofctl [-plv] [-f file] [-r propfile] [-w propfile] [node...]");
|
||||
|
||||
if (propfilein != NULL) {
|
||||
of_proplib = prop_dictionary_internalize_from_file(propfilein);
|
||||
|
@ -694,7 +696,7 @@ oflist(int node, const char *parent_device_type, int depth,
|
|||
int len;
|
||||
while (node != 0) {
|
||||
int child;
|
||||
if (pflag == 0) {
|
||||
if (pflag == 0 && vflag == 0) {
|
||||
len = ofname(node, of_buf, of_buflen-1);
|
||||
printf("%08x: %*s%s", node, depth * 2, "",
|
||||
(char *) of_buf);
|
||||
|
|
Loading…
Reference in New Issue