diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-10-18 15:29:43 (GMT) |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-10-18 15:29:43 (GMT) |
commit | 47d3e156c5fd6db7da8fd25ca23135c34cf09ab5 (patch) | |
tree | b9c4e5c7bcaf1f0fa06c87ac3b983c99f4dc95e1 /plugins | |
parent | 9274b6db8b4c60d50fc65187cb794fd144dbc9e1 (diff) | |
download | monitoring-plugins-47d3e156c5fd6db7da8fd25ca23135c34cf09ab5.tar.gz |
check_ping: Use C99 booleans
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_ping.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/plugins/check_ping.c b/plugins/check_ping.c index 741f732..6e162e6 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c | |||
@@ -55,7 +55,7 @@ int error_scan (char buf[MAX_INPUT_BUFFER], const char *addr); | |||
55 | void print_usage (void); | 55 | void print_usage (void); |
56 | void print_help (void); | 56 | void print_help (void); |
57 | 57 | ||
58 | int display_html = FALSE; | 58 | bool display_html = false; |
59 | int wpl = UNKNOWN_PACKET_LOSS; | 59 | int wpl = UNKNOWN_PACKET_LOSS; |
60 | int cpl = UNKNOWN_PACKET_LOSS; | 60 | int cpl = UNKNOWN_PACKET_LOSS; |
61 | float wrta = UNKNOWN_TRIP_TIME; | 61 | float wrta = UNKNOWN_TRIP_TIME; |
@@ -153,7 +153,7 @@ main (int argc, char **argv) | |||
153 | if (n_addresses > 1 && this_result != STATE_UNKNOWN) | 153 | if (n_addresses > 1 && this_result != STATE_UNKNOWN) |
154 | die (STATE_OK, "%s is alive\n", addresses[i]); | 154 | die (STATE_OK, "%s is alive\n", addresses[i]); |
155 | 155 | ||
156 | if (display_html == TRUE) | 156 | if (display_html == true) |
157 | printf ("<A HREF='%s/traceroute.cgi?%s'>", CGIURL, addresses[i]); | 157 | printf ("<A HREF='%s/traceroute.cgi?%s'>", CGIURL, addresses[i]); |
158 | if (pl == 100) | 158 | if (pl == 100) |
159 | printf (_("PING %s - %sPacket loss = %d%%"), state_text (this_result), warn_text, | 159 | printf (_("PING %s - %sPacket loss = %d%%"), state_text (this_result), warn_text, |
@@ -161,22 +161,22 @@ main (int argc, char **argv) | |||
161 | else | 161 | else |
162 | printf (_("PING %s - %sPacket loss = %d%%, RTA = %2.2f ms"), | 162 | printf (_("PING %s - %sPacket loss = %d%%, RTA = %2.2f ms"), |
163 | state_text (this_result), warn_text, pl, rta); | 163 | state_text (this_result), warn_text, pl, rta); |
164 | if (display_html == TRUE) | 164 | if (display_html == true) |
165 | printf ("</A>"); | 165 | printf ("</A>"); |
166 | 166 | ||
167 | /* Print performance data */ | 167 | /* Print performance data */ |
168 | if (pl != 100) { | 168 | if (pl != 100) { |
169 | printf("|%s", fperfdata ("rta", (double) rta, "ms", | 169 | printf("|%s", fperfdata ("rta", (double) rta, "ms", |
170 | wrta>0?TRUE:FALSE, wrta, | 170 | wrta>0?true:false, wrta, |
171 | crta>0?TRUE:FALSE, crta, | 171 | crta>0?true:false, crta, |
172 | TRUE, 0, FALSE, 0)); | 172 | true, 0, false, 0)); |
173 | } else { | 173 | } else { |
174 | printf("| rta=U;%f;%f;;", wrta, crta); | 174 | printf("| rta=U;%f;%f;;", wrta, crta); |
175 | } | 175 | } |
176 | printf(" %s\n", perfdata ("pl", (long) pl, "%", | 176 | printf(" %s\n", perfdata ("pl", (long) pl, "%", |
177 | wpl>0?TRUE:FALSE, wpl, | 177 | wpl>0?true:false, wpl, |
178 | cpl>0?TRUE:FALSE, cpl, | 178 | cpl>0?true:false, cpl, |
179 | TRUE, 0, FALSE, 0)); | 179 | true, 0, false, 0)); |
180 | 180 | ||
181 | if (verbose >= 2) | 181 | if (verbose >= 2) |
182 | printf ("%f:%d%% %f:%d%%\n", wrta, wpl, crta, cpl); | 182 | printf ("%f:%d%% %f:%d%%\n", wrta, wpl, crta, cpl); |
@@ -278,10 +278,10 @@ process_arguments (int argc, char **argv) | |||
278 | usage2 (_("<max_packets> (%s) must be a non-negative number\n"), optarg); | 278 | usage2 (_("<max_packets> (%s) must be a non-negative number\n"), optarg); |
279 | break; | 279 | break; |
280 | case 'n': /* no HTML */ | 280 | case 'n': /* no HTML */ |
281 | display_html = FALSE; | 281 | display_html = false; |
282 | break; | 282 | break; |
283 | case 'L': /* show HTML */ | 283 | case 'L': /* show HTML */ |
284 | display_html = TRUE; | 284 | display_html = true; |
285 | break; | 285 | break; |
286 | case 'c': | 286 | case 'c': |
287 | get_threshold (optarg, &crta, &cpl); | 287 | get_threshold (optarg, &crta, &cpl); |
@@ -297,7 +297,7 @@ process_arguments (int argc, char **argv) | |||
297 | return validate_arguments (); | 297 | return validate_arguments (); |
298 | 298 | ||
299 | if (addresses[0] == NULL) { | 299 | if (addresses[0] == NULL) { |
300 | if (is_host (argv[c]) == FALSE) { | 300 | if (!is_host (argv[c])) { |
301 | usage2 (_("Invalid hostname/address"), argv[c]); | 301 | usage2 (_("Invalid hostname/address"), argv[c]); |
302 | } else { | 302 | } else { |
303 | addresses[0] = argv[c++]; | 303 | addresses[0] = argv[c++]; |
@@ -308,7 +308,7 @@ process_arguments (int argc, char **argv) | |||
308 | } | 308 | } |
309 | 309 | ||
310 | if (wpl == UNKNOWN_PACKET_LOSS) { | 310 | if (wpl == UNKNOWN_PACKET_LOSS) { |
311 | if (is_intpercent (argv[c]) == FALSE) { | 311 | if (!is_intpercent (argv[c])) { |
312 | printf (_("<wpl> (%s) must be an integer percentage\n"), argv[c]); | 312 | printf (_("<wpl> (%s) must be an integer percentage\n"), argv[c]); |
313 | return ERROR; | 313 | return ERROR; |
314 | } else { | 314 | } else { |
@@ -319,7 +319,7 @@ process_arguments (int argc, char **argv) | |||
319 | } | 319 | } |
320 | 320 | ||
321 | if (cpl == UNKNOWN_PACKET_LOSS) { | 321 | if (cpl == UNKNOWN_PACKET_LOSS) { |
322 | if (is_intpercent (argv[c]) == FALSE) { | 322 | if (!is_intpercent (argv[c])) { |
323 | printf (_("<cpl> (%s) must be an integer percentage\n"), argv[c]); | 323 | printf (_("<cpl> (%s) must be an integer percentage\n"), argv[c]); |
324 | return ERROR; | 324 | return ERROR; |
325 | } else { | 325 | } else { |
@@ -420,7 +420,7 @@ validate_arguments () | |||
420 | timeout_interval = (int)max_seconds; | 420 | timeout_interval = (int)max_seconds; |
421 | 421 | ||
422 | for (i=0; i<n_addresses; i++) { | 422 | for (i=0; i<n_addresses; i++) { |
423 | if (is_host(addresses[i]) == FALSE) | 423 | if (!is_host(addresses[i])) |
424 | usage2 (_("Invalid hostname/address"), addresses[i]); | 424 | usage2 (_("Invalid hostname/address"), addresses[i]); |
425 | } | 425 | } |
426 | 426 | ||