Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/systat allow fractional intervals



details:   https://anonhg.NetBSD.org/src/rev/16e9f5fac000
branches:  trunk
changeset: 348529:16e9f5fac000
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Oct 22 22:02:55 2016 +0000

description:
allow fractional intervals

diffstat:

 usr.bin/systat/cmds.c   |   6 +++---
 usr.bin/systat/extern.h |   4 ++--
 usr.bin/systat/main.c   |  10 +++++-----
 3 files changed, 10 insertions(+), 10 deletions(-)

diffs (90 lines):

diff -r dd51e2086470 -r 16e9f5fac000 usr.bin/systat/cmds.c
--- a/usr.bin/systat/cmds.c     Sat Oct 22 21:55:06 2016 +0000
+++ b/usr.bin/systat/cmds.c     Sat Oct 22 22:02:55 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cmds.c,v 1.29 2016/08/02 15:56:09 scole Exp $  */
+/*     $NetBSD: cmds.c,v 1.30 2016/10/22 22:02:55 christos Exp $       */
 
 /*-
  * Copyright (c) 1980, 1992, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)cmds.c     8.2 (Berkeley) 4/29/95";
 #endif
-__RCSID("$NetBSD: cmds.c,v 1.29 2016/08/02 15:56:09 scole Exp $");
+__RCSID("$NetBSD: cmds.c,v 1.30 2016/10/22 22:02:55 christos Exp $");
 #endif /* not lint */
 
 #include <ctype.h>
@@ -150,7 +150,7 @@
 void
 status(void)
 {
-       error("Showing %s, refresh every %d seconds.", curmode->c_name, naptime);
+       error("Showing %s, refresh every %g seconds.", curmode->c_name, naptime);
 }
 
 int
diff -r dd51e2086470 -r 16e9f5fac000 usr.bin/systat/extern.h
--- a/usr.bin/systat/extern.h   Sat Oct 22 21:55:06 2016 +0000
+++ b/usr.bin/systat/extern.h   Sat Oct 22 22:02:55 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.45 2016/08/02 15:56:09 scole Exp $        */
+/*     $NetBSD: extern.h,v 1.46 2016/10/22 22:02:55 christos Exp $     */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -50,7 +50,7 @@
 extern long    ntext, textp;
 extern int     CMDLINE;
 extern int     hz, stathz, maxslp;
-extern int     naptime;
+extern double  naptime;
 extern int     nhosts;
 extern int     nports;
 extern int     protos;
diff -r dd51e2086470 -r 16e9f5fac000 usr.bin/systat/main.c
--- a/usr.bin/systat/main.c     Sat Oct 22 21:55:06 2016 +0000
+++ b/usr.bin/systat/main.c     Sat Oct 22 22:02:55 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.49 2015/08/23 18:33:15 mrg Exp $    */
+/*     $NetBSD: main.c,v 1.50 2016/10/22 22:02:55 christos Exp $       */
 
 /*-
  * Copyright (c) 1980, 1992, 1993
@@ -36,7 +36,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: main.c,v 1.49 2015/08/23 18:33:15 mrg Exp $");
+__RCSID("$NetBSD: main.c,v 1.50 2016/10/22 22:02:55 christos Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -66,7 +66,7 @@
 sig_t  sigtstpdfl;
 double avenrun[3];
 int     col;
-int    naptime = 5;
+double naptime = 5;
 int     verbose = 1;                    /* to report kvm read errs */
 int     hz, stathz, maxslp;
 char    c;
@@ -113,7 +113,7 @@
                        nflag = !nflag;
                        break;
                case 'w':
-                       if ((naptime = atoi(optarg)) <= 0)
+                       if ((naptime = strtod(optarg, NULL)) <= 0)
                                errx(1, "interval <= 0.");
                        break;
                case 't':
@@ -133,7 +133,7 @@
                int modefound = 0;
 
                if (isdigit((unsigned char)argv[0][0])) {
-                       naptime = atoi(argv[0]);
+                       naptime = strtod(argv[0], NULL);
                        if (naptime <= 0)
                                naptime = 5;
                        continue;



Home | Main Index | Thread Index | Old Index