diff options
author | Rob Landley <rob@landley.net> | 2012-02-17 04:46:55 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2012-02-17 04:46:55 -0600 |
commit | 524a949c7fc53f17198767ecfc29cbc856d6efc6 (patch) | |
tree | dc3d5a04232398500e56ee2a3b3142775defdfd7 /toys/uptime.c | |
parent | af125c381709f196d7276b62841328dfd2143e9f (diff) | |
download | toybox-524a949c7fc53f17198767ecfc29cbc856d6efc6.tar.gz |
Move includes into toys.h, more xprintf()
Diffstat (limited to 'toys/uptime.c')
-rw-r--r-- | toys/uptime.c | 10 |
1 files changed, 4 insertions, 6 deletions
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); |