void web_setup( void ) { int sock; if( str_isZero( gconf->web_port ) ) { return; } sock = net_bind( "WEB", "localhost", gconf->web_port, NULL, IPPROTO_TCP, AF_UNSPEC ); net_add_handler( sock, &web_handler ); }
void cmd_setup( void ) { int sock; if( str_isZero( gconf->cmd_port ) ) { return; } sock = net_bind( "CMD", "::1", gconf->cmd_port, NULL, IPPROTO_UDP, AF_INET6 ); net_add_handler( sock, &cmd_remote_handler ); if( gconf->is_daemon == 0 && gconf->cmd_disable_stdin == 0 ) { /* Wait for other messages to be displayed */ sleep( 1 ); fprintf( stdout, "Press Enter for help.\n" ); net_add_handler( STDIN_FILENO, &cmd_console_handler ); } }