From f2ccc2d1d6f58d8f6162f2596bcbba7e275df53c Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 30 Apr 2007 00:08:48 -0400 Subject: [PATCH] Add true and false. --- toys/Config.in | 13 +++++++++++++ toys/false.c | 11 +++++++++++ toys/toylist.h | 2 ++ toys/true.c | 11 +++++++++++ 4 files changed, 37 insertions(+) create mode 100644 toys/false.c create mode 100644 toys/true.c diff --git a/toys/Config.in b/toys/Config.in index 5aae5c5..ff4c68a 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 0000000..48b9d65 --- /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 125b037..41b7669 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 0000000..49ec11b --- /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; +} -- 2.7.4