aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/toyflags.h11
-rw-r--r--toys/posix/echo.c2
-rw-r--r--toys/posix/test.c3
3 files changed, 9 insertions, 7 deletions
diff --git a/lib/toyflags.h b/lib/toyflags.h
index 408c3ec6..b158ba88 100644
--- a/lib/toyflags.h
+++ b/lib/toyflags.h
@@ -15,21 +15,22 @@
// This is a shell built-in function, running in the same process context.
#define TOYFLAG_NOFORK (1<<4)
+#define TOYFLAG_MAYFORK (1<<5)
// Start command with a umask of 0 (saves old umask in this.old_umask)
-#define TOYFLAG_UMASK (1<<5)
+#define TOYFLAG_UMASK (1<<6)
// This command runs as root.
-#define TOYFLAG_STAYROOT (1<<6) // Don't drop suid root before running cmd_main
-#define TOYFLAG_NEEDROOT (1<<7) // Refuse to run if real uid != 0
+#define TOYFLAG_STAYROOT (1<<7) // Don't drop suid root before running cmd_main
+#define TOYFLAG_NEEDROOT (1<<8) // Refuse to run if real uid != 0
#define TOYFLAG_ROOTONLY (TOYFLAG_STAYROOT|TOYFLAG_NEEDROOT)
// Call setlocale to listen to environment variables.
// This invalidates sprintf("%.*s", size, string) as a valid length constraint.
-#define TOYFLAG_LOCALE (1<<8)
+#define TOYFLAG_LOCALE (1<<9)
// Suppress default --help processing
-#define TOYFLAG_NOHELP (1<<9)
+#define TOYFLAG_NOHELP (1<<10)
// Error code to return if argument parsing fails (default 1)
#define TOYFLAG_ARGFAIL(x) (x<<24)
diff --git a/toys/posix/echo.c b/toys/posix/echo.c
index 759990a3..94546ecd 100644
--- a/toys/posix/echo.c
+++ b/toys/posix/echo.c
@@ -9,7 +9,7 @@
* We also honor -- to _stop_ option parsing (bash doesn't, we go with
* consistency over compatibility here).
-USE_ECHO(NEWTOY(echo, "^?Een[-eE]", TOYFLAG_BIN))
+USE_ECHO(NEWTOY(echo, "^?Een[-eE]", TOYFLAG_BIN|TOYFLAG_MAYFORK))
config ECHO
bool "echo"
diff --git a/toys/posix/test.c b/toys/posix/test.c
index 052b8deb..87a866a7 100644
--- a/toys/posix/test.c
+++ b/toys/posix/test.c
@@ -4,7 +4,8 @@
*
* See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
-USE_TEST(NEWTOY(test, 0, TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_NOHELP))
+USE_TEST(NEWTOY(test, 0, TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_NOHELP|TOYFLAG_MAYFORK))
+USE_TEST(OLDTOY([, test, TOYFLAG_NOFORK|TOYFLAG_NOHELP))
config TEST
bool "test"