From a45013a749f144819a9a10cb5b5bb2455ca04703 Mon Sep 17 00:00:00 2001 From: http://ftp.de.debian.org/debian/pool/main/p/procps/procps_3.2.8-8.debian.tar.gz Date: Fri, 19 Mar 2010 21:58:46 +0100 Subject: [PATCH 50/70] vmstat_headers getopt replacement Author: Liu Xing Author: Michael Tokarev Bug-Debian: http://bugs.debian.org/436805 Bug-Debian: http://bugs.debian.org/408088 --- vmstat.c | 80 ++++++++++++++++++++++++++----------------------------------- 1 files changed, 34 insertions(+), 46 deletions(-) diff --git a/vmstat.c b/vmstat.c index f022928..e0d3c23 100644 --- a/vmstat.c +++ b/vmstat.c @@ -29,14 +29,15 @@ #include "proc/sysinfo.h" #include "proc/version.h" -static unsigned long dataUnit=1024; -static char szDataUnit [16]; #define UNIT_B 1 #define UNIT_k 1000 #define UNIT_K 1024 #define UNIT_m 1000000 #define UNIT_M 1048576 +static unsigned long dataUnit=UNIT_K; +static char szDataUnit[3] = "K"; + #define VMSTAT 0 #define DISKSTAT 0x00000001 #define VMSUMSTAT 0x00000002 @@ -354,6 +355,7 @@ static void diskformat(void){ if ((fDiskstat=fopen("/proc/diskstats", "rb"))){ fclose(fDiskstat); ndisks=getdiskstat(&disks,&partitions); + if (!moreheaders) diskheader(); for(k=0; k0)?tmp:22); -- 1.7.0