From c849536609fbee9ab95d7db2bef23009327c1b9f Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Wed, 18 Oct 2023 17:15:19 +0200 Subject: check_ntp_time: Use C99 booleans diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c index 46cc604..d19b3e4 100644 --- a/plugins/check_ntp_time.c +++ b/plugins/check_ntp_time.c @@ -44,8 +44,8 @@ const char *email = "devel@monitoring-plugins.org"; static char *server_address=NULL; static char *port="123"; -static int verbose=0; -static int quiet=0; +static bool verbose = false; +static bool quiet = false; static char *owarn="60"; static char *ocrit="120"; static int time_offset=0; @@ -485,7 +485,7 @@ int process_arguments(int argc, char **argv){ verbose++; break; case 'q': - quiet = 1; + quiet = true; break; case 'w': owarn = optarg; @@ -494,7 +494,7 @@ int process_arguments(int argc, char **argv){ ocrit = optarg; break; case 'H': - if(is_host(optarg) == FALSE) + if(!is_host(optarg)) usage2(_("Invalid hostname/address"), optarg); server_address = strdup(optarg); break; @@ -506,7 +506,7 @@ int process_arguments(int argc, char **argv){ break; case 'o': time_offset=atoi(optarg); - break; + break; case '4': address_family = AF_INET; break; @@ -534,9 +534,9 @@ int process_arguments(int argc, char **argv){ char *perfd_offset (double offset) { return fperfdata ("offset", offset, "s", - TRUE, offset_thresholds->warning->end, - TRUE, offset_thresholds->critical->end, - FALSE, 0, FALSE, 0); + true, offset_thresholds->warning->end, + true, offset_thresholds->critical->end, + false, 0, false, 0); } int main(int argc, char *argv[]){ @@ -566,7 +566,7 @@ int main(int argc, char *argv[]){ offset = offset_request(server_address, &offset_result); if (offset_result == STATE_UNKNOWN) { - result = (quiet == 1 ? STATE_UNKNOWN : STATE_CRITICAL); + result = (quiet ? STATE_UNKNOWN : STATE_CRITICAL); } else { result = get_status(fabs(offset), offset_thresholds); } @@ -651,4 +651,3 @@ print_usage(void) printf ("%s\n", _("Usage:")); printf(" %s -H [-4|-6] [-w ] [-c ] [-v verbose] [-o