changeset 468:77f590d2cad9

Move includes into toys.h, more xprintf()
author Rob Landley <rob@landley.net>
date Fri, 17 Feb 2012 04:46:55 -0600
parents 2d50fee68ca1
children 6378ca1da18e
files toys/free.c toys/uptime.c
diffstat 2 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/toys/free.c	Thu Feb 16 17:51:51 2012 -0600
+++ b/toys/free.c	Fri Feb 17 04:46:55 2012 -0600
@@ -20,7 +20,6 @@
 */
 
 #include "toys.h"
-#include <sys/sysinfo.h>
 
 static unsigned long long convert(unsigned long d, unsigned int iscale,
 				unsigned int oscale)
--- a/toys/uptime.c	Thu Feb 16 17:51:51 2012 -0600
+++ b/toys/uptime.c	Fri Feb 17 04:46:55 2012 -0600
@@ -4,7 +4,7 @@
  *
  * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
  *
- * Not in SUSv3.
+ * Not in SUSv4.
 
 USE_UPTIME(NEWTOY(uptime, NULL, TOYFLAG_USR|TOYFLAG_BIN))
 
@@ -19,8 +19,6 @@
 */
 
 #include "toys.h"
-#include <sys/sysinfo.h>
-#include <time.h>
 
 void uptime_main(void)
 {
@@ -35,16 +33,16 @@
 	now = localtime(&tmptime);
 
 	// Time
-	printf(" %02d:%02d:%02d up ", now->tm_hour, now->tm_min, now->tm_sec);
+	xprintf(" %02d:%02d:%02d up ", now->tm_hour, now->tm_min, now->tm_sec);
 	// Uptime
 	info.uptime /= 60;
 	minutes = info.uptime%60;
 	info.uptime /= 60;
 	hours = info.uptime%24;
 	days = info.uptime/24;
-	if (days) printf("%d day%s, ", days, (days!=1)?"s":"");
+	if (days) xprintf("%d day%s, ", days, (days!=1)?"s":"");
 	if (hours)
-		printf("%2d:%02d, ", hours, minutes);
+		xprintf("%2d:%02d, ", hours, minutes);
 	else
 		printf("%d min, ", minutes);