2 /* Toybox infrastructure.
4 * Copyright 2006 Rob Landley <rob@landley.net>
8 // When #included from main.c, provide the guts for toy_list[]
13 #define NEWTOY(name, opts, flags) {#name, name##_main, opts, flags},
14 #define OLDTOY(name, oldname, opts, flags) {#name, oldname##_main, opts, flags},
16 // When #included from toys.h, provide function declarations and structs.
17 // The #else is because main.c #includes this file twice.
20 #define NEWTOY(name, opts, flags) int name##_main(void);
21 #define OLDTOY(name, oldname, opts, flags)
24 struct string_list *fstype;
32 #define TOYFLAG_USR (1<<0)
33 #define TOYFLAG_BIN (1<<1)
34 #define TOYFLAG_SBIN (1<<2)
35 #define TOYMASK_LOCATION ((1<<4)-1)
37 #define TOYFLAG_NOFORK (1<<4)
39 extern struct toy_list {
41 int (*toy_main)(void);
48 // List of all the applets toybox can provide.
50 // This one is out of order on purpose.
52 NEWTOY(toybox, NULL, 0)
54 // The rest of these are alphabetical, for binary search.
56 USE_TOYSH(NEWTOY(cd, NULL, TOYFLAG_NOFORK))
57 USE_DF(NEWTOY(df, "Pkt:a", TOYFLAG_USR|TOYFLAG_SBIN))
58 USE_TOYSH(NEWTOY(exit, NULL, TOYFLAG_NOFORK))
59 USE_HELLO(NEWTOY(hello, NULL, TOYFLAG_NOFORK|TOYFLAG_USR))
60 USE_PWD(NEWTOY(pwd, NULL, TOYFLAG_BIN))
61 USE_TOYSH(OLDTOY(sh, toysh, "c:i", TOYFLAG_BIN))
62 USE_TOYSH(NEWTOY(toysh, "c:i", TOYFLAG_BIN))
63 USE_WHICH(NEWTOY(which, "a", TOYFLAG_USR|TOYFLAG_BIN))