aboutsummaryrefslogtreecommitdiff
path: root/toys/toylist.h
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-11-19 02:49:22 -0500
committerRob Landley <rob@landley.net>2006-11-19 02:49:22 -0500
commit8324b89598b2aee0957a0378f0f63ff5755498be (patch)
tree6958c34834147ab29607a8e67aca2b05a751f2ee /toys/toylist.h
parentb29ceb8bd0f99134fe215eebc531dbcd7717e8ae (diff)
downloadtoybox-8324b89598b2aee0957a0378f0f63ff5755498be.tar.gz
New option parsing infrastructure (doesn't use getopt). Hook it up to
existing applets. Still a bit buggy, but bits of it work.
Diffstat (limited to 'toys/toylist.h')
-rw-r--r--toys/toylist.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/toys/toylist.h b/toys/toylist.h
index 87716b0f..a0eef1c1 100644
--- a/toys/toylist.h
+++ b/toys/toylist.h
@@ -10,15 +10,15 @@
#ifdef FROM_MAIN
#undef NEWTOY
#undef OLDTOY
-#define NEWTOY(name, flags) {#name, name##_main, flags},
-#define OLDTOY(name, oldname, flags) {#name, oldname##_main, flags},
+#define NEWTOY(name, opts, flags) {#name, name##_main, opts, flags},
+#define OLDTOY(name, oldname, opts, flags) {#name, oldname##_main, opts, flags},
// When #included from toys.h, provide function declarations and structs.
// The #else is because main.c #includes this file twice.
#else
-#define NEWTOY(name, flags) int name##_main(void);
-#define OLDTOY(name, oldname, flags)
+#define NEWTOY(name, opts, flags) int name##_main(void);
+#define OLDTOY(name, oldname, opts, flags)
struct df_data {
struct string_list *fstype;
@@ -39,6 +39,7 @@ union toy_union {
extern struct toy_list {
char *name;
int (*toy_main)(void);
+ char *options;
int flags;
} toy_list[];
@@ -48,15 +49,15 @@ extern struct toy_list {
// This one is out of order on purpose.
-NEWTOY(toybox, 0)
+NEWTOY(toybox, NULL, 0)
// The rest of these are alphabetical, for binary search.
-USE_TOYSH(NEWTOY(cd, TOYFLAG_NOFORK))
-USE_DF(NEWTOY(df, TOYFLAG_USR|TOYFLAG_SBIN))
-USE_TOYSH(NEWTOY(exit, TOYFLAG_NOFORK))
-USE_HELLO(NEWTOY(hello, TOYFLAG_NOFORK|TOYFLAG_USR))
-USE_PWD(NEWTOY(pwd, TOYFLAG_BIN))
-USE_TOYSH(OLDTOY(sh, toysh, TOYFLAG_BIN))
-USE_TOYSH(NEWTOY(toysh, TOYFLAG_BIN))
-USE_WHICH(NEWTOY(which, TOYFLAG_USR|TOYFLAG_BIN))
+USE_TOYSH(NEWTOY(cd, NULL, TOYFLAG_NOFORK))
+USE_DF(NEWTOY(df, "Pkt:a", TOYFLAG_USR|TOYFLAG_SBIN))
+USE_TOYSH(NEWTOY(exit, NULL, TOYFLAG_NOFORK))
+USE_HELLO(NEWTOY(hello, NULL, TOYFLAG_NOFORK|TOYFLAG_USR))
+USE_PWD(NEWTOY(pwd, NULL, TOYFLAG_BIN))
+USE_TOYSH(OLDTOY(sh, toysh, "c:i", TOYFLAG_BIN))
+USE_TOYSH(NEWTOY(toysh, "c:i", TOYFLAG_BIN))
+USE_WHICH(NEWTOY(which, "a", TOYFLAG_USR|TOYFLAG_BIN))