1 /* hello.c - A hello world program. (Simple template for new commands.) 2 * 3 * Copyright 2012 Rob Landley <rob@landley.net> 4 * 5 * See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ 6 * See http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/cmdbehav.html 7 8 USE_HELLO(NEWTOY(hello, 0, TOYFLAG_USR|TOYFLAG_BIN)) 9 10 config HELLO 11 bool "hello" 12 default n 13 help 14 usage: hello [-s] 15 16 A hello world program. You don't need this. 17 18 Mostly used as a simple template for adding new commands. 19 Occasionally nice to smoketest kernel booting via "init=/usr/bin/hello". 20 */ 21 22 #define FOR_hello 23 #include "toys.h" 24 GLOBALS(int unused;)25GLOBALS( 26 int unused; 27 ) 28 29 void hello_main(void) 30 { 31 xprintf("Hello world\n"); 32 33 // Avoid kernel panic if run as init. 34 if (getpid() == 1) wait(&TT.unused); 35 } 36