1 /* hello.c - A hello world program. (Simple template for new commands.) 2 * 3 * Copyright 2012 Rob Landley <[email protected]> 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 * See https://man7.org/linux/man-pages/man1/intro.1.html 9 * No standard. 10 11 USE_HELLO(NEWTOY(hello, 0, TOYFLAG_USR|TOYFLAG_BIN)) 12 13 config HELLO 14 bool "hello" 15 default n 16 help 17 usage: hello 18 19 A hello world program. 20 21 Mostly used as a simple template for adding new commands. 22 Occasionally nice to smoketest kernel booting via "init=/usr/bin/hello". 23 */ 24 25 #define FOR_hello 26 #include "toys.h" 27 GLOBALS(int unused;)28GLOBALS( 29 int unused; 30 ) 31 32 void hello_main(void) 33 { 34 xprintf("Hello world\n"); 35 36 // Avoid kernel panic if run as init. 37 if (getpid() == 1) getchar(); 38 } 39