aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
Diffstat (limited to 'toys')
-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);
}