-
-static monitor_host_t **hosts = NULL;
-static int isDaemon = 0;
-static int isVerbose = 0;
-static int keepBanging = 0;
-static unsigned short ident;
-static int send_delay = 1;
-
-int main(int ac, char **av)
-{
- extern char* optarg;
- extern int optind;
- char *cfgfile=NULL;
- int param;
-
- logopen();
- log(LOG_INFO, VERSION " is starting.");
-
- while((param = getopt(ac, av, "rvdf:")) != -1)
- switch(param)
- {
- case 'v':
- isVerbose = 1;
- break;
- case 'd':
- isDaemon = 1;
- break;
- case 'r':
- keepBanging = 1;
- break;
- case 'f':
- cfgfile=strdup(optarg);
- break;
- default:
- fprintf(stderr,"Usage: icmpmonitor [-d] [-v] [-r] [-f cfgfile]\n");
- done(RET_BAD_OPT);
- }
-
- if(!cfgfile)
- {
- log(LOG_WARNING,"No cfg file specified. Assuming 'icmpmonitor.cfg'");
- cfgfile="icmpmonitor.cfg";
- }
-
- read_hosts(cfgfile); /* we do this before becoming daemon,
- to be able process relative path */
-
- if(isDaemon)
- start_daemon();
-
- init_hosts();
-
- ident=getpid() & 0xFFFF;
-
- (void)signal(SIGALRM, pinger);
- alarm(send_delay);
-
- get_response();
-
- done(RET_OK);
-}
-
+static struct monitor_host ** hosts = NULL;
+static bool verbose = false;
+static int keepBanging = 0;
+static int send_delay = 1;