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:
91f6914
)
Changed `int isVerbose` global to `bool verbose`.
author
Aaron Taylor
<ataylor@subgeniuskitty.com>
Sat, 21 Sep 2019 09:43:04 +0000
(
02:43
-0700)
committer
Aaron Taylor
<ataylor@subgeniuskitty.com>
Sat, 21 Sep 2019 09:43:04 +0000
(
02:43
-0700)
icmpmonitor.c
patch
|
blob
|
blame
|
history
diff --git
a/icmpmonitor.c
b/icmpmonitor.c
index
36a1ce6
..
365192f
100644
(file)
--- a/
icmpmonitor.c
+++ b/
icmpmonitor.c
@@
-52,7
+52,7
@@
struct monitor_host {
/* globals */
static struct monitor_host ** hosts = NULL;
/* globals */
static struct monitor_host ** hosts = NULL;
-static
int isVerbose = 0
;
+static
bool verbose = false
;
static int keepBanging = 0;
static int send_delay = 1;
static int keepBanging = 0;
static int send_delay = 1;
@@
-130,7
+130,7
@@
pinger(int ignore)
if (now.tv_sec > (p->max_delay + p->ping_interval)) {
if ((p->hostup) || keepBanging) {
if (now.tv_sec > (p->max_delay + p->ping_interval)) {
if ((p->hostup) || keepBanging) {
- if (
isV
erbose) printf("INFO: Host %s stopped responding. Executing DOWN command.\n", p->name);
+ if (
v
erbose) printf("INFO: Host %s stopped responding. Executing DOWN command.\n", p->name);
p->hostup = false;
if (!fork()) {
system(p->downcmd);
p->hostup = false;
if (!fork()) {
system(p->downcmd);
@@
-152,7
+152,7
@@
pinger(int ignore)
icp->icmp_seq = p->socket;
icp->icmp_id = getpid() & 0xFFFF;
icp->icmp_seq = p->socket;
icp->icmp_id = getpid() & 0xFFFF;
- if (
isV
erbose) printf("INFO: Sending ICMP packet to %s.\n", p->name);
+ if (
v
erbose) printf("INFO: Sending ICMP packet to %s.\n", p->name);
gettimeofday((struct timeval *) &outpack[8], (struct timezone *) NULL);
gettimeofday((struct timeval *) &outpack[8], (struct timezone *) NULL);
@@
-215,9
+215,9
@@
read_icmp_data(struct monitor_host * p)
tvsub(&tv, (struct timeval *) &icmp->icmp_data[0]);
delay = tv.tv_sec * 1000 + (tv.tv_usec / 1000);
tvsub(&tv, (struct timeval *) &icmp->icmp_data[0]);
delay = tv.tv_sec * 1000 + (tv.tv_usec / 1000);
- if (
isV
erbose) printf("INFO: Got ICMP reply from %s in %d ms.\n", p->name, delay);
+ if (
v
erbose) printf("INFO: Got ICMP reply from %s in %d ms.\n", p->name, delay);
if (!p->hostup) {
if (!p->hostup) {
- if (
isV
erbose) printf("INFO: Host %s started responding. Executing UP command.\n", p->name);
+ if (
v
erbose) printf("INFO: Host %s started responding. Executing UP command.\n", p->name);
p->hostup = true;
if (!fork()) {
system(p->upcmd);
p->hostup = true;
if (!fork()) {
system(p->upcmd);
@@
-397,7
+397,7
@@
main(int argc, char ** argv)
while ((param = getopt(argc, argv, "rvf:")) != -1) {
switch(param) {
case 'v':
while ((param = getopt(argc, argv, "rvf:")) != -1) {
switch(param) {
case 'v':
-
isVerbose = 1
;
+
verbose = true
;
break;
case 'r':
keepBanging = 1;
break;
case 'r':
keepBanging = 1;