changeset 467:2d50fee68ca1

Minor cleanups: trim spaces from strings, use xprintf().
author Rob Landley <rob@landley.net>
date Thu, 16 Feb 2012 17:51:51 -0600
parents 9f1e089262cb
children 77f590d2cad9
files toys/free.c
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/toys/free.c	Mon Feb 13 17:15:49 2012 +0100
+++ b/toys/free.c	Thu Feb 16 17:51:51 2012 -0600
@@ -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 @@
 #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 @@
 	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));