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