summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2023-10-18 15:15:19 (GMT)
committerRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2023-10-18 15:15:19 (GMT)
commitc849536609fbee9ab95d7db2bef23009327c1b9f (patch)
tree0d8d9cd95027c891bd0881322b4159507ca836de
parenta7e494192d222015bc098bfc3c7ed71e2e801590 (diff)
downloadmonitoring-plugins-c849536609fbee9ab95d7db2bef23009327c1b9f.tar.gz
check_ntp_time: Use C99 booleans
-rw-r--r--plugins/check_ntp_time.c19
1 files changed, 9 insertions, 10 deletions
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";
44 44
45static char *server_address=NULL; 45static char *server_address=NULL;
46static char *port="123"; 46static char *port="123";
47static int verbose=0; 47static bool verbose = false;
48static int quiet=0; 48static bool quiet = false;
49static char *owarn="60"; 49static char *owarn="60";
50static char *ocrit="120"; 50static char *ocrit="120";
51static int time_offset=0; 51static int time_offset=0;
@@ -485,7 +485,7 @@ int process_arguments(int argc, char **argv){
485 verbose++; 485 verbose++;
486 break; 486 break;
487 case 'q': 487 case 'q':
488 quiet = 1; 488 quiet = true;
489 break; 489 break;
490 case 'w': 490 case 'w':
491 owarn = optarg; 491 owarn = optarg;
@@ -494,7 +494,7 @@ int process_arguments(int argc, char **argv){
494 ocrit = optarg; 494 ocrit = optarg;
495 break; 495 break;
496 case 'H': 496 case 'H':
497 if(is_host(optarg) == FALSE) 497 if(!is_host(optarg))
498 usage2(_("Invalid hostname/address"), optarg); 498 usage2(_("Invalid hostname/address"), optarg);
499 server_address = strdup(optarg); 499 server_address = strdup(optarg);
500 break; 500 break;
@@ -506,7 +506,7 @@ int process_arguments(int argc, char **argv){
506 break; 506 break;
507 case 'o': 507 case 'o':
508 time_offset=atoi(optarg); 508 time_offset=atoi(optarg);
509 break; 509 break;
510 case '4': 510 case '4':
511 address_family = AF_INET; 511 address_family = AF_INET;
512 break; 512 break;
@@ -534,9 +534,9 @@ int process_arguments(int argc, char **argv){
534char *perfd_offset (double offset) 534char *perfd_offset (double offset)
535{ 535{
536 return fperfdata ("offset", offset, "s", 536 return fperfdata ("offset", offset, "s",
537 TRUE, offset_thresholds->warning->end, 537 true, offset_thresholds->warning->end,
538 TRUE, offset_thresholds->critical->end, 538 true, offset_thresholds->critical->end,
539 FALSE, 0, FALSE, 0); 539 false, 0, false, 0);
540} 540}
541 541
542int main(int argc, char *argv[]){ 542int main(int argc, char *argv[]){
@@ -566,7 +566,7 @@ int main(int argc, char *argv[]){
566 566
567 offset = offset_request(server_address, &offset_result); 567 offset = offset_request(server_address, &offset_result);
568 if (offset_result == STATE_UNKNOWN) { 568 if (offset_result == STATE_UNKNOWN) {
569 result = (quiet == 1 ? STATE_UNKNOWN : STATE_CRITICAL); 569 result = (quiet ? STATE_UNKNOWN : STATE_CRITICAL);
570 } else { 570 } else {
571 result = get_status(fabs(offset), offset_thresholds); 571 result = get_status(fabs(offset), offset_thresholds);
572 } 572 }
@@ -651,4 +651,3 @@ print_usage(void)
651 printf ("%s\n", _("Usage:")); 651 printf ("%s\n", _("Usage:"));
652 printf(" %s -H <host> [-4|-6] [-w <warn>] [-c <crit>] [-v verbose] [-o <time offset>]\n", progname); 652 printf(" %s -H <host> [-4|-6] [-w <warn>] [-c <crit>] [-v verbose] [-o <time offset>]\n", progname);
653} 653}
654