diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-04-16 20:37:01 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-04-16 20:37:01 +0000 |
commit | 73cff35173dd75b0254ae7cf9098c32822859de0 (patch) | |
tree | fd1bb09611b2b7064967ca8d8b2aef98514e616b /src/state/hpr_fmttime.c | |
parent | 5199738f4e32773f4f752a94998593e18e3af36f (diff) | |
download | s6-linux-init-73cff35173dd75b0254ae7cf9098c32822859de0.tar.xz |
It builds! Tomorrow: skeletons for stage2, stage3 and runlevel scripts.
Diffstat (limited to 'src/state/hpr_fmttime.c')
-rw-r--r-- | src/state/hpr_fmttime.c | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/src/state/hpr_fmttime.c b/src/state/hpr_fmttime.c deleted file mode 100644 index 8038cfe..0000000 --- a/src/state/hpr_fmttime.c +++ /dev/null @@ -1,52 +0,0 @@ -/* ISC license. */ - -#include <string.h> - -#include <skalibs/types.h> - -#include "hpr.h" - -size_t hpr_fmttime (char *buf, size_t max, unsigned int seconds) -{ - size_t m = 0 ; - unsigned int minutes = 0 ; - unsigned int hours = 0 ; - if (seconds >= 60) - { - minutes = seconds / 60 ; - seconds %= 60 ; - if (minutes >= 60) - { - hours = minutes / 60 ; - minutes %= 60 ; - } - } - m = sizeof(HPR_WALL_BANNER) - 1 ; - if (m > max) return 0 ; - memcpy(buf, HPR_WALL_BANNER, m) ; - if (hours) - { - if (m + UINT_FMT + 6 > max) return 0 ; - m += uint_fmt(buf + m, hours) ; - memcpy(buf + m, " hour", 5) ; - m += 5 ; - if (hours > 1) buf[m++] = 's' ; - buf[m++] = ' ' ; - } - if (minutes) - { - if (m + UINT_FMT + 8 > max) return 0 ; - m += uint_fmt(buf + m, minutes) ; - memcpy(buf + m, " minute", 7) ; - m += 7 ; - if (minutes > 1) buf[m++] = 's' ; - buf[m++] = ' ' ; - } - if (m + UINT_FMT + 8 > max) return 0 ; - m += uint_fmt(buf + m, seconds) ; - memcpy(buf + m, " second", 7) ; - m += 7 ; - if (seconds != 1) buf[m++] = 's' ; - buf[m++] = ' ' ; - return m ; -} |