aboutsummaryrefslogtreecommitdiff
path: root/toys/example
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-12-10 15:57:08 -0600
committerRob Landley <rob@landley.net>2015-12-10 15:57:08 -0600
commitaaecbbac2f94b7a93eb2df7f9db78828cbb7b647 (patch)
treeac2a23d038113e359b583e042170d9d319690cf2 /toys/example
parent5cb65054067391af7602bc303d77349c76648faf (diff)
downloadtoybox-aaecbbac2f94b7a93eb2df7f9db78828cbb7b647.tar.gz
Expand toys.optargs to 64 bits so people adding more options to ls don't run out.
Keep the low 32 bits of FLAG_x constants as 32 bit numbers so that at least on little endian platforms it's still normal 32 bit math outside of lib/args.c.
Diffstat (limited to 'toys/example')
-rw-r--r--toys/example/test_many_options.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/toys/example/test_many_options.c b/toys/example/test_many_options.c
new file mode 100644
index 00000000..d2f5c846
--- /dev/null
+++ b/toys/example/test_many_options.c
@@ -0,0 +1,22 @@
+/* test_many_options.c - test more than 32 bits worth of option flags
+ *
+ * Copyright 2015 Rob Landley <rob@landley.net>
+
+USE_TEST_MANY_OPTIONS(NEWTOY(test_many_options, "ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba", TOYFLAG_USR|TOYFLAG_BIN))
+
+config TEST_MANY_OPTIONS
+ bool "test_many_options"
+ default n
+ help
+ usage: test_many_options -[a-zA-Z]
+
+ Print the optflags value of the command arguments, in hex.
+*/
+
+#define FOR_test_many_options
+#include "toys.h"
+
+void test_many_options_main(void)
+{
+ xprintf("optflags=%llx\n", toys.optflags);
+}