Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/memswitch Class names can be specified in list mode.



details:   https://anonhg.NetBSD.org/src/rev/b8ca0f0f793b
branches:  trunk
changeset: 503259:b8ca0f0f793b
user:      minoura <minoura%NetBSD.org@localhost>
date:      Sun Feb 04 08:37:33 2001 +0000

description:
Class names can be specified in list mode.
Code contributed by Tetsuya Isaki <ti%hiroshima-u.ac.jp@localhost>.

diffstat:

 usr.sbin/memswitch/memswitch.c |  19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diffs (72 lines):

diff -r 583808221c37 -r b8ca0f0f793b usr.sbin/memswitch/memswitch.c
--- a/usr.sbin/memswitch/memswitch.c    Sun Feb 04 07:08:51 2001 +0000
+++ b/usr.sbin/memswitch/memswitch.c    Sun Feb 04 08:37:33 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: memswitch.c,v 1.5 2001/02/01 00:51:22 minoura Exp $    */
+/*     $NetBSD: memswitch.c,v 1.6 2001/02/04 08:37:33 minoura Exp $    */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -166,21 +166,22 @@
        const char *name;
 {
        int i;
+       int n = 0;
        char fullname[50];
        char valuestr[MAXVALUELEN];
 
        for (i = 0; i < number_of_props; i++) {
                sprintf(fullname, "%s.%s",
                        properties[i].class, properties[i].node);
-               if (strcmp(name, fullname) == 0) {
+               if (strcmp(name, fullname) == 0 || strcmp(name, properties[i].class) == 0) {
                        properties[i].print (&properties[i], valuestr);
                        if (!nflag)
                                printf ("%s=%s\n", fullname, valuestr);
-                       break;
+                       n++;
                }
        }
-       if (i >= number_of_props) {
-               errx (1, "No such property: %s\n", name);
+       if (n == 0) {
+               errx (1, "No such %s: %s", strstr(name, ".")?"property":"class", name);
        }
 
        return;
@@ -226,7 +227,7 @@
                }
        }
        if (i >= n)
-               errx (1, "Invalid expression: %s\n", expr);
+               errx (1, "Invalid expression: %s", expr);
 
        for ( ; i < n; i++) {
                if (expr[i] == '=') {
@@ -239,7 +240,7 @@
                }
        }
        if (i >= n)
-               errx (1, "Invalid expression: %s\n", expr);
+               errx (1, "Invalid expression: %s", expr);
 
        value = &(expr[++i]);
 
@@ -256,7 +257,7 @@
                }
        }
        if (i >= number_of_props) {
-               errx (1, "No such property: %s.%s\n", class, node);
+               errx (1, "No such property: %s.%s", class, node);
        }
 
        return;
@@ -283,7 +284,7 @@
                }
        }
        if (i >= number_of_props) {
-               errx (1, "No such property: %s\n", name);
+               errx (1, "No such property: %s", name);
        }
 
        return;



Home | Main Index | Thread Index | Old Index