Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/ofctl Add -v flag which prints the full path of eac...



details:   https://anonhg.NetBSD.org/src/rev/140836970670
branches:  trunk
changeset: 319322:140836970670
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat May 26 10:21:41 2018 +0000

description:
Add -v flag which prints the full path of each device node when dumping
the full tree.

diffstat:

 usr.sbin/ofctl/ofctl.8 |   7 +++++--
 usr.sbin/ofctl/ofctl.c |  12 +++++++-----
 2 files changed, 12 insertions(+), 7 deletions(-)

diffs (92 lines):

diff -r 9a1154a134be -r 140836970670 usr.sbin/ofctl/ofctl.8
--- a/usr.sbin/ofctl/ofctl.8    Sat May 26 00:17:54 2018 +0000
+++ b/usr.sbin/ofctl/ofctl.8    Sat May 26 10:21:41 2018 +0000
@@ -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 @@
 .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 "
diff -r 9a1154a134be -r 140836970670 usr.sbin/ofctl/ofctl.c
--- a/usr.sbin/ofctl/ofctl.c    Sat May 26 00:17:54 2018 +0000
+++ b/usr.sbin/ofctl/ofctl.c    Sat May 26 10:21:41 2018 +0000
@@ -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 lflag;
 static int pflag;
+static int vflag;
 
 struct of_node {
        TAILQ_ENTRY(of_node) of_sibling;
@@ -500,10 +501,11 @@
        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 @@
                }
        }
        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 @@
        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);



Home | Main Index | Thread Index | Old Index