From 0536f45747a991a21b2b544f556da704eed22bd4 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 16 May 2019 17:58:43 -0500 Subject: Add human_readable_long() for more than 3 digits of output. --- toys/example/demo_number.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'toys') diff --git a/toys/example/demo_number.c b/toys/example/demo_number.c index fce18f11..010320cf 100644 --- a/toys/example/demo_number.c +++ b/toys/example/demo_number.c @@ -2,7 +2,7 @@ * * Copyright 2015 Rob Landley -USE_DEMO_NUMBER(NEWTOY(demo_number, "hdbs", TOYFLAG_BIN)) +USE_DEMO_NUMBER(NEWTOY(demo_number, "D#=3<3hdbs", TOYFLAG_BIN)) config DEMO_NUMBER bool "demo_number" @@ -16,8 +16,13 @@ config DEMO_NUMBER -s Space between number and units (HR_SPACE) */ +#define FOR_demo_number #include "toys.h" +GLOBALS( + long D; +) + void demo_number_main(void) { char **arg; @@ -26,7 +31,7 @@ void demo_number_main(void) long long ll = atolx(*arg); if (toys.optflags) { - human_readable(toybuf, ll, toys.optflags); + human_readable_long(toybuf, ll, TT.D, toys.optflags); xputs(toybuf); } else printf("%lld\n", ll); } -- cgit v1.2.3