Source-Changes-HG archive

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

[src/trunk]: src/sbin/sysctl fix inconsistencies with USEAPP; centralize the ...



details:   https://anonhg.NetBSD.org/src/rev/fb38d349e1fc
branches:  trunk
changeset: 521515:fb38d349e1fc
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jan 31 20:15:14 2002 +0000

description:
fix inconsistencies with USEAPP; centralize the flags check so that we
don't have to deal with it in the future.

diffstat:

 sbin/sysctl/sysctl.c |  21 +++++----------------
 1 files changed, 5 insertions(+), 16 deletions(-)

diffs (82 lines):

diff -r d1d6b9726777 -r fb38d349e1fc sbin/sysctl/sysctl.c
--- a/sbin/sysctl/sysctl.c      Thu Jan 31 19:36:47 2002 +0000
+++ b/sbin/sysctl/sysctl.c      Thu Jan 31 20:15:14 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysctl.c,v 1.54 2002/01/28 02:07:40 simonb Exp $       */
+/*     $NetBSD: sysctl.c,v 1.55 2002/01/31 20:15:14 christos Exp $     */
 
 /*
  * Copyright (c) 1993
@@ -44,7 +44,7 @@
 #if 0
 static char sccsid[] = "@(#)sysctl.c   8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: sysctl.c,v 1.54 2002/01/28 02:07:40 simonb Exp $");
+__RCSID("$NetBSD: sysctl.c,v 1.55 2002/01/31 20:15:14 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -189,7 +189,8 @@
 static int findname(char *, char *, char **, struct list *);
 static void usage(void);
 
-#define USEAPP(s, a) printf("%s: use '%s' to view this information\n", s, a)
+#define USEAPP(s, a) \
+    if (flags) printf("%s: use '%s' to view this information\n", s, a)
 
 
 int
@@ -360,15 +361,11 @@
                        return;
                case KERN_VNODE:
                case KERN_FILE:
-                       if (flags == 0)
-                               return;
                        USEAPP(string, "pstat");
                        return;
                case KERN_PROC:
                case KERN_PROC2:
                case KERN_PROC_ARGS:
-                       if (flags == 0)
-                               return;
                        USEAPP(string, "ps");
                        return;
                case KERN_CLOCKRATE:
@@ -378,8 +375,6 @@
                        special |= BOOTTIME;
                        break;
                case KERN_NTPTIME:
-                       if (flags == 0)
-                               return;
                        USEAPP(string, "ntpdc -c kerninfo");
                        return;
                case KERN_MBUF:
@@ -391,8 +386,6 @@
                        special |= CPTIME;
                        break;
                case KERN_MSGBUF:
-                       if (flags == 0)
-                               return;
                        USEAPP(string, "dmesg");
                        return;
                case KERN_CONSDEV:
@@ -432,9 +425,7 @@
                case VM_METER:
                case VM_UVMEXP:
                case VM_UVMEXP2:
-                       if (flags) {
-                               USEAPP(string, "vmstat' or 'systat");
-                       }
+                       USEAPP(string, "vmstat' or 'systat");
                        return;
                }
                break;
@@ -493,8 +484,6 @@
 
                /* XXX Special-case for NFS stats. */
                if (mib[1] == 2 && mib[2] == NFS_NFSSTATS) {
-                       if (flags == 0)
-                               return;
                        USEAPP(string, "nfsstat");
                        return;
                }



Home | Main Index | Thread Index | Old Index