diff options
author | Danijel Tasov <m@rbfh.de> | 2023-10-06 10:51:27 +0200 |
---|---|---|
committer | Danijel Tasov <m@rbfh.de> | 2023-10-06 10:54:03 +0200 |
commit | e365f9f58eed501baf1a80c47556191a48b99c3f (patch) | |
tree | 4e20de817c04f9697299d0916ad5ae47120cbc29 /plugins-root | |
parent | 9280b0eee22b9d4272b469d6ca0f7373d2aef67e (diff) | |
download | monitoring-plugins-e365f9f58eed501baf1a80c47556191a48b99c3f.tar.gz |
do not introduce new ints as bools
Diffstat (limited to 'plugins-root')
-rw-r--r-- | plugins-root/check_icmp.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index 0401788c..274277b7 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c | |||
@@ -242,12 +242,12 @@ static unsigned int warn_down = 1, crit_down = 1; /* host down threshold values | |||
242 | static int min_hosts_alive = -1; | 242 | static int min_hosts_alive = -1; |
243 | float pkt_backoff_factor = 1.5; | 243 | float pkt_backoff_factor = 1.5; |
244 | float target_backoff_factor = 1.5; | 244 | float target_backoff_factor = 1.5; |
245 | int rta_mode=0; | 245 | bool rta_mode=false; |
246 | int pl_mode=0; | 246 | bool pl_mode=false; |
247 | int jitter_mode=0; | 247 | bool jitter_mode=false; |
248 | int score_mode=0; | 248 | bool score_mode=false; |
249 | int mos_mode=0; | 249 | bool mos_mode=false; |
250 | int order_mode=0; | 250 | bool order_mode=false; |
251 | 251 | ||
252 | /** code start **/ | 252 | /** code start **/ |
253 | static void | 253 | static void |
@@ -582,26 +582,26 @@ main(int argc, char **argv) | |||
582 | break; | 582 | break; |
583 | case 'R': /* RTA mode */ | 583 | case 'R': /* RTA mode */ |
584 | get_threshold2(optarg, &warn, &crit,1); | 584 | get_threshold2(optarg, &warn, &crit,1); |
585 | rta_mode=1; | 585 | rta_mode=true; |
586 | break; | 586 | break; |
587 | case 'P': /* packet loss mode */ | 587 | case 'P': /* packet loss mode */ |
588 | get_threshold2(optarg, &warn, &crit,2); | 588 | get_threshold2(optarg, &warn, &crit,2); |
589 | pl_mode=1; | 589 | pl_mode=true; |
590 | break; | 590 | break; |
591 | case 'J': /* jitter mode */ | 591 | case 'J': /* jitter mode */ |
592 | get_threshold2(optarg, &warn, &crit,3); | 592 | get_threshold2(optarg, &warn, &crit,3); |
593 | jitter_mode=1; | 593 | jitter_mode=true; |
594 | break; | 594 | break; |
595 | case 'M': /* MOS mode */ | 595 | case 'M': /* MOS mode */ |
596 | get_threshold2(optarg, &warn, &crit,4); | 596 | get_threshold2(optarg, &warn, &crit,4); |
597 | mos_mode=1; | 597 | mos_mode=true; |
598 | break; | 598 | break; |
599 | case 'S': /* score mode */ | 599 | case 'S': /* score mode */ |
600 | get_threshold2(optarg, &warn, &crit,5); | 600 | get_threshold2(optarg, &warn, &crit,5); |
601 | score_mode=1; | 601 | score_mode=true; |
602 | break; | 602 | break; |
603 | case 'O': /* out of order mode */ | 603 | case 'O': /* out of order mode */ |
604 | order_mode=1; | 604 | order_mode=true; |
605 | break; | 605 | break; |
606 | } | 606 | } |
607 | } | 607 | } |
@@ -758,6 +758,7 @@ main(int argc, char **argv) | |||
758 | 758 | ||
759 | host = list; | 759 | host = list; |
760 | table = malloc(sizeof(struct rta_host *) * targets); | 760 | table = malloc(sizeof(struct rta_host *) * targets); |
761 | |||
761 | i = 0; | 762 | i = 0; |
762 | while(host) { | 763 | while(host) { |
763 | host->id = i*packets; | 764 | host->id = i*packets; |
@@ -1831,7 +1832,8 @@ get_threshold(char *str, threshold *th) | |||
1831 | static int | 1832 | static int |
1832 | get_threshold2(char *str, threshold *warn, threshold *crit, int type) | 1833 | get_threshold2(char *str, threshold *warn, threshold *crit, int type) |
1833 | { | 1834 | { |
1834 | char *p = NULL, i = 0; | 1835 | char *p = NULL; |
1836 | bool i = false; | ||
1835 | 1837 | ||
1836 | if(!str || !strlen(str) || !warn || !crit) return -1; | 1838 | if(!str || !strlen(str) || !warn || !crit) return -1; |
1837 | /* pointer magic slims code by 10 lines. i is bof-stop on stupid libc's */ | 1839 | /* pointer magic slims code by 10 lines. i is bof-stop on stupid libc's */ |
@@ -1851,7 +1853,7 @@ get_threshold2(char *str, threshold *warn, threshold *crit, int type) | |||
1851 | else if (type==5) | 1853 | else if (type==5) |
1852 | crit->score = atof(p+1); | 1854 | crit->score = atof(p+1); |
1853 | } | 1855 | } |
1854 | i = 1; | 1856 | i = true; |
1855 | p--; | 1857 | p--; |
1856 | } | 1858 | } |
1857 | if (type==1) | 1859 | if (type==1) |