changeset 116:a0678c2ae9b8

Add true and false.
author Rob Landley <rob@landley.net>
date Mon, 30 Apr 2007 00:08:48 -0400
parents 19b5567f0a1b
children 07d8795fc19c
files toys/Config.in toys/false.c toys/toylist.h toys/true.c
diffstat 4 files changed, 37 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/toys/Config.in	Sun Apr 29 19:55:21 2007 -0400
+++ b/toys/Config.in	Mon Apr 30 00:08:48 2007 -0400
@@ -77,6 +77,13 @@
 		\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 @@
 	  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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toys/false.c	Mon Apr 30 00:08:48 2007 -0400
@@ -0,0 +1,11 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * false.c - Return nonzero.
+ */
+
+#include "toys.h"
+
+int false_main(void)
+{
+	return 1;
+}
--- a/toys/toylist.h	Sun Apr 29 19:55:21 2007 -0400
+++ b/toys/toylist.h	Mon Apr 30 00:08:48 2007 -0400
@@ -90,6 +90,7 @@
 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_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))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toys/true.c	Mon Apr 30 00:08:48 2007 -0400
@@ -0,0 +1,11 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * true.c - Return zero.
+ */
+
+#include "toys.h"
+
+int true_main(void)
+{
+	return 0;
+}