aboutsummaryrefslogtreecommitdiff
path: root/toys/example
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2019-05-16 17:58:43 -0500
committerRob Landley <rob@landley.net>2019-05-16 17:58:43 -0500
commit0536f45747a991a21b2b544f556da704eed22bd4 (patch)
treec1a131f9b2aee09c01e96afb9d96ddb34d68766c /toys/example
parent506b264702008c470492bbe0a27085d25fd24878 (diff)
downloadtoybox-0536f45747a991a21b2b544f556da704eed22bd4.tar.gz
Add human_readable_long() for more than 3 digits of output.
Diffstat (limited to 'toys/example')
-rw-r--r--toys/example/demo_number.c9
1 files changed, 7 insertions, 2 deletions
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 <rob@landley.net>
-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);
}