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 * See https://www.ietf.org/rfc/rfc3.txt 8 9 USE_HELLO(NEWTOY(hello, 0, TOYFLAG_USR|TOYFLAG_BIN)) 10 11 config HELLO 12 bool "hello" 13 default n 14 help 15 usage: hello 16 17 A hello world program. 18 19 Mostly used as a simple template for adding new commands. 20 Occasionally nice to smoketest kernel booting via "init=/usr/bin/hello". 21 */ 22 23 #define FOR_hello 24 #include "toys.h" 25 GLOBALS(int unused;)26GLOBALS( 27 int unused; 28 ) 29 30 void hello_main(void) 31 { 32 xprintf("Hello world\n"); 33 34 // Avoid kernel panic if run as init. 35 if (getpid() == 1) wait(&TT.unused); 36 } 37