aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-02-16 17:51:51 -0600
committerRob Landley <rob@landley.net>2012-02-16 17:51:51 -0600
commitaf125c381709f196d7276b62841328dfd2143e9f (patch)
tree9ea800e7ddf531ec0c415c1d84cdbbbe970add42
parentcd9ca5f547010214c046a3d2556251c34bbc8c76 (diff)
downloadtoybox-af125c381709f196d7276b62841328dfd2143e9f.tar.gz
Minor cleanups: trim spaces from strings, use xprintf().
-rw-r--r--toys/free.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/toys/free.c b/toys/free.c
index 529da19a..189107f1 100644
--- a/toys/free.c
+++ b/toys/free.c
@@ -4,7 +4,7 @@
*
* Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
*
- * Not in SUSv3.
+ * Not in SUSv4.
USE_FREE(NEWTOY(free, "gmkb", TOYFLAG_USR|TOYFLAG_BIN))
@@ -22,7 +22,6 @@ config FREE
#include "toys.h"
#include <sys/sysinfo.h>
-
static unsigned long long convert(unsigned long d, unsigned int iscale,
unsigned int oscale)
{
@@ -42,19 +41,19 @@ void free_main(void)
if (toys.optflags & 4) oscale = 20;
if (toys.optflags & 8) oscale = 30;
- printf(" total used free shared buffers\n");
- printf("Mem: %12llu%12llu%12llu%12llu%12llu\n",
+ xprintf("\t\ttotal used free shared buffers\n");
+ xprintf("Mem:%17llu%12llu%12llu%12llu%12llu\n",
convert(info.totalram, iscale, oscale),
convert(info.totalram-info.freeram, iscale, oscale),
convert(info.freeram, iscale, oscale),
convert(info.sharedram, iscale, oscale),
convert(info.bufferram, iscale, oscale));
- printf("-/+ buffers/cache: %12llu%12llu\n",
+ xprintf("-/+ buffers/cache:%15llu%12llu\n",
convert(info.totalram - info.freeram - info.bufferram, iscale, oscale),
convert(info.freeram + info.bufferram, iscale, oscale));
- printf("Swap: %12llu%12llu%12llu\n",
+ xprintf("Swap:%16llu%12llu%12llu\n",
convert(info.totalswap, iscale, oscale),
convert(info.totalswap - info.freeswap, iscale, oscale),
convert(info.freeswap, iscale, oscale));