aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
Diffstat (limited to 'toys')
-rw-r--r--toys/basename.c2
-rw-r--r--toys/bzcat.c2
-rw-r--r--toys/catv.c2
-rw-r--r--toys/chroot.c2
-rw-r--r--toys/chvt.c2
-rw-r--r--toys/count.c2
-rw-r--r--toys/df.c2
-rw-r--r--toys/dirname.c2
-rw-r--r--toys/dmesg.c2
-rw-r--r--toys/echo.c2
-rw-r--r--toys/false.c1
-rw-r--r--toys/hello.c2
-rw-r--r--toys/help.c4
-rw-r--r--toys/mke2fs.c2
-rw-r--r--toys/mkfifo.c2
-rw-r--r--toys/netcat.c3
-rw-r--r--toys/oneit.c2
-rw-r--r--toys/patch.c2
-rw-r--r--toys/pwd.c2
-rw-r--r--toys/readlink.c2
-rw-r--r--toys/sed.c2
-rw-r--r--toys/sha1sum.c2
-rw-r--r--toys/sleep.c2
-rw-r--r--toys/sync.c2
-rw-r--r--toys/touch.c2
-rw-r--r--toys/toylist.h52
-rw-r--r--toys/toysh.c5
-rw-r--r--toys/true.c2
-rw-r--r--toys/tty.c2
-rw-r--r--toys/which.c2
-rw-r--r--toys/yes.c2
31 files changed, 64 insertions, 53 deletions
diff --git a/toys/basename.c b/toys/basename.c
index ffcb5bbe..70ffe5ba 100644
--- a/toys/basename.c
+++ b/toys/basename.c
@@ -6,6 +6,8 @@
*
* See http://www.opengroup.org/onlinepubs/009695399/utilities/basename.html
+USE_BASENAME(NEWTOY(basename, "<1>2", TOYFLAG_BIN))
+
config BASENAME
bool "basename"
default y
diff --git a/toys/bzcat.c b/toys/bzcat.c
index 39b962e3..d540524d 100644
--- a/toys/bzcat.c
+++ b/toys/bzcat.c
@@ -6,6 +6,8 @@
*
* Not in SUSv3.
+USE_BZCAT(NEWTOY(bzcat, NULL, TOYFLAG_USR|TOYFLAG_BIN))
+
config BZCAT
bool "bzcat"
default n
diff --git a/toys/catv.c b/toys/catv.c
index aa1bfd54..c4479d9c 100644
--- a/toys/catv.c
+++ b/toys/catv.c
@@ -7,6 +7,8 @@
* Not in SUSv3, but see "Cat -v considered harmful" at
* http://cm.bell-labs.com/cm/cs/doc/84/kp.ps.gz
+USE_CATV(NEWTOY(catv, "vte", TOYFLAG_USR|TOYFLAG_BIN))
+
config CATV
bool "catv"
default y
diff --git a/toys/chroot.c b/toys/chroot.c
index 305d4fb1..a3a5f53c 100644
--- a/toys/chroot.c
+++ b/toys/chroot.c
@@ -6,6 +6,8 @@
*
* Not in SUSv3.
+USE_CHROOT(NEWTOY(chroot, "<1", TOYFLAG_USR|TOYFLAG_SBIN))
+
config CHROOT
bool "chroot"
default y
diff --git a/toys/chvt.c b/toys/chvt.c
index fbee3915..c32a021f 100644
--- a/toys/chvt.c
+++ b/toys/chvt.c
@@ -6,6 +6,8 @@
*
* Not in SUSv3.
+USE_CHVT(NEWTOY(chvt, "<1", TOYFLAG_USR|TOYFLAG_SBIN))
+
config CHVT
bool "chvt"
default y
diff --git a/toys/count.c b/toys/count.c
index b4e24332..96102e4e 100644
--- a/toys/count.c
+++ b/toys/count.c
@@ -6,6 +6,8 @@
*
* Not in SUSv3.
+USE_COUNT(NEWTOY(count, NULL, TOYFLAG_USR|TOYFLAG_BIN))
+
config COUNT
bool "count"
default y
diff --git a/toys/df.c b/toys/df.c
index da0d94bb..6cc9e27c 100644
--- a/toys/df.c
+++ b/toys/df.c
@@ -6,6 +6,8 @@
*
* See http://www.opengroup.org/onlinepubs/009695399/utilities/df.html
+USE_DF(NEWTOY(df, "Pkt*a", TOYFLAG_USR|TOYFLAG_SBIN))
+
config DF
bool "df (disk free)"
default y
diff --git a/toys/dirname.c b/toys/dirname.c
index 9d1ad430..7300c7af 100644
--- a/toys/dirname.c
+++ b/toys/dirname.c
@@ -6,6 +6,8 @@
*
* See http://www.opengroup.org/onlinepubs/009695399/utilities/dirname.html
+USE_DIRNAME(NEWTOY(dirname, "<1>1", TOYFLAG_BIN))
+
config DIRNAME
bool "dirname"
default y
diff --git a/toys/dmesg.c b/toys/dmesg.c
index a16b8d01..a02de5a4 100644
--- a/toys/dmesg.c
+++ b/toys/dmesg.c
@@ -6,6 +6,8 @@
*
* Not in SUSv3.
+USE_DMESG(NEWTOY(dmesg, "s#n#c", TOYFLAG_BIN))
+
config DMESG
bool "dmesg"
default y
diff --git a/toys/echo.c b/toys/echo.c
index 7c475ca0..8b4d7c58 100644
--- a/toys/echo.c
+++ b/toys/echo.c
@@ -6,6 +6,8 @@
*
* See http://www.opengroup.org/onlinepubs/009695399/utilities/echo.html
+USE_ECHO(NEWTOY(echo, "+en", TOYFLAG_BIN))
+
config ECHO
bool "echo"
default y
diff --git a/toys/false.c b/toys/false.c
index ac6bf642..7b570bd2 100644
--- a/toys/false.c
+++ b/toys/false.c
@@ -6,6 +6,7 @@
*
* See http://www.opengroup.org/onlinepubs/009695399/utilities/false.html
+USE_FALSE(NEWTOY(false, NULL, TOYFLAG_BIN))
config FALSE
bool "false"
diff --git a/toys/hello.c b/toys/hello.c
index 278fa0a5..a8caeefe 100644
--- a/toys/hello.c
+++ b/toys/hello.c
@@ -7,6 +7,8 @@
* Not in SUSv3.
* See http://www.opengroup.org/onlinepubs/009695399/utilities/
+USE_HELLO(NEWTOY(hello, NULL, TOYFLAG_USR|TOYFLAG_BIN))
+
config HELLO
bool "hello"
default y
diff --git a/toys/help.c b/toys/help.c
index 472ccdea..515a09b5 100644
--- a/toys/help.c
+++ b/toys/help.c
@@ -6,6 +6,8 @@
*
* Not in SUSv3, but exists as a bash builtin.
+USE_HELP(NEWTOY(help, "<1", TOYFLAG_BIN))
+
config HELP
bool "help"
default y
@@ -31,7 +33,7 @@ config HELP_LONG
#define NEWTOY(name,opt,flags) help_##name "\0"
#define OLDTOY(name,oldname,opts,flags) "\xff" #oldname "\0"
static char *help_data =
-#include "toys/toylist.h"
+#include "generated/newtoys.h"
;
void help_main(void)
diff --git a/toys/mke2fs.c b/toys/mke2fs.c
index 405ed94d..5b8af52a 100644
--- a/toys/mke2fs.c
+++ b/toys/mke2fs.c
@@ -6,6 +6,8 @@
*
* Not in SUSv3.
+USE_MKE2FS(NEWTOY(mke2fs, MKE2FS_OPTSTRING, TOYFLAG_SBIN))
+
config MKE2FS
bool "mke2fs"
default n
diff --git a/toys/mkfifo.c b/toys/mkfifo.c
index 77cb73ee..5ddfa6c1 100644
--- a/toys/mkfifo.c
+++ b/toys/mkfifo.c
@@ -4,6 +4,8 @@
*
* See http://www.opengroup.org/onlinepubs/009695399/utilities/mkfifo.html
+USE_MKFIFO(NEWTOY(mkfifo, "<1m:", TOYFLAG_BIN))
+
config MKFIFO
bool "mkfifo"
default y
diff --git a/toys/netcat.c b/toys/netcat.c
index 573a76ca..ed7a8877 100644
--- a/toys/netcat.c
+++ b/toys/netcat.c
@@ -6,6 +6,9 @@
*
* Not in SUSv3.
+USE_NETCAT(OLDTOY(nc, netcat, "i#w#l@p#s:q#f:e", TOYFLAG_BIN))
+USE_NETCAT(NEWTOY(netcat, "i#w#l@p#s:q#f:e", TOYFLAG_BIN))
+
config NETCAT
bool "netcat"
default n
diff --git a/toys/oneit.c b/toys/oneit.c
index a05e9266..991eba11 100644
--- a/toys/oneit.c
+++ b/toys/oneit.c
@@ -6,6 +6,8 @@
*
* Not in SUSv3.
+USE_ONEIT(NEWTOY(oneit, "+<1c:p", TOYFLAG_SBIN))
+
config ONEIT
bool "oneit"
default y
diff --git a/toys/patch.c b/toys/patch.c
index 53be2631..9ec748e2 100644
--- a/toys/patch.c
+++ b/toys/patch.c
@@ -21,6 +21,8 @@
* -F fuzz (number, default 2)
* [file] which file to patch
+USE_PATCH(NEWTOY(patch, "up#i:R", TOYFLAG_USR|TOYFLAG_BIN))
+
config PATCH
bool "patch"
default y
diff --git a/toys/pwd.c b/toys/pwd.c
index d0c4dfa1..d84c504a 100644
--- a/toys/pwd.c
+++ b/toys/pwd.c
@@ -8,6 +8,8 @@
*
* TODO: add -L -P
+USE_PWD(NEWTOY(pwd, NULL, TOYFLAG_BIN))
+
config PWD
bool "pwd"
default y
diff --git a/toys/readlink.c b/toys/readlink.c
index 89aff10d..882fddc6 100644
--- a/toys/readlink.c
+++ b/toys/readlink.c
@@ -6,6 +6,8 @@
*
* Not in SUSv3.
+USE_READLINK(NEWTOY(readlink, "<1f", TOYFLAG_BIN))
+
config READLINK
bool "readlink"
default n
diff --git a/toys/sed.c b/toys/sed.c
index ffd0a2a1..b3800d8e 100644
--- a/toys/sed.c
+++ b/toys/sed.c
@@ -6,6 +6,8 @@
*
* See http://www.opengroup.org/onlinepubs/009695399/utilities/sed.c
+USE_SED(NEWTOY(sed, "irne*", TOYFLAG_BIN))
+
config SED
bool "sed"
default n
diff --git a/toys/sha1sum.c b/toys/sha1sum.c
index 2a1b11e9..3229cd12 100644
--- a/toys/sha1sum.c
+++ b/toys/sha1sum.c
@@ -9,6 +9,8 @@
*
* Not in SUSv3.
+USE_SHA1SUM(NEWTOY(sha1sum, NULL, TOYFLAG_USR|TOYFLAG_BIN))
+
config SHA1SUM
bool "sha1sum"
default y
diff --git a/toys/sleep.c b/toys/sleep.c
index 205adf21..55a6b977 100644
--- a/toys/sleep.c
+++ b/toys/sleep.c
@@ -6,6 +6,8 @@
*
* See http://www.opengroup.org/onlinepubs/009695399/utilities/sleep.html
+USE_SLEEP(NEWTOY(sleep, "<1", TOYFLAG_BIN))
+
config SLEEP
bool "sleep"
default y
diff --git a/toys/sync.c b/toys/sync.c
index 96c36770..e6990fd8 100644
--- a/toys/sync.c
+++ b/toys/sync.c
@@ -6,6 +6,8 @@
*
* Not in SUSv3.
+USE_SYNC(NEWTOY(sync, NULL, TOYFLAG_BIN))
+
config SYNC
bool "sync"
default y
diff --git a/toys/touch.c b/toys/touch.c
index 8c9b7aaa..65afe58d 100644
--- a/toys/touch.c
+++ b/toys/touch.c
@@ -6,6 +6,8 @@
*
* See http://www.opengroup.org/onlinepubs/009695399/utilities/touch.html
+USE_TOUCH(NEWTOY(touch, "l#t:r:mca", TOYFLAG_BIN))
+
config TOUCH
bool "touch"
default y
diff --git a/toys/toylist.h b/toys/toylist.h
index 1f01c547..74a4619f 100644
--- a/toys/toylist.h
+++ b/toys/toylist.h
@@ -5,13 +5,6 @@
*/
-// Provide function declarations and structs. Note that main.c #includes this
-// file twice (with different macros) to populate toy_list[].
-
-#ifndef NEWTOY
-#define NEWTOY(name, opts, flags) void name##_main(void);
-#define OLDTOY(name, oldname, opts, flags)
-
struct df_data {
struct arg_list *fstype;
@@ -126,48 +119,3 @@ extern struct toy_list {
char *options;
int flags;
} toy_list[];
-
-#endif
-
-// List of all the applets toybox can provide.
-
-// This one is out of order on purpose: it's the first element in the array.
-
-NEWTOY(toybox, NULL, 0)
-
-// The rest of these are alphabetical, for binary search.
-
-USE_BASENAME(NEWTOY(basename, "<1>2", TOYFLAG_BIN))
-USE_BZCAT(NEWTOY(bzcat, NULL, TOYFLAG_USR|TOYFLAG_BIN))
-USE_CATV(NEWTOY(catv, "vte", TOYFLAG_USR|TOYFLAG_BIN))
-USE_CHROOT(NEWTOY(chroot, "<1", TOYFLAG_USR|TOYFLAG_SBIN))
-USE_CHVT(NEWTOY(chvt, "<1", TOYFLAG_USR|TOYFLAG_SBIN))
-USE_COUNT(NEWTOY(count, NULL, TOYFLAG_USR|TOYFLAG_BIN))
-USE_TOYSH(NEWTOY(cd, NULL, TOYFLAG_NOFORK))
-USE_DF(NEWTOY(df, "Pkt*a", TOYFLAG_USR|TOYFLAG_SBIN))
-USE_DIRNAME(NEWTOY(dirname, "<1>1", TOYFLAG_BIN))
-USE_DMESG(NEWTOY(dmesg, "s#n#c", TOYFLAG_BIN))
-USE_ECHO(NEWTOY(echo, "+en", TOYFLAG_BIN))
-USE_TOYSH(NEWTOY(exit, NULL, TOYFLAG_NOFORK))
-USE_FALSE(NEWTOY(false, NULL, TOYFLAG_BIN))
-USE_HELLO(NEWTOY(hello, NULL, TOYFLAG_USR|TOYFLAG_BIN))
-USE_HELP(NEWTOY(help, "<1", TOYFLAG_BIN))
-USE_MKE2FS(NEWTOY(mke2fs, MKE2FS_OPTSTRING, TOYFLAG_SBIN))
-USE_MKFIFO(NEWTOY(mkfifo, "<1m:", TOYFLAG_BIN))
-USE_NETCAT(OLDTOY(nc, netcat, "i#w#l@p#s:q#f:e", TOYFLAG_BIN))
-USE_NETCAT(NEWTOY(netcat, "i#w#l@p#s:q#f:e", TOYFLAG_BIN))
-USE_ONEIT(NEWTOY(oneit, "+<1c:p", TOYFLAG_SBIN))
-USE_PATCH(NEWTOY(patch, "up#i:R", TOYFLAG_USR|TOYFLAG_BIN))
-USE_PWD(NEWTOY(pwd, NULL, TOYFLAG_BIN))
-USE_READLINK(NEWTOY(readlink, "<1f", TOYFLAG_BIN))
-USE_SED(NEWTOY(sed, "irne*", TOYFLAG_BIN))
-USE_TOYSH(OLDTOY(sh, toysh, "c:i", TOYFLAG_BIN))
-USE_SHA1SUM(NEWTOY(sha1sum, NULL, TOYFLAG_USR|TOYFLAG_BIN))
-USE_SLEEP(NEWTOY(sleep, "<1", TOYFLAG_BIN))
-USE_SYNC(NEWTOY(sync, NULL, TOYFLAG_BIN))
-USE_TOUCH(NEWTOY(touch, "l#t:r:mca", TOYFLAG_BIN))
-USE_TOYSH(NEWTOY(toysh, "c:i", TOYFLAG_BIN))
-USE_TRUE(NEWTOY(true, NULL, TOYFLAG_BIN))
-USE_TTY(NEWTOY(tty, "s", TOYFLAG_BIN))
-USE_WHICH(NEWTOY(which, "a", TOYFLAG_USR|TOYFLAG_BIN))
-USE_YES(NEWTOY(yes, NULL, TOYFLAG_USR|TOYFLAG_BIN))
diff --git a/toys/toysh.c b/toys/toysh.c
index 353d2158..15c78116 100644
--- a/toys/toysh.c
+++ b/toys/toysh.c
@@ -16,6 +16,11 @@
*
* TODO: // Handle embedded NUL bytes in the command line.
+USE_TOYSH(NEWTOY(cd, NULL, TOYFLAG_NOFORK))
+USE_TOYSH(NEWTOY(exit, NULL, TOYFLAG_NOFORK))
+USE_TOYSH(OLDTOY(sh, toysh, "c:i", TOYFLAG_BIN))
+USE_TOYSH(NEWTOY(toysh, "c:i", TOYFLAG_BIN))
+
config TOYSH
bool "sh (toysh)"
default y
diff --git a/toys/true.c b/toys/true.c
index 88e95904..582b2cae 100644
--- a/toys/true.c
+++ b/toys/true.c
@@ -6,6 +6,8 @@
*
* See http://www.opengroup.org/onlinepubs/009695399/utilities/true.html
+USE_TRUE(NEWTOY(true, NULL, TOYFLAG_BIN))
+
config TRUE
bool "true"
default y
diff --git a/toys/tty.c b/toys/tty.c
index a603e3e3..6bc9cd34 100644
--- a/toys/tty.c
+++ b/toys/tty.c
@@ -5,6 +5,8 @@
*
* See http://www.opengroup.org/onlinepubs/009695399/utilities/tty.html
+USE_TTY(NEWTOY(tty, "s", TOYFLAG_BIN))
+
config TTY
bool "tty"
default y
diff --git a/toys/which.c b/toys/which.c
index d7205fde..63e12aa4 100644
--- a/toys/which.c
+++ b/toys/which.c
@@ -6,6 +6,8 @@
*
* Not in SUSv3.
+USE_WHICH(NEWTOY(which, "a", TOYFLAG_USR|TOYFLAG_BIN))
+
config WHICH
bool "which"
default y
diff --git a/toys/yes.c b/toys/yes.c
index 501ea3a9..a44937b3 100644
--- a/toys/yes.c
+++ b/toys/yes.c
@@ -6,6 +6,8 @@
*
* Not in SUSv3.
+USE_YES(NEWTOY(yes, NULL, TOYFLAG_USR|TOYFLAG_BIN))
+
config YES
bool "yes"
default y