changeset 13:d87d8a056295

Add a hello world applet, partly as an example and partly for testing purposes.
author Rob Landley <rob@landley.net>
date Wed, 01 Nov 2006 22:23:58 -0500
parents 478a2faf9119
children f8e628f61f16
files main.c toys.h toys/hello.c
diffstat 3 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Wed Nov 01 22:19:34 2006 -0500
+++ b/main.c	Wed Nov 01 22:23:58 2006 -0500
@@ -17,6 +17,7 @@
 	{"cd", cd_main, TOYFLAG_NOFORK},
 	{"df", df_main, TOYFLAG_USR|TOYFLAG_SBIN},
 	{"exit", exit_main, TOYFLAG_NOFORK},
+	{"hello", hello_main, TOYFLAG_NOFORK|TOYFLAG_USR},
 	{"sh", toysh_main, TOYFLAG_BIN},
 	{"toysh", toysh_main, TOYFLAG_BIN}
 };
--- a/toys.h	Wed Nov 01 22:19:34 2006 -0500
+++ b/toys.h	Wed Nov 01 22:23:58 2006 -0500
@@ -28,6 +28,7 @@
 int cd_main(void);
 int df_main(void);
 int exit_main(void);
+int hello_main(void);
 int toybox_main(void);
 int toysh_main(void);
 
@@ -76,13 +77,4 @@
 
 // Pending the addition of menuconfig...
 
-#define CFG_TOYS_FREE     0
-
-#define CFG_TOYSH_TTY     0  // Terminal control
-#define CFG_TOYSH_JOBCTL  0  // &, fg, bg, jobs.  ctrl-z with tty.
-#define CFG_TOYSH_FLOWCTL 0  // if, while, for, functions { }
-#define CFG_TOYSH_ENVVARS 0  // Environment variables
-#define CFG_TOYSH_LOCVARS 0  // Local, synthetic, fancy prompts, set, $?
-#define CFG_TOYSH_PIPES   0  // Pipes and redirects: | > < >> << && || & () ;
-
-#define CFG_DF_PEDANTIC   1  // Support -P and -k in df
+#include "gen_config.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toys/hello.c	Wed Nov 01 22:23:58 2006 -0500
@@ -0,0 +1,12 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * hello.c - A hello world program.
+ */
+
+#include "toys.h"
+
+int hello_main(void)
+{
+	printf("Hello world\n");
+	return 0;
+}