aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-02-17 04:46:55 -0600
committerRob Landley <rob@landley.net>2012-02-17 04:46:55 -0600
commit524a949c7fc53f17198767ecfc29cbc856d6efc6 (patch)
treedc3d5a04232398500e56ee2a3b3142775defdfd7 /toys
parentaf125c381709f196d7276b62841328dfd2143e9f (diff)
downloadtoybox-524a949c7fc53f17198767ecfc29cbc856d6efc6.tar.gz
Move includes into toys.h, more xprintf()
Diffstat (limited to 'toys')
-rw-r--r--toys/free.c1
-rw-r--r--toys/uptime.c10
2 files changed, 4 insertions, 7 deletions
diff --git a/toys/free.c b/toys/free.c
index 189107f1..229e5e97 100644
--- a/toys/free.c
+++ b/toys/free.c
@@ -20,7 +20,6 @@ config FREE
*/
#include "toys.h"
-#include <sys/sysinfo.h>
static unsigned long long convert(unsigned long d, unsigned int iscale,
unsigned int oscale)
diff --git a/toys/uptime.c b/toys/uptime.c
index 046b9a29..83fb6b1e 100644
--- a/toys/uptime.c
+++ b/toys/uptime.c
@@ -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 @@ config UPTIME
*/
#include "toys.h"
-#include <sys/sysinfo.h>
-#include <time.h>
void uptime_main(void)
{
@@ -35,16 +33,16 @@ void uptime_main(void)
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);