Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/usbhidaction PR 51754 Charlotte Koch: fix -v output ...



details:   https://anonhg.NetBSD.org/src/rev/7e25976899af
branches:  trunk
changeset: 349991:7e25976899af
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat Dec 31 10:13:15 2016 +0000

description:
PR 51754 Charlotte Koch: fix -v output of config parser.

diffstat:

 usr.bin/usbhidaction/usbhidaction.c |  18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r 6f8a8e414d93 -r 7e25976899af usr.bin/usbhidaction/usbhidaction.c
--- a/usr.bin/usbhidaction/usbhidaction.c       Sat Dec 31 09:41:05 2016 +0000
+++ b/usr.bin/usbhidaction/usbhidaction.c       Sat Dec 31 10:13:15 2016 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: usbhidaction.c,v 1.26 2015/09/29 14:27:00 christos Exp $ */
+/*      $NetBSD: usbhidaction.c,v 1.27 2016/12/31 10:13:15 dholland Exp $ */
 
 /*
  * Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: usbhidaction.c,v 1.26 2015/09/29 14:27:00 christos Exp $");
+__RCSID("$NetBSD: usbhidaction.c,v 1.27 2016/12/31 10:13:15 dholland Exp $");
 #endif
 
 #include <stdio.h>
@@ -392,9 +392,17 @@
                                cmd->value = -1;
                }
 
-               if (verbose)
-                       (void)printf("PARSE:%d %s, %d, '%s'\n", cmd->line, name,
-                              cmd->value, cmd->action);
+               if (verbose) {
+                       char valuebuf[16];
+
+                       if (cmd->anyvalue)
+                               snprintf(valuebuf, sizeof(valuebuf), "%s", "*");
+                       else
+                               snprintf(valuebuf, sizeof(valuebuf), "%d",
+                                   cmd->value);
+                       (void)printf("PARSE:%d %s, %s, '%s'\n", cmd->line, name,
+                               valuebuf, cmd->action);
+               }
        }
        (void)fclose(f);
        return (cmds);



Home | Main Index | Thread Index | Old Index