Rob Landley | 2896480 | 2008-01-19 17:08:39 -0600 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: |
| 2 | * |
Rob Landley | 9b3fc7d | 2006-11-01 22:23:58 -0500 | [diff] [blame] | 3 | * hello.c - A hello world program. |
Rob Landley | fece5cb | 2007-12-03 20:05:57 -0600 | [diff] [blame] | 4 | * |
Rob Landley | 2896480 | 2008-01-19 17:08:39 -0600 | [diff] [blame] | 5 | * Copyright 2006 Rob Landley <rob@landley.net> |
| 6 | * |
Rob Landley | fece5cb | 2007-12-03 20:05:57 -0600 | [diff] [blame] | 7 | * Not in SUSv3. |
Rob Landley | be92b3f | 2011-11-15 01:09:27 -0600 | [diff] [blame^] | 8 | * See http://opengroup.org/onlinepubs/9699919799/utilities/ |
Rob Landley | 2896480 | 2008-01-19 17:08:39 -0600 | [diff] [blame] | 9 | |
Rob Landley | 7c04f01 | 2008-01-20 19:00:16 -0600 | [diff] [blame] | 10 | USE_HELLO(NEWTOY(hello, "e@d*c#b:a", TOYFLAG_USR|TOYFLAG_BIN)) |
Rob Landley | 55928b1 | 2008-01-19 17:43:27 -0600 | [diff] [blame] | 11 | |
Rob Landley | 2896480 | 2008-01-19 17:08:39 -0600 | [diff] [blame] | 12 | config HELLO |
| 13 | bool "hello" |
Rob Landley | d3e61fc | 2009-01-14 20:41:37 -0600 | [diff] [blame] | 14 | default n |
Rob Landley | 2896480 | 2008-01-19 17:08:39 -0600 | [diff] [blame] | 15 | help |
| 16 | A hello world program. You don't need this. |
| 17 | |
| 18 | Mostly used as an example/skeleton file for adding new commands, |
| 19 | occasionally nice to test kernel booting via "init=/bin/hello". |
| 20 | */ |
Rob Landley | 9b3fc7d | 2006-11-01 22:23:58 -0500 | [diff] [blame] | 21 | |
| 22 | #include "toys.h" |
| 23 | |
Rob Landley | 7c04f01 | 2008-01-20 19:00:16 -0600 | [diff] [blame] | 24 | // Hello doesn't use these globals, they're here for example/skeleton purposes. |
| 25 | |
| 26 | DEFINE_GLOBALS( |
| 27 | char *b_string; |
| 28 | long c_number; |
| 29 | struct arg_list *d_list; |
| 30 | long e_count; |
| 31 | |
| 32 | int more_globals; |
| 33 | ) |
| 34 | |
| 35 | #define TT this.hello |
| 36 | |
Rob Landley | efda21c | 2007-11-29 18:14:37 -0600 | [diff] [blame] | 37 | void hello_main(void) |
Rob Landley | 9b3fc7d | 2006-11-01 22:23:58 -0500 | [diff] [blame] | 38 | { |
| 39 | printf("Hello world\n"); |
Rob Landley | 9b3fc7d | 2006-11-01 22:23:58 -0500 | [diff] [blame] | 40 | } |