3 # Pass the syslog config file though m4
5 require './syslog-lib.pl';
8 # is this loghost? Find out by sending a UDP packet to it
9 socket(UDP, PF_INET, SOCK_DGRAM, getprotobyname("udp"));
10 setsockopt(UDP, SOL_SOCKET, SO_BROADCAST, pack("l", 1));
12 while(!bind(UDP, pack_sockaddr_in($port, INADDR_ANY))) {
15 send(UDP, "foo", 0, pack_sockaddr_in($port, inet_aton("loghost")));
16 vec($rin, fileno(UDP), 1) = 1;
17 if (select($rin, undef, undef, 1)) {
18 $args .= " -DLOGHOST";
25 open(CONF, "$config{'m4_path'} $args $config{'syslog_conf'} |");
28 &open_tempfile(CONF, ">$config{'syslog_conf'}");
29 &print_tempfile(CONF, $conf);
30 &close_tempfile(CONF);