projects
/
icmpmonitor
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fc42886
)
Updated main() with a few comments to illustrate high level flow.
author
Aaron Taylor
<ataylor@subgeniuskitty.com>
Mon, 7 Oct 2019 11:23:59 +0000
(
04:23
-0700)
committer
Aaron Taylor
<ataylor@subgeniuskitty.com>
Mon, 7 Oct 2019 11:23:59 +0000
(
04:23
-0700)
icmpmonitor.c
patch
|
blob
|
blame
|
history
diff --git
a/icmpmonitor.c
b/icmpmonitor.c
index
f7e4a47
..
5dd5064
100644
(file)
--- a/
icmpmonitor.c
+++ b/
icmpmonitor.c
@@
-432,6
+432,7
@@
parse_params(int argc, char ** argv)
}
if (first_host_in_list == NULL) {
fprintf(stderr, "ERROR: Unable to parse a config file.\n");
}
if (first_host_in_list == NULL) {
fprintf(stderr, "ERROR: Unable to parse a config file.\n");
+ print_usage(argv);
exit(EXIT_FAILURE);
}
}
exit(EXIT_FAILURE);
}
}
@@
-439,14
+440,22
@@
parse_params(int argc, char ** argv)
int
main(int argc, char ** argv)
{
int
main(int argc, char ** argv)
{
+ /* Parse the command line options, load and parse the config file. */
parse_params(argc, argv);
parse_params(argc, argv);
+ /* Process config for each host, generating/verifying any necessary information. */
init_hosts();
init_hosts();
+ /* Make sure initialization left us with something useful. */
+ assert(first_host_in_list);
+
+ /* Pings are sent asynchronously. */
signal(SIGALRM, pinger);
alarm(TIMER_RESOLUTION);
signal(SIGALRM, pinger);
alarm(TIMER_RESOLUTION);
+ /* The main program loop listens for ping responses. */
get_response();
get_response();
+ /* Should be unreachable. */
exit(EXIT_SUCCESS);
}
exit(EXIT_SUCCESS);
}