int pid, fd, status;
int pid, fd;
void daemonize(){	int pid, fd, status;	pid = fork();	switch ( pid )	{	case 0:		// child		setsid();		if ( ( fd = open( "/dev/null", O_RDWR ) ) != -1 )		{			dup2( fd, 0 );			dup2( fd, 1 );			close( fd );		}		break;	case -1:		perror( "fork" );		break;	default:		// we forked, so silently exit the parent		exit( 0 );	}}