• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Flags values for the third argument of NEWTOY()
2  *
3  * Included from both main.c (runs in toys.h context) and scripts/install.c
4  * (which may build on crazy things like macosx when cross compiling).
5  */
6 
7 // Flags describing command behavior.
8 
9 // Where to install (toybox --long outputs absolute paths to commands)
10 // If no location bits set, command not listed in "toybox" command's output.
11 #define TOYFLAG_USR      (1<<0)
12 #define TOYFLAG_BIN      (1<<1)
13 #define TOYFLAG_SBIN     (1<<2)
14 #define TOYMASK_LOCATION ((1<<4)-1)
15 
16 // This is a shell built-in function, running in the same process context.
17 #define TOYFLAG_NOFORK   (1<<4)
18 
19 // Start command with a umask of 0 (saves old umask in this.old_umask)
20 #define TOYFLAG_UMASK    (1<<5)
21 
22 // This command runs as root.
23 #define TOYFLAG_STAYROOT (1<<6) // Don't drop suid root before running cmd_main
24 #define TOYFLAG_NEEDROOT (1<<7) // Refuse to run if real uid != 0
25 #define TOYFLAG_ROOTONLY (TOYFLAG_STAYROOT|TOYFLAG_NEEDROOT)
26 
27 // Call setlocale to listen to environment variables.
28 // This invalidates sprintf("%.*s", size, string) as a valid length constraint.
29 #define TOYFLAG_LOCALE   (1<<8)
30 
31 // Suppress default --help processing
32 #define TOYFLAG_NOHELP   (1<<9)
33 
34 // Error code to return if argument parsing fails (default 1)
35 #define TOYFLAG_ARGFAIL(x) (x<<24)
36 
37 #if CFG_TOYBOX_PEDANTIC_ARGS
38 #define NO_ARGS ">0"
39 #else
40 #define NO_ARGS 0
41 #endif
42