From 9b3fc7d5e0fe4850c7faa67257231366bf9053e2 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 1 Nov 2006 22:23:58 -0500 Subject: Add a hello world applet, partly as an example and partly for testing purposes. --- main.c | 1 + toys.h | 12 ++---------- toys/hello.c | 12 ++++++++++++ 3 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 toys/hello.c diff --git a/main.c b/main.c index c4b38cd4..de349ec6 100644 --- a/main.c +++ b/main.c @@ -17,6 +17,7 @@ struct toy_list toy_list[] = { {"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} }; diff --git a/toys.h b/toys.h index 71d70197..810af89c 100644 --- a/toys.h +++ b/toys.h @@ -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 @@ union toy_union { // 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" diff --git a/toys/hello.c b/toys/hello.c new file mode 100644 index 00000000..1f587723 --- /dev/null +++ b/toys/hello.c @@ -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; +} -- cgit v1.2.3