aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2007-04-30 00:08:48 -0400
committerRob Landley <rob@landley.net>2007-04-30 00:08:48 -0400
commitf2ccc2d1d6f58d8f6162f2596bcbba7e275df53c (patch)
treefe76e287906b18482b19bb662dce5175af9d0fc6
parent0c93f6c7ab7aab56b39793a2317a9bff16b8ae04 (diff)
downloadtoybox-f2ccc2d1d6f58d8f6162f2596bcbba7e275df53c.tar.gz
Add true and false.
-rw-r--r--toys/Config.in13
-rw-r--r--toys/false.c11
-rw-r--r--toys/toylist.h2
-rw-r--r--toys/true.c11
4 files changed, 37 insertions, 0 deletions
diff --git a/toys/Config.in b/toys/Config.in
index 5aae5c54..ff4c68a3 100644
--- a/toys/Config.in
+++ b/toys/Config.in
@@ -77,6 +77,13 @@ config ECHO
\r carriage return
\t horizontal tab
\v vertical tab
+
+config FALSE
+ bool "false"
+ default n
+ help
+ Return nonzero.
+
config HELLO
bool "hello"
default n
@@ -350,6 +357,12 @@ config TOYSH_BUILTINS
Adds the commands exec, fg, bg, help, jobs, pwd, export, source, set,
unset, read, alias.
+config TRUE
+ bool "true"
+ default n
+ help
+ Return zero.
+
config WHICH
bool "which"
default n
diff --git a/toys/false.c b/toys/false.c
new file mode 100644
index 00000000..48b9d65a
--- /dev/null
+++ b/toys/false.c
@@ -0,0 +1,11 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * false.c - Return nonzero.
+ */
+
+#include "toys.h"
+
+int false_main(void)
+{
+ return 1;
+}
diff --git a/toys/toylist.h b/toys/toylist.h
index 125b0376..41b76698 100644
--- a/toys/toylist.h
+++ b/toys/toylist.h
@@ -90,6 +90,7 @@ USE_TOYSH(NEWTOY(cd, NULL, TOYFLAG_NOFORK))
USE_DF(NEWTOY(df, "Pkt*a", TOYFLAG_USR|TOYFLAG_SBIN))
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))
USE_MKE2FS(NEWTOY(mke2fs, MKE2FS_OPTSTRING, TOYFLAG_SBIN))
USE_ONEIT(NEWTOY(oneit, "+<1p", TOYFLAG_SBIN))
@@ -99,5 +100,6 @@ USE_TOYSH(OLDTOY(sh, toysh, "c:i", 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_WHICH(NEWTOY(which, "a", TOYFLAG_USR|TOYFLAG_BIN))
USE_YES(NEWTOY(yes, "", TOYFLAG_USR|TOYFLAG_BIN))
diff --git a/toys/true.c b/toys/true.c
new file mode 100644
index 00000000..49ec11bf
--- /dev/null
+++ b/toys/true.c
@@ -0,0 +1,11 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * true.c - Return zero.
+ */
+
+#include "toys.h"
+
+int true_main(void)
+{
+ return 0;
+}