diff options
Diffstat (limited to 'plugins')
36 files changed, 554 insertions, 601 deletions
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index 1ad547ed..1f5f72d4 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c | |||
| @@ -50,7 +50,7 @@ unsigned int services = 0; | |||
| 50 | int skip_stdout = 0; | 50 | int skip_stdout = 0; |
| 51 | int skip_stderr = 0; | 51 | int skip_stderr = 0; |
| 52 | int warn_on_stderr = 0; | 52 | int warn_on_stderr = 0; |
| 53 | bool unknown_timeout = FALSE; | 53 | bool unknown_timeout = false; |
| 54 | char *remotecmd = NULL; | 54 | char *remotecmd = NULL; |
| 55 | char **commargv = NULL; | 55 | char **commargv = NULL; |
| 56 | int commargc = 0; | 56 | int commargc = 0; |
| @@ -58,8 +58,8 @@ char *hostname = NULL; | |||
| 58 | char *outputfile = NULL; | 58 | char *outputfile = NULL; |
| 59 | char *host_shortname = NULL; | 59 | char *host_shortname = NULL; |
| 60 | char **service; | 60 | char **service; |
| 61 | int passive = FALSE; | 61 | bool passive = false; |
| 62 | int verbose = FALSE; | 62 | bool verbose = false; |
| 63 | 63 | ||
| 64 | int | 64 | int |
| 65 | main (int argc, char **argv) | 65 | main (int argc, char **argv) |
| @@ -235,7 +235,7 @@ process_arguments (int argc, char **argv) | |||
| 235 | print_help (); | 235 | print_help (); |
| 236 | exit (STATE_UNKNOWN); | 236 | exit (STATE_UNKNOWN); |
| 237 | case 'v': /* help */ | 237 | case 'v': /* help */ |
| 238 | verbose = TRUE; | 238 | verbose = true; |
| 239 | break; | 239 | break; |
| 240 | case 't': /* timeout period */ | 240 | case 't': /* timeout period */ |
| 241 | if (!is_integer (optarg)) | 241 | if (!is_integer (optarg)) |
| @@ -244,7 +244,7 @@ process_arguments (int argc, char **argv) | |||
| 244 | timeout_interval = atoi (optarg); | 244 | timeout_interval = atoi (optarg); |
| 245 | break; | 245 | break; |
| 246 | case 'U': | 246 | case 'U': |
| 247 | unknown_timeout = TRUE; | 247 | unknown_timeout = true; |
| 248 | break; | 248 | break; |
| 249 | case 'H': /* host */ | 249 | case 'H': /* host */ |
| 250 | hostname = optarg; | 250 | hostname = optarg; |
| @@ -257,7 +257,7 @@ process_arguments (int argc, char **argv) | |||
| 257 | break; | 257 | break; |
| 258 | case 'O': /* output file */ | 258 | case 'O': /* output file */ |
| 259 | outputfile = optarg; | 259 | outputfile = optarg; |
| 260 | passive = TRUE; | 260 | passive = true; |
| 261 | break; | 261 | break; |
| 262 | case 's': /* description of service to check */ | 262 | case 's': /* description of service to check */ |
| 263 | p1 = optarg; | 263 | p1 = optarg; |
diff --git a/plugins/check_dig.c b/plugins/check_dig.c index 5d85ae26..be7a6101 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c | |||
| @@ -56,7 +56,7 @@ char *expected_address = NULL; | |||
| 56 | char *dns_server = NULL; | 56 | char *dns_server = NULL; |
| 57 | char *dig_args = ""; | 57 | char *dig_args = ""; |
| 58 | char *query_transport = ""; | 58 | char *query_transport = ""; |
| 59 | int verbose = FALSE; | 59 | bool verbose = false; |
| 60 | int server_port = DEFAULT_PORT; | 60 | int server_port = DEFAULT_PORT; |
| 61 | int number_tries = DEFAULT_TRIES; | 61 | int number_tries = DEFAULT_TRIES; |
| 62 | double warning_interval = UNDEFINED; | 62 | double warning_interval = UNDEFINED; |
| @@ -176,11 +176,11 @@ main (int argc, char **argv) | |||
| 176 | state_text (result), elapsed_time, | 176 | state_text (result), elapsed_time, |
| 177 | msg ? msg : _("Probably a non-existent host/domain"), | 177 | msg ? msg : _("Probably a non-existent host/domain"), |
| 178 | fperfdata("time", elapsed_time, "s", | 178 | fperfdata("time", elapsed_time, "s", |
| 179 | (warning_interval>UNDEFINED?TRUE:FALSE), | 179 | (warning_interval>UNDEFINED ? true:false), |
| 180 | warning_interval, | 180 | warning_interval, |
| 181 | (critical_interval>UNDEFINED?TRUE:FALSE), | 181 | (critical_interval>UNDEFINED ? true:false), |
| 182 | critical_interval, | 182 | critical_interval, |
| 183 | TRUE, 0, FALSE, 0)); | 183 | true, 0, false, 0)); |
| 184 | return result; | 184 | return result; |
| 185 | } | 185 | } |
| 186 | 186 | ||
| @@ -270,7 +270,7 @@ process_arguments (int argc, char **argv) | |||
| 270 | dig_args = strdup(optarg); | 270 | dig_args = strdup(optarg); |
| 271 | break; | 271 | break; |
| 272 | case 'v': /* verbose */ | 272 | case 'v': /* verbose */ |
| 273 | verbose = TRUE; | 273 | verbose = true; |
| 274 | break; | 274 | break; |
| 275 | case 'T': | 275 | case 'T': |
| 276 | record_type = optarg; | 276 | record_type = optarg; |
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 2f066c7b..a4180ca7 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
| @@ -135,12 +135,12 @@ char *exclude_device; | |||
| 135 | char *units; | 135 | char *units; |
| 136 | uintmax_t mult = 1024 * 1024; | 136 | uintmax_t mult = 1024 * 1024; |
| 137 | int verbose = 0; | 137 | int verbose = 0; |
| 138 | int erronly = FALSE; | 138 | bool erronly = false; |
| 139 | int display_mntp = FALSE; | 139 | bool display_mntp = false; |
| 140 | int exact_match = FALSE; | 140 | bool exact_match = false; |
| 141 | bool ignore_missing = false; | 141 | bool ignore_missing = false; |
| 142 | int freespace_ignore_reserved = FALSE; | 142 | bool freespace_ignore_reserved = false; |
| 143 | int display_inodes_perfdata = FALSE; | 143 | bool display_inodes_perfdata = false; |
| 144 | char *warn_freespace_units = NULL; | 144 | char *warn_freespace_units = NULL; |
| 145 | char *crit_freespace_units = NULL; | 145 | char *crit_freespace_units = NULL; |
| 146 | char *warn_freespace_percent = NULL; | 146 | char *warn_freespace_percent = NULL; |
| @@ -153,7 +153,7 @@ char *warn_usedinodes_percent = NULL; | |||
| 153 | char *crit_usedinodes_percent = NULL; | 153 | char *crit_usedinodes_percent = NULL; |
| 154 | char *warn_freeinodes_percent = NULL; | 154 | char *warn_freeinodes_percent = NULL; |
| 155 | char *crit_freeinodes_percent = NULL; | 155 | char *crit_freeinodes_percent = NULL; |
| 156 | int path_selected = FALSE; | 156 | bool path_selected = false; |
| 157 | bool path_ignored = false; | 157 | bool path_ignored = false; |
| 158 | char *group = NULL; | 158 | char *group = NULL; |
| 159 | struct stat *stat_buf; | 159 | struct stat *stat_buf; |
| @@ -205,7 +205,7 @@ main (int argc, char **argv) | |||
| 205 | /* If a list of paths has not been selected, find entire | 205 | /* If a list of paths has not been selected, find entire |
| 206 | mount list and create list of paths | 206 | mount list and create list of paths |
| 207 | */ | 207 | */ |
| 208 | if (path_selected == FALSE && path_ignored == false) { | 208 | if (path_selected == false && path_ignored == false) { |
| 209 | for (me = mount_list; me; me = me->me_next) { | 209 | for (me = mount_list; me; me = me->me_next) { |
| 210 | if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) { | 210 | if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) { |
| 211 | path = np_add_parameter(&path_select_list, me->me_mountdir); | 211 | path = np_add_parameter(&path_select_list, me->me_mountdir); |
| @@ -396,10 +396,10 @@ main (int argc, char **argv) | |||
| 396 | perfdata_uint64 ( | 396 | perfdata_uint64 ( |
| 397 | (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, | 397 | (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, |
| 398 | path->dused_units * mult, "B", | 398 | path->dused_units * mult, "B", |
| 399 | (warning_high_tide == UINT64_MAX ? FALSE : TRUE), warning_high_tide, | 399 | (warning_high_tide == UINT64_MAX ? false : true), warning_high_tide, |
| 400 | (critical_high_tide == UINT64_MAX ? FALSE : TRUE), critical_high_tide, | 400 | (critical_high_tide == UINT64_MAX ? false : true), critical_high_tide, |
| 401 | TRUE, 0, | 401 | true, 0, |
| 402 | TRUE, path->dtotal_units * mult)); | 402 | true, path->dtotal_units * mult)); |
| 403 | 403 | ||
| 404 | if (display_inodes_perfdata) { | 404 | if (display_inodes_perfdata) { |
| 405 | /* *_high_tide must be reinitialized at each run */ | 405 | /* *_high_tide must be reinitialized at each run */ |
| @@ -418,10 +418,10 @@ main (int argc, char **argv) | |||
| 418 | xasprintf (&perf, "%s %s", perf, | 418 | xasprintf (&perf, "%s %s", perf, |
| 419 | perfdata_uint64 (perf_ilabel, | 419 | perfdata_uint64 (perf_ilabel, |
| 420 | path->inodes_used, "", | 420 | path->inodes_used, "", |
| 421 | (warning_high_tide != UINT64_MAX ? TRUE : FALSE), warning_high_tide, | 421 | (warning_high_tide != UINT64_MAX ? true : false), warning_high_tide, |
| 422 | (critical_high_tide != UINT64_MAX ? TRUE : FALSE), critical_high_tide, | 422 | (critical_high_tide != UINT64_MAX ? true : false), critical_high_tide, |
| 423 | TRUE, 0, | 423 | true, 0, |
| 424 | TRUE, path->inodes_total)); | 424 | true, path->inodes_total)); |
| 425 | } | 425 | } |
| 426 | 426 | ||
| 427 | if (disk_result==STATE_OK && erronly && !verbose) | 427 | if (disk_result==STATE_OK && erronly && !verbose) |
| @@ -710,7 +710,7 @@ process_arguments (int argc, char **argv) | |||
| 710 | mount_list = read_file_system_list (0); | 710 | mount_list = read_file_system_list (0); |
| 711 | np_set_best_match(se, mount_list, exact_match); | 711 | np_set_best_match(se, mount_list, exact_match); |
| 712 | 712 | ||
| 713 | path_selected = TRUE; | 713 | path_selected = true; |
| 714 | break; | 714 | break; |
| 715 | case 'x': /* exclude path or partition */ | 715 | case 'x': /* exclude path or partition */ |
| 716 | np_add_name(&dp_exclude_list, optarg); | 716 | np_add_name(&dp_exclude_list, optarg); |
| @@ -734,18 +734,18 @@ process_arguments (int argc, char **argv) | |||
| 734 | break; | 734 | break; |
| 735 | case 'q': /* TODO: this function should eventually go away (removed 2007-09-20) */ | 735 | case 'q': /* TODO: this function should eventually go away (removed 2007-09-20) */ |
| 736 | /* verbose--; **replaced by line below**. -q was only a broken way of implementing -e */ | 736 | /* verbose--; **replaced by line below**. -q was only a broken way of implementing -e */ |
| 737 | erronly = TRUE; | 737 | erronly = true; |
| 738 | break; | 738 | break; |
| 739 | case 'e': | 739 | case 'e': |
| 740 | erronly = TRUE; | 740 | erronly = true; |
| 741 | break; | 741 | break; |
| 742 | case 'E': | 742 | case 'E': |
| 743 | if (path_selected) | 743 | if (path_selected) |
| 744 | die (STATE_UNKNOWN, "DISK %s: %s", _("UNKNOWN"), _("Must set -E before selecting paths\n")); | 744 | die (STATE_UNKNOWN, "DISK %s: %s", _("UNKNOWN"), _("Must set -E before selecting paths\n")); |
| 745 | exact_match = TRUE; | 745 | exact_match = true; |
| 746 | break; | 746 | break; |
| 747 | case 'f': | 747 | case 'f': |
| 748 | freespace_ignore_reserved = TRUE; | 748 | freespace_ignore_reserved = true; |
| 749 | break; | 749 | break; |
| 750 | case 'g': | 750 | case 'g': |
| 751 | if (path_selected) | 751 | if (path_selected) |
| @@ -817,7 +817,7 @@ process_arguments (int argc, char **argv) | |||
| 817 | 817 | ||
| 818 | for (me = mount_list; me; me = me->me_next) { | 818 | for (me = mount_list; me; me = me->me_next) { |
| 819 | if (np_regex_match_mount_entry(me, &re)) { | 819 | if (np_regex_match_mount_entry(me, &re)) { |
| 820 | fnd = TRUE; | 820 | fnd = true; |
| 821 | if (verbose >= 3) | 821 | if (verbose >= 3) |
| 822 | printf("%s %s matching expression %s\n", me->me_devname, me->me_mountdir, optarg); | 822 | printf("%s %s matching expression %s\n", me->me_devname, me->me_mountdir, optarg); |
| 823 | 823 | ||
| @@ -832,24 +832,24 @@ process_arguments (int argc, char **argv) | |||
| 832 | 832 | ||
| 833 | if (!fnd && ignore_missing == true) { | 833 | if (!fnd && ignore_missing == true) { |
| 834 | path_ignored = true; | 834 | path_ignored = true; |
| 835 | /* path_selected = TRUE;*/ | 835 | /* path_selected = true;*/ |
| 836 | break; | 836 | break; |
| 837 | } else if (!fnd) | 837 | } else if (!fnd) |
| 838 | die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), | 838 | die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), |
| 839 | _("Regular expression did not match any path or disk"), optarg); | 839 | _("Regular expression did not match any path or disk"), optarg); |
| 840 | 840 | ||
| 841 | fnd = FALSE; | 841 | fnd = false; |
| 842 | path_selected = TRUE; | 842 | path_selected = true; |
| 843 | np_set_best_match(path_select_list, mount_list, exact_match); | 843 | np_set_best_match(path_select_list, mount_list, exact_match); |
| 844 | cflags = default_cflags; | 844 | cflags = default_cflags; |
| 845 | 845 | ||
| 846 | break; | 846 | break; |
| 847 | case 'M': /* display mountpoint */ | 847 | case 'M': /* display mountpoint */ |
| 848 | display_mntp = TRUE; | 848 | display_mntp = true; |
| 849 | break; | 849 | break; |
| 850 | case 'C': | 850 | case 'C': |
| 851 | /* add all mount entries to path_select list if no partitions have been explicitly defined using -p */ | 851 | /* add all mount entries to path_select list if no partitions have been explicitly defined using -p */ |
| 852 | if (path_selected == FALSE) { | 852 | if (path_selected == false) { |
| 853 | struct parameter_list *path; | 853 | struct parameter_list *path; |
| 854 | for (me = mount_list; me; me = me->me_next) { | 854 | for (me = mount_list; me; me = me->me_next) { |
| 855 | if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) | 855 | if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) |
| @@ -872,7 +872,7 @@ process_arguments (int argc, char **argv) | |||
| 872 | warn_freeinodes_percent = NULL; | 872 | warn_freeinodes_percent = NULL; |
| 873 | crit_freeinodes_percent = NULL; | 873 | crit_freeinodes_percent = NULL; |
| 874 | 874 | ||
| 875 | path_selected = FALSE; | 875 | path_selected = false; |
| 876 | group = NULL; | 876 | group = NULL; |
| 877 | break; | 877 | break; |
| 878 | case 'V': /* version */ | 878 | case 'V': /* version */ |
| @@ -896,7 +896,7 @@ process_arguments (int argc, char **argv) | |||
| 896 | 896 | ||
| 897 | if (argc > c) { | 897 | if (argc > c) { |
| 898 | se = np_add_parameter(&path_select_list, strdup(argv[c++])); | 898 | se = np_add_parameter(&path_select_list, strdup(argv[c++])); |
| 899 | path_selected = TRUE; | 899 | path_selected = true; |
| 900 | set_all_thresholds(se); | 900 | set_all_thresholds(se); |
| 901 | } | 901 | } |
| 902 | 902 | ||
| @@ -905,7 +905,7 @@ process_arguments (int argc, char **argv) | |||
| 905 | mult = (uintmax_t)1024 * 1024; | 905 | mult = (uintmax_t)1024 * 1024; |
| 906 | } | 906 | } |
| 907 | 907 | ||
| 908 | return TRUE; | 908 | return true; |
| 909 | } | 909 | } |
| 910 | 910 | ||
| 911 | 911 | ||
diff --git a/plugins/check_dns.c b/plugins/check_dns.c index 7ffce98b..82dc264a 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c | |||
| @@ -41,8 +41,8 @@ const char *email = "devel@monitoring-plugins.org"; | |||
| 41 | 41 | ||
| 42 | int process_arguments (int, char **); | 42 | int process_arguments (int, char **); |
| 43 | int validate_arguments (void); | 43 | int validate_arguments (void); |
| 44 | int error_scan (char *, int *); | 44 | int error_scan (char *, bool *); |
| 45 | int ip_match_cidr(const char *, const char *); | 45 | bool ip_match_cidr(const char *, const char *); |
| 46 | unsigned long ip2long(const char *); | 46 | unsigned long ip2long(const char *); |
| 47 | void print_help (void); | 47 | void print_help (void); |
| 48 | void print_usage (void); | 48 | void print_usage (void); |
| @@ -51,13 +51,13 @@ void print_usage (void); | |||
| 51 | char query_address[ADDRESS_LENGTH] = ""; | 51 | char query_address[ADDRESS_LENGTH] = ""; |
| 52 | char dns_server[ADDRESS_LENGTH] = ""; | 52 | char dns_server[ADDRESS_LENGTH] = ""; |
| 53 | char ptr_server[ADDRESS_LENGTH] = ""; | 53 | char ptr_server[ADDRESS_LENGTH] = ""; |
| 54 | int verbose = FALSE; | 54 | bool verbose = false; |
| 55 | char **expected_address = NULL; | 55 | char **expected_address = NULL; |
| 56 | int expected_address_cnt = 0; | 56 | int expected_address_cnt = 0; |
| 57 | int expect_nxdomain = FALSE; | 57 | bool expect_nxdomain = false; |
| 58 | 58 | ||
| 59 | int expect_authority = FALSE; | 59 | bool expect_authority = false; |
| 60 | int all_match = FALSE; | 60 | bool all_match = false; |
| 61 | thresholds *time_thresholds = NULL; | 61 | thresholds *time_thresholds = NULL; |
| 62 | 62 | ||
| 63 | static int | 63 | static int |
| @@ -80,15 +80,15 @@ main (int argc, char **argv) | |||
| 80 | int n_addresses = 0; | 80 | int n_addresses = 0; |
| 81 | char *msg = NULL; | 81 | char *msg = NULL; |
| 82 | char *temp_buffer = NULL; | 82 | char *temp_buffer = NULL; |
| 83 | int non_authoritative = FALSE; | 83 | bool non_authoritative = false; |
| 84 | int result = STATE_UNKNOWN; | 84 | int result = STATE_UNKNOWN; |
| 85 | double elapsed_time; | 85 | double elapsed_time; |
| 86 | long microsec; | 86 | long microsec; |
| 87 | struct timeval tv; | 87 | struct timeval tv; |
| 88 | int parse_address = FALSE; /* This flag scans for Address: but only after Name: */ | 88 | bool parse_address = false; /* This flag scans for Address: but only after Name: */ |
| 89 | output chld_out, chld_err; | 89 | output chld_out, chld_err; |
| 90 | size_t i; | 90 | size_t i; |
| 91 | int is_nxdomain = FALSE; | 91 | bool is_nxdomain = false; |
| 92 | 92 | ||
| 93 | setlocale (LC_ALL, ""); | 93 | setlocale (LC_ALL, ""); |
| 94 | bindtextdomain (PACKAGE, LOCALEDIR); | 94 | bindtextdomain (PACKAGE, LOCALEDIR); |
| @@ -164,8 +164,8 @@ main (int argc, char **argv) | |||
| 164 | 164 | ||
| 165 | /* the server is responding, we just got the host name... */ | 165 | /* the server is responding, we just got the host name... */ |
| 166 | if (strstr (chld_out.line[i], "Name:")) | 166 | if (strstr (chld_out.line[i], "Name:")) |
| 167 | parse_address = TRUE; | 167 | parse_address = true; |
| 168 | else if (parse_address == TRUE && (strstr (chld_out.line[i], "Address:") || | 168 | else if (parse_address && (strstr (chld_out.line[i], "Address:") || |
| 169 | strstr (chld_out.line[i], "Addresses:"))) { | 169 | strstr (chld_out.line[i], "Addresses:"))) { |
| 170 | temp_buffer = index (chld_out.line[i], ':'); | 170 | temp_buffer = index (chld_out.line[i], ':'); |
| 171 | temp_buffer++; | 171 | temp_buffer++; |
| @@ -184,7 +184,7 @@ main (int argc, char **argv) | |||
| 184 | addresses[n_addresses++] = strdup(temp_buffer); | 184 | addresses[n_addresses++] = strdup(temp_buffer); |
| 185 | } | 185 | } |
| 186 | else if (strstr (chld_out.line[i], _("Non-authoritative answer:"))) { | 186 | else if (strstr (chld_out.line[i], _("Non-authoritative answer:"))) { |
| 187 | non_authoritative = TRUE; | 187 | non_authoritative = true; |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | 190 | ||
| @@ -298,21 +298,21 @@ main (int argc, char **argv) | |||
| 298 | printf (_(". %s returns %s"), query_address, address); | 298 | printf (_(". %s returns %s"), query_address, address); |
| 299 | if ((time_thresholds->warning != NULL) && (time_thresholds->critical != NULL)) { | 299 | if ((time_thresholds->warning != NULL) && (time_thresholds->critical != NULL)) { |
| 300 | printf ("|%s\n", fperfdata ("time", elapsed_time, "s", | 300 | printf ("|%s\n", fperfdata ("time", elapsed_time, "s", |
| 301 | TRUE, time_thresholds->warning->end, | 301 | true, time_thresholds->warning->end, |
| 302 | TRUE, time_thresholds->critical->end, | 302 | true, time_thresholds->critical->end, |
| 303 | TRUE, 0, FALSE, 0)); | 303 | true, 0, false, 0)); |
| 304 | } else if ((time_thresholds->warning == NULL) && (time_thresholds->critical != NULL)) { | 304 | } else if ((time_thresholds->warning == NULL) && (time_thresholds->critical != NULL)) { |
| 305 | printf ("|%s\n", fperfdata ("time", elapsed_time, "s", | 305 | printf ("|%s\n", fperfdata ("time", elapsed_time, "s", |
| 306 | FALSE, 0, | 306 | false, 0, |
| 307 | TRUE, time_thresholds->critical->end, | 307 | true, time_thresholds->critical->end, |
| 308 | TRUE, 0, FALSE, 0)); | 308 | true, 0, false, 0)); |
| 309 | } else if ((time_thresholds->warning != NULL) && (time_thresholds->critical == NULL)) { | 309 | } else if ((time_thresholds->warning != NULL) && (time_thresholds->critical == NULL)) { |
| 310 | printf ("|%s\n", fperfdata ("time", elapsed_time, "s", | 310 | printf ("|%s\n", fperfdata ("time", elapsed_time, "s", |
| 311 | TRUE, time_thresholds->warning->end, | 311 | true, time_thresholds->warning->end, |
| 312 | FALSE, 0, | 312 | false, 0, |
| 313 | TRUE, 0, FALSE, 0)); | 313 | true, 0, false, 0)); |
| 314 | } else | 314 | } else |
| 315 | printf ("|%s\n", fperfdata ("time", elapsed_time, "s", FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | 315 | printf ("|%s\n", fperfdata ("time", elapsed_time, "s", false, 0, false, 0, true, 0, false, 0)); |
| 316 | } | 316 | } |
| 317 | else if (result == STATE_WARNING) | 317 | else if (result == STATE_WARNING) |
| 318 | printf (_("DNS WARNING - %s\n"), | 318 | printf (_("DNS WARNING - %s\n"), |
| @@ -327,15 +327,14 @@ main (int argc, char **argv) | |||
| 327 | return result; | 327 | return result; |
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | int | 330 | bool ip_match_cidr(const char *addr, const char *cidr_ro) { |
| 331 | ip_match_cidr(const char *addr, const char *cidr_ro) | ||
| 332 | { | ||
| 333 | char *subnet, *mask_c, *cidr = strdup(cidr_ro); | 331 | char *subnet, *mask_c, *cidr = strdup(cidr_ro); |
| 334 | int mask; | 332 | int mask; |
| 335 | subnet = strtok(cidr, "/"); | 333 | subnet = strtok(cidr, "/"); |
| 336 | mask_c = strtok(NULL, "\0"); | 334 | mask_c = strtok(NULL, "\0"); |
| 337 | if (!subnet || !mask_c) | 335 | if (!subnet || !mask_c) { |
| 338 | return FALSE; | 336 | return false; |
| 337 | } | ||
| 339 | mask = atoi(mask_c); | 338 | mask = atoi(mask_c); |
| 340 | 339 | ||
| 341 | /* https://www.cryptobells.com/verifying-ips-in-a-subnet-in-php/ */ | 340 | /* https://www.cryptobells.com/verifying-ips-in-a-subnet-in-php/ */ |
| @@ -355,14 +354,14 @@ ip2long(const char* src) { | |||
| 355 | } | 354 | } |
| 356 | 355 | ||
| 357 | int | 356 | int |
| 358 | error_scan (char *input_buffer, int *is_nxdomain) | 357 | error_scan (char *input_buffer, bool *is_nxdomain) |
| 359 | { | 358 | { |
| 360 | 359 | ||
| 361 | const int nxdomain = strstr (input_buffer, "Non-existent") || | 360 | const int nxdomain = strstr (input_buffer, "Non-existent") || |
| 362 | strstr (input_buffer, "** server can't find") || | 361 | strstr (input_buffer, "** server can't find") || |
| 363 | strstr (input_buffer, "** Can't find") || | 362 | strstr (input_buffer, "** Can't find") || |
| 364 | strstr (input_buffer, "NXDOMAIN"); | 363 | strstr (input_buffer, "NXDOMAIN"); |
| 365 | if (nxdomain) *is_nxdomain = TRUE; | 364 | if (nxdomain) *is_nxdomain = true; |
| 366 | 365 | ||
| 367 | /* the DNS lookup timed out */ | 366 | /* the DNS lookup timed out */ |
| 368 | if (strstr (input_buffer, _("Note: nslookup is deprecated and may be removed from future releases.")) || | 367 | if (strstr (input_buffer, _("Note: nslookup is deprecated and may be removed from future releases.")) || |
| @@ -461,7 +460,7 @@ process_arguments (int argc, char **argv) | |||
| 461 | print_revision (progname, NP_VERSION); | 460 | print_revision (progname, NP_VERSION); |
| 462 | exit (STATE_UNKNOWN); | 461 | exit (STATE_UNKNOWN); |
| 463 | case 'v': /* version */ | 462 | case 'v': /* version */ |
| 464 | verbose = TRUE; | 463 | verbose = true; |
| 465 | break; | 464 | break; |
| 466 | case 't': /* timeout period */ | 465 | case 't': /* timeout period */ |
| 467 | timeout_interval = atoi (optarg); | 466 | timeout_interval = atoi (optarg); |
| @@ -508,13 +507,13 @@ process_arguments (int argc, char **argv) | |||
| 508 | } | 507 | } |
| 509 | break; | 508 | break; |
| 510 | case 'n': /* expect NXDOMAIN */ | 509 | case 'n': /* expect NXDOMAIN */ |
| 511 | expect_nxdomain = TRUE; | 510 | expect_nxdomain = true; |
| 512 | break; | 511 | break; |
| 513 | case 'A': /* expect authority */ | 512 | case 'A': /* expect authority */ |
| 514 | expect_authority = TRUE; | 513 | expect_authority = true; |
| 515 | break; | 514 | break; |
| 516 | case 'L': /* all must match */ | 515 | case 'L': /* all must match */ |
| 517 | all_match = TRUE; | 516 | all_match = true; |
| 518 | break; | 517 | break; |
| 519 | case 'w': | 518 | case 'w': |
| 520 | warning = optarg; | 519 | warning = optarg; |
diff --git a/plugins/check_fping.c b/plugins/check_fping.c index 23a9e990..70d6f9fc 100644 --- a/plugins/check_fping.c +++ b/plugins/check_fping.c | |||
| @@ -59,16 +59,16 @@ int packet_size = PACKET_SIZE; | |||
| 59 | int packet_count = PACKET_COUNT; | 59 | int packet_count = PACKET_COUNT; |
| 60 | int target_timeout = 0; | 60 | int target_timeout = 0; |
| 61 | int packet_interval = 0; | 61 | int packet_interval = 0; |
| 62 | int verbose = FALSE; | 62 | bool verbose = false; |
| 63 | int cpl; | 63 | int cpl; |
| 64 | int wpl; | 64 | int wpl; |
| 65 | double crta; | 65 | double crta; |
| 66 | double wrta; | 66 | double wrta; |
| 67 | int cpl_p = FALSE; | 67 | bool cpl_p = false; |
| 68 | int wpl_p = FALSE; | 68 | bool wpl_p = false; |
| 69 | bool alive_p = FALSE; | 69 | bool alive_p = false; |
| 70 | int crta_p = FALSE; | 70 | bool crta_p = false; |
| 71 | int wrta_p = FALSE; | 71 | bool wrta_p = false; |
| 72 | 72 | ||
| 73 | int | 73 | int |
| 74 | main (int argc, char **argv) | 74 | main (int argc, char **argv) |
| @@ -194,8 +194,8 @@ int textscan (char *buf) { | |||
| 194 | _("FPING %s - %s (rta=%f ms)|%s\n"), | 194 | _("FPING %s - %s (rta=%f ms)|%s\n"), |
| 195 | state_text (STATE_OK), server_name,rta, | 195 | state_text (STATE_OK), server_name,rta, |
| 196 | /* No loss since we only waited for the first reply | 196 | /* No loss since we only waited for the first reply |
| 197 | perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, TRUE, 0, TRUE, 100), */ | 197 | perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, true, 0, true, 100), */ |
| 198 | fperfdata ("rta", rta/1.0e3, "s", wrta_p, wrta/1.0e3, crta_p, crta/1.0e3, TRUE, 0, FALSE, 0)); | 198 | fperfdata ("rta", rta/1.0e3, "s", wrta_p, wrta/1.0e3, crta_p, crta/1.0e3, true, 0, false, 0)); |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | if (strstr (buf, "not found")) { | 201 | if (strstr (buf, "not found")) { |
| @@ -228,21 +228,21 @@ int textscan (char *buf) { | |||
| 228 | rtastr = 1 + index (rtastr, '/'); | 228 | rtastr = 1 + index (rtastr, '/'); |
| 229 | loss = strtod (losstr, NULL); | 229 | loss = strtod (losstr, NULL); |
| 230 | rta = strtod (rtastr, NULL); | 230 | rta = strtod (rtastr, NULL); |
| 231 | if (cpl_p == TRUE && loss > cpl) | 231 | if (cpl_p && loss > cpl) |
| 232 | status = STATE_CRITICAL; | 232 | status = STATE_CRITICAL; |
| 233 | else if (crta_p == TRUE && rta > crta) | 233 | else if (crta_p && rta > crta) |
| 234 | status = STATE_CRITICAL; | 234 | status = STATE_CRITICAL; |
| 235 | else if (wpl_p == TRUE && loss > wpl) | 235 | else if (wpl_p && loss > wpl) |
| 236 | status = STATE_WARNING; | 236 | status = STATE_WARNING; |
| 237 | else if (wrta_p == TRUE && rta > wrta) | 237 | else if (wrta_p && rta > wrta) |
| 238 | status = STATE_WARNING; | 238 | status = STATE_WARNING; |
| 239 | else | 239 | else |
| 240 | status = STATE_OK; | 240 | status = STATE_OK; |
| 241 | die (status, | 241 | die (status, |
| 242 | _("FPING %s - %s (loss=%.0f%%, rta=%f ms)|%s %s\n"), | 242 | _("FPING %s - %s (loss=%.0f%%, rta=%f ms)|%s %s\n"), |
| 243 | state_text (status), server_name, loss, rta, | 243 | state_text (status), server_name, loss, rta, |
| 244 | perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, TRUE, 0, TRUE, 100), | 244 | perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, true, 0, true, 100), |
| 245 | fperfdata ("rta", rta/1.0e3, "s", wrta_p, wrta/1.0e3, crta_p, crta/1.0e3, TRUE, 0, FALSE, 0)); | 245 | fperfdata ("rta", rta/1.0e3, "s", wrta_p, wrta/1.0e3, crta_p, crta/1.0e3, true, 0, false, 0)); |
| 246 | 246 | ||
| 247 | } | 247 | } |
| 248 | else if(strstr (buf, "xmt/rcv/%loss") ) { | 248 | else if(strstr (buf, "xmt/rcv/%loss") ) { |
| @@ -258,16 +258,16 @@ int textscan (char *buf) { | |||
| 258 | loss = strtod (losstr, NULL); | 258 | loss = strtod (losstr, NULL); |
| 259 | if (atoi(losstr) == 100) | 259 | if (atoi(losstr) == 100) |
| 260 | status = STATE_CRITICAL; | 260 | status = STATE_CRITICAL; |
| 261 | else if (cpl_p == TRUE && loss > cpl) | 261 | else if (cpl_p && loss > cpl) |
| 262 | status = STATE_CRITICAL; | 262 | status = STATE_CRITICAL; |
| 263 | else if (wpl_p == TRUE && loss > wpl) | 263 | else if (wpl_p && loss > wpl) |
| 264 | status = STATE_WARNING; | 264 | status = STATE_WARNING; |
| 265 | else | 265 | else |
| 266 | status = STATE_OK; | 266 | status = STATE_OK; |
| 267 | /* loss=%.0f%%;%d;%d;0;100 */ | 267 | /* loss=%.0f%%;%d;%d;0;100 */ |
| 268 | die (status, _("FPING %s - %s (loss=%.0f%% )|%s\n"), | 268 | die (status, _("FPING %s - %s (loss=%.0f%% )|%s\n"), |
| 269 | state_text (status), server_name, loss , | 269 | state_text (status), server_name, loss , |
| 270 | perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, TRUE, 0, TRUE, 100)); | 270 | perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, true, 0, true, 100)); |
| 271 | 271 | ||
| 272 | } | 272 | } |
| 273 | else { | 273 | else { |
| @@ -329,7 +329,7 @@ process_arguments (int argc, char **argv) | |||
| 329 | case '?': /* print short usage statement if args not parsable */ | 329 | case '?': /* print short usage statement if args not parsable */ |
| 330 | usage5 (); | 330 | usage5 (); |
| 331 | case 'a': /* host alive mode */ | 331 | case 'a': /* host alive mode */ |
| 332 | alive_p = TRUE; | 332 | alive_p = true; |
| 333 | break; | 333 | break; |
| 334 | case 'h': /* help */ | 334 | case 'h': /* help */ |
| 335 | print_help (); | 335 | print_help (); |
| @@ -338,16 +338,16 @@ process_arguments (int argc, char **argv) | |||
| 338 | print_revision (progname, NP_VERSION); | 338 | print_revision (progname, NP_VERSION); |
| 339 | exit (STATE_UNKNOWN); | 339 | exit (STATE_UNKNOWN); |
| 340 | case 'v': /* verbose mode */ | 340 | case 'v': /* verbose mode */ |
| 341 | verbose = TRUE; | 341 | verbose = true; |
| 342 | break; | 342 | break; |
| 343 | case 'H': /* hostname */ | 343 | case 'H': /* hostname */ |
| 344 | if (is_host (optarg) == FALSE) { | 344 | if (is_host (optarg) == false) { |
| 345 | usage2 (_("Invalid hostname/address"), optarg); | 345 | usage2 (_("Invalid hostname/address"), optarg); |
| 346 | } | 346 | } |
| 347 | server_name = strscpy (server_name, optarg); | 347 | server_name = strscpy (server_name, optarg); |
| 348 | break; | 348 | break; |
| 349 | case 'S': /* sourceip */ | 349 | case 'S': /* sourceip */ |
| 350 | if (is_host (optarg) == FALSE) { | 350 | if (is_host (optarg) == false) { |
| 351 | usage2 (_("Invalid hostname/address"), optarg); | 351 | usage2 (_("Invalid hostname/address"), optarg); |
| 352 | } | 352 | } |
| 353 | sourceip = strscpy (sourceip, optarg); | 353 | sourceip = strscpy (sourceip, optarg); |
| @@ -369,12 +369,12 @@ process_arguments (int argc, char **argv) | |||
| 369 | get_threshold (optarg, rv); | 369 | get_threshold (optarg, rv); |
| 370 | if (rv[RTA]) { | 370 | if (rv[RTA]) { |
| 371 | crta = strtod (rv[RTA], NULL); | 371 | crta = strtod (rv[RTA], NULL); |
| 372 | crta_p = TRUE; | 372 | crta_p = true; |
| 373 | rv[RTA] = NULL; | 373 | rv[RTA] = NULL; |
| 374 | } | 374 | } |
| 375 | if (rv[PL]) { | 375 | if (rv[PL]) { |
| 376 | cpl = atoi (rv[PL]); | 376 | cpl = atoi (rv[PL]); |
| 377 | cpl_p = TRUE; | 377 | cpl_p = true; |
| 378 | rv[PL] = NULL; | 378 | rv[PL] = NULL; |
| 379 | } | 379 | } |
| 380 | break; | 380 | break; |
| @@ -382,12 +382,12 @@ process_arguments (int argc, char **argv) | |||
| 382 | get_threshold (optarg, rv); | 382 | get_threshold (optarg, rv); |
| 383 | if (rv[RTA]) { | 383 | if (rv[RTA]) { |
| 384 | wrta = strtod (rv[RTA], NULL); | 384 | wrta = strtod (rv[RTA], NULL); |
| 385 | wrta_p = TRUE; | 385 | wrta_p = true; |
| 386 | rv[RTA] = NULL; | 386 | rv[RTA] = NULL; |
| 387 | } | 387 | } |
| 388 | if (rv[PL]) { | 388 | if (rv[PL]) { |
| 389 | wpl = atoi (rv[PL]); | 389 | wpl = atoi (rv[PL]); |
| 390 | wpl_p = TRUE; | 390 | wpl_p = true; |
| 391 | rv[PL] = NULL; | 391 | rv[PL] = NULL; |
| 392 | } | 392 | } |
| 393 | break; | 393 | break; |
diff --git a/plugins/check_game.c b/plugins/check_game.c index a534b69b..ca126973 100644 --- a/plugins/check_game.c +++ b/plugins/check_game.c | |||
| @@ -53,7 +53,7 @@ char *server_ip; | |||
| 53 | char *game_type; | 53 | char *game_type; |
| 54 | int port = 0; | 54 | int port = 0; |
| 55 | 55 | ||
| 56 | int verbose; | 56 | bool verbose = false; |
| 57 | 57 | ||
| 58 | int qstat_game_players_max = -1; | 58 | int qstat_game_players_max = -1; |
| 59 | int qstat_game_players = -1; | 59 | int qstat_game_players = -1; |
| @@ -90,7 +90,7 @@ main (int argc, char **argv) | |||
| 90 | if (port) | 90 | if (port) |
| 91 | xasprintf (&command_line, "%s:%-d", command_line, port); | 91 | xasprintf (&command_line, "%s:%-d", command_line, port); |
| 92 | 92 | ||
| 93 | if (verbose > 0) | 93 | if (verbose) |
| 94 | printf ("%s\n", command_line); | 94 | printf ("%s\n", command_line); |
| 95 | 95 | ||
| 96 | /* run the command. historically, this plugin ignores output on stderr, | 96 | /* run the command. historically, this plugin ignores output on stderr, |
| @@ -142,11 +142,11 @@ main (int argc, char **argv) | |||
| 142 | ret[qstat_map_field], | 142 | ret[qstat_map_field], |
| 143 | ret[qstat_ping_field], | 143 | ret[qstat_ping_field], |
| 144 | perfdata ("players", atol(ret[qstat_game_players]), "", | 144 | perfdata ("players", atol(ret[qstat_game_players]), "", |
| 145 | FALSE, 0, FALSE, 0, | 145 | false, 0, false, 0, |
| 146 | TRUE, 0, TRUE, atol(ret[qstat_game_players_max])), | 146 | true, 0, true, atol(ret[qstat_game_players_max])), |
| 147 | fperfdata ("ping", strtod(ret[qstat_ping_field], NULL), "", | 147 | fperfdata ("ping", strtod(ret[qstat_ping_field], NULL), "", |
| 148 | FALSE, 0, FALSE, 0, | 148 | false, 0, false, 0, |
| 149 | TRUE, 0, FALSE, 0)); | 149 | true, 0, false, 0)); |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | return result; | 152 | return result; |
| @@ -201,7 +201,7 @@ process_arguments (int argc, char **argv) | |||
| 201 | print_revision (progname, NP_VERSION); | 201 | print_revision (progname, NP_VERSION); |
| 202 | exit (STATE_UNKNOWN); | 202 | exit (STATE_UNKNOWN); |
| 203 | case 'v': /* version */ | 203 | case 'v': /* version */ |
| 204 | verbose = TRUE; | 204 | verbose = true; |
| 205 | break; | 205 | break; |
| 206 | case 't': /* timeout period */ | 206 | case 't': /* timeout period */ |
| 207 | timeout_interval = atoi (optarg); | 207 | timeout_interval = atoi (optarg); |
diff --git a/plugins/check_ide_smart.c b/plugins/check_ide_smart.c index 0160d98b..3872e341 100644 --- a/plugins/check_ide_smart.c +++ b/plugins/check_ide_smart.c | |||
| @@ -73,10 +73,6 @@ void print_usage (void); | |||
| 73 | 73 | ||
| 74 | #define NR_ATTRIBUTES 30 | 74 | #define NR_ATTRIBUTES 30 |
| 75 | 75 | ||
| 76 | #ifndef TRUE | ||
| 77 | #define TRUE 1 | ||
| 78 | #endif /* */ | ||
| 79 | |||
| 80 | #define PREFAILURE 2 | 76 | #define PREFAILURE 2 |
| 81 | #define ADVISORY 1 | 77 | #define ADVISORY 1 |
| 82 | #define OPERATIONAL 0 | 78 | #define OPERATIONAL 0 |
| @@ -169,9 +165,9 @@ int smart_read_values (int, values_t *); | |||
| 169 | int nagios (values_t *, thresholds_t *); | 165 | int nagios (values_t *, thresholds_t *); |
| 170 | void print_value (value_t *, threshold_t *); | 166 | void print_value (value_t *, threshold_t *); |
| 171 | void print_values (values_t *, thresholds_t *); | 167 | void print_values (values_t *, thresholds_t *); |
| 172 | int smart_cmd_simple (int, enum SmartCommand, __u8, char); | 168 | int smart_cmd_simple (int, enum SmartCommand, __u8, bool); |
| 173 | int smart_read_thresholds (int, thresholds_t *); | 169 | int smart_read_thresholds (int, thresholds_t *); |
| 174 | int verbose = FALSE; | 170 | bool verbose = false; |
| 175 | 171 | ||
| 176 | int | 172 | int |
| 177 | main (int argc, char *argv[]) | 173 | main (int argc, char *argv[]) |
| @@ -203,7 +199,7 @@ main (int argc, char *argv[]) | |||
| 203 | bindtextdomain (PACKAGE, LOCALEDIR); | 199 | bindtextdomain (PACKAGE, LOCALEDIR); |
| 204 | textdomain (PACKAGE); | 200 | textdomain (PACKAGE); |
| 205 | 201 | ||
| 206 | while (1) { | 202 | while (true) { |
| 207 | 203 | ||
| 208 | o = getopt_long (argc, argv, "+d:iq10nhVv", longopts, &longindex); | 204 | o = getopt_long (argc, argv, "+d:iq10nhVv", longopts, &longindex); |
| 209 | 205 | ||
| @@ -229,7 +225,7 @@ main (int argc, char *argv[]) | |||
| 229 | fprintf (stderr, "%s\n", _("default and will be removed from future releases.")); | 225 | fprintf (stderr, "%s\n", _("default and will be removed from future releases.")); |
| 230 | break; | 226 | break; |
| 231 | case 'v': /* verbose */ | 227 | case 'v': /* verbose */ |
| 232 | verbose = TRUE; | 228 | verbose = true; |
| 233 | break; | 229 | break; |
| 234 | case 'h': | 230 | case 'h': |
| 235 | print_help (); | 231 | print_help (); |
| @@ -258,7 +254,7 @@ main (int argc, char *argv[]) | |||
| 258 | return STATE_CRITICAL; | 254 | return STATE_CRITICAL; |
| 259 | } | 255 | } |
| 260 | 256 | ||
| 261 | if (smart_cmd_simple (fd, SMART_CMD_ENABLE, 0, FALSE)) { | 257 | if (smart_cmd_simple (fd, SMART_CMD_ENABLE, 0, false)) { |
| 262 | printf (_("CRITICAL - SMART_CMD_ENABLE\n")); | 258 | printf (_("CRITICAL - SMART_CMD_ENABLE\n")); |
| 263 | return STATE_CRITICAL; | 259 | return STATE_CRITICAL; |
| 264 | } | 260 | } |
| @@ -447,9 +443,7 @@ print_values (values_t * p, thresholds_t * t) | |||
| 447 | } | 443 | } |
| 448 | 444 | ||
| 449 | 445 | ||
| 450 | int | 446 | int smart_cmd_simple (int fd, enum SmartCommand command, __u8 val0, bool show_error) { |
| 451 | smart_cmd_simple (int fd, enum SmartCommand command, __u8 val0, char show_error) | ||
| 452 | { | ||
| 453 | int e = STATE_UNKNOWN; | 447 | int e = STATE_UNKNOWN; |
| 454 | #ifdef __linux__ | 448 | #ifdef __linux__ |
| 455 | __u8 args[4]; | 449 | __u8 args[4]; |
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index 15113b1f..868ffc1e 100644 --- a/plugins/check_ldap.c +++ b/plugins/check_ldap.c | |||
| @@ -71,9 +71,9 @@ thresholds *entries_thresholds = NULL; | |||
| 71 | struct timeval tv; | 71 | struct timeval tv; |
| 72 | char* warn_entries = NULL; | 72 | char* warn_entries = NULL; |
| 73 | char* crit_entries = NULL; | 73 | char* crit_entries = NULL; |
| 74 | int starttls = FALSE; | 74 | bool starttls = false; |
| 75 | int ssl_on_connect = FALSE; | 75 | bool ssl_on_connect = false; |
| 76 | int verbose = 0; | 76 | bool verbose = false; |
| 77 | 77 | ||
| 78 | /* for ldap tls */ | 78 | /* for ldap tls */ |
| 79 | 79 | ||
| @@ -115,7 +115,7 @@ main (int argc, char *argv[]) | |||
| 115 | usage4 (_("Could not parse arguments")); | 115 | usage4 (_("Could not parse arguments")); |
| 116 | 116 | ||
| 117 | if (strstr(argv[0],"check_ldaps") && ! starttls && ! ssl_on_connect) | 117 | if (strstr(argv[0],"check_ldaps") && ! starttls && ! ssl_on_connect) |
| 118 | starttls = TRUE; | 118 | starttls = true; |
| 119 | 119 | ||
| 120 | /* initialize alarm signal handling */ | 120 | /* initialize alarm signal handling */ |
| 121 | signal (SIGALRM, socket_timeout_alarm_handler); | 121 | signal (SIGALRM, socket_timeout_alarm_handler); |
| @@ -253,11 +253,11 @@ main (int argc, char *argv[]) | |||
| 253 | fperfdata ("time", elapsed_time, "s", | 253 | fperfdata ("time", elapsed_time, "s", |
| 254 | (int)warn_time, warn_time, | 254 | (int)warn_time, warn_time, |
| 255 | (int)crit_time, crit_time, | 255 | (int)crit_time, crit_time, |
| 256 | TRUE, 0, FALSE, 0), | 256 | true, 0, false, 0), |
| 257 | sperfdata ("entries", (double)num_entries, "", | 257 | sperfdata ("entries", (double)num_entries, "", |
| 258 | warn_entries, | 258 | warn_entries, |
| 259 | crit_entries, | 259 | crit_entries, |
| 260 | TRUE, 0.0, FALSE, 0.0)); | 260 | true, 0.0, false, 0.0)); |
| 261 | } else { | 261 | } else { |
| 262 | printf (_("LDAP %s - %.3f seconds response time|%s\n"), | 262 | printf (_("LDAP %s - %.3f seconds response time|%s\n"), |
| 263 | state_text (status), | 263 | state_text (status), |
| @@ -265,7 +265,7 @@ main (int argc, char *argv[]) | |||
| 265 | fperfdata ("time", elapsed_time, "s", | 265 | fperfdata ("time", elapsed_time, "s", |
| 266 | (int)warn_time, warn_time, | 266 | (int)warn_time, warn_time, |
| 267 | (int)crit_time, crit_time, | 267 | (int)crit_time, crit_time, |
| 268 | TRUE, 0, FALSE, 0)); | 268 | true, 0, false, 0)); |
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | return status; | 271 | return status; |
| @@ -313,7 +313,7 @@ process_arguments (int argc, char **argv) | |||
| 313 | strcpy (argv[c], "-t"); | 313 | strcpy (argv[c], "-t"); |
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | while (1) { | 316 | while (true) { |
| 317 | c = getopt_long (argc, argv, "hvV234TS6t:c:w:H:b:p:a:D:P:C:W:", longopts, &option); | 317 | c = getopt_long (argc, argv, "hvV234TS6t:c:w:H:b:p:a:D:P:C:W:", longopts, &option); |
| 318 | 318 | ||
| 319 | if (c == -1 || c == EOF) | 319 | if (c == -1 || c == EOF) |
| @@ -374,17 +374,17 @@ process_arguments (int argc, char **argv) | |||
| 374 | address_family = AF_INET; | 374 | address_family = AF_INET; |
| 375 | break; | 375 | break; |
| 376 | case 'v': | 376 | case 'v': |
| 377 | verbose++; | 377 | verbose = true; |
| 378 | break; | 378 | break; |
| 379 | case 'T': | 379 | case 'T': |
| 380 | if (! ssl_on_connect) | 380 | if (! ssl_on_connect) |
| 381 | starttls = TRUE; | 381 | starttls = true; |
| 382 | else | 382 | else |
| 383 | usage_va(_("%s cannot be combined with %s"), "-T/--starttls", "-S/--ssl"); | 383 | usage_va(_("%s cannot be combined with %s"), "-T/--starttls", "-S/--ssl"); |
| 384 | break; | 384 | break; |
| 385 | case 'S': | 385 | case 'S': |
| 386 | if (! starttls) { | 386 | if (! starttls) { |
| 387 | ssl_on_connect = TRUE; | 387 | ssl_on_connect = true; |
| 388 | if (ld_port == -1) | 388 | if (ld_port == -1) |
| 389 | ld_port = LDAPS_PORT; | 389 | ld_port = LDAPS_PORT; |
| 390 | } else | 390 | } else |
diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c index 1fda5492..826b77e9 100644 --- a/plugins/check_mrtg.c +++ b/plugins/check_mrtg.c | |||
| @@ -43,7 +43,7 @@ void print_usage (void); | |||
| 43 | 43 | ||
| 44 | char *log_file = NULL; | 44 | char *log_file = NULL; |
| 45 | int expire_minutes = 0; | 45 | int expire_minutes = 0; |
| 46 | int use_average = TRUE; | 46 | bool use_average = true; |
| 47 | int variable_number = -1; | 47 | int variable_number = -1; |
| 48 | unsigned long value_warning_threshold = 0L; | 48 | unsigned long value_warning_threshold = 0L; |
| 49 | unsigned long value_critical_threshold = 0L; | 49 | unsigned long value_critical_threshold = 0L; |
| @@ -138,7 +138,7 @@ main (int argc, char **argv) | |||
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | /* else check the incoming/outgoing rates */ | 140 | /* else check the incoming/outgoing rates */ |
| 141 | if (use_average == TRUE) | 141 | if (use_average) |
| 142 | rate = average_value_rate; | 142 | rate = average_value_rate; |
| 143 | else | 143 | else |
| 144 | rate = maximum_value_rate; | 144 | rate = maximum_value_rate; |
| @@ -149,7 +149,7 @@ main (int argc, char **argv) | |||
| 149 | result = STATE_WARNING; | 149 | result = STATE_WARNING; |
| 150 | 150 | ||
| 151 | printf("%s. %s = %lu %s|%s\n", | 151 | printf("%s. %s = %lu %s|%s\n", |
| 152 | (use_average == TRUE) ? _("Avg") : _("Max"), | 152 | (use_average) ? _("Avg") : _("Max"), |
| 153 | label, rate, units, | 153 | label, rate, units, |
| 154 | perfdata(label, (long) rate, units, | 154 | perfdata(label, (long) rate, units, |
| 155 | (int) value_warning_threshold, (long) value_warning_threshold, | 155 | (int) value_warning_threshold, (long) value_warning_threshold, |
| @@ -211,9 +211,9 @@ process_arguments (int argc, char **argv) | |||
| 211 | break; | 211 | break; |
| 212 | case 'a': /* port */ | 212 | case 'a': /* port */ |
| 213 | if (!strcmp (optarg, "MAX")) | 213 | if (!strcmp (optarg, "MAX")) |
| 214 | use_average = FALSE; | 214 | use_average = false; |
| 215 | else | 215 | else |
| 216 | use_average = TRUE; | 216 | use_average = true; |
| 217 | break; | 217 | break; |
| 218 | case 'v': | 218 | case 'v': |
| 219 | variable_number = atoi (optarg); | 219 | variable_number = atoi (optarg); |
| @@ -258,11 +258,11 @@ process_arguments (int argc, char **argv) | |||
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | if (argc > c && strcmp (argv[c], "MAX") == 0) { | 260 | if (argc > c && strcmp (argv[c], "MAX") == 0) { |
| 261 | use_average = FALSE; | 261 | use_average = false; |
| 262 | c++; | 262 | c++; |
| 263 | } | 263 | } |
| 264 | else if (argc > c && strcmp (argv[c], "AVG") == 0) { | 264 | else if (argc > c && strcmp (argv[c], "AVG") == 0) { |
| 265 | use_average = TRUE; | 265 | use_average = true; |
| 266 | c++; | 266 | c++; |
| 267 | } | 267 | } |
| 268 | 268 | ||
diff --git a/plugins/check_mrtgtraf.c b/plugins/check_mrtgtraf.c index eb66f622..bd25d47d 100644 --- a/plugins/check_mrtgtraf.c +++ b/plugins/check_mrtgtraf.c | |||
| @@ -43,7 +43,7 @@ void print_usage(void); | |||
| 43 | 43 | ||
| 44 | char *log_file = NULL; | 44 | char *log_file = NULL; |
| 45 | int expire_minutes = -1; | 45 | int expire_minutes = -1; |
| 46 | int use_average = TRUE; | 46 | bool use_average = true; |
| 47 | unsigned long incoming_warning_threshold = 0L; | 47 | unsigned long incoming_warning_threshold = 0L; |
| 48 | unsigned long incoming_critical_threshold = 0L; | 48 | unsigned long incoming_critical_threshold = 0L; |
| 49 | unsigned long outgoing_warning_threshold = 0L; | 49 | unsigned long outgoing_warning_threshold = 0L; |
| @@ -137,7 +137,7 @@ main (int argc, char **argv) | |||
| 137 | (int) ((current_time - timestamp) / 60)); | 137 | (int) ((current_time - timestamp) / 60)); |
| 138 | 138 | ||
| 139 | /* else check the incoming/outgoing rates */ | 139 | /* else check the incoming/outgoing rates */ |
| 140 | if (use_average == TRUE) { | 140 | if (use_average) { |
| 141 | incoming_rate = average_incoming_rate; | 141 | incoming_rate = average_incoming_rate; |
| 142 | outgoing_rate = average_outgoing_rate; | 142 | outgoing_rate = average_outgoing_rate; |
| 143 | } | 143 | } |
| @@ -192,17 +192,17 @@ main (int argc, char **argv) | |||
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | xasprintf (&error_message, _("%s. In = %0.1f %s/s, %s. Out = %0.1f %s/s|%s %s\n"), | 194 | xasprintf (&error_message, _("%s. In = %0.1f %s/s, %s. Out = %0.1f %s/s|%s %s\n"), |
| 195 | (use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate, | 195 | (use_average) ? _("Avg") : _("Max"), adjusted_incoming_rate, |
| 196 | incoming_speed_rating, (use_average == TRUE) ? _("Avg") : _("Max"), | 196 | incoming_speed_rating, (use_average) ? _("Avg") : _("Max"), |
| 197 | adjusted_outgoing_rate, outgoing_speed_rating, | 197 | adjusted_outgoing_rate, outgoing_speed_rating, |
| 198 | fperfdata("in", adjusted_incoming_rate, incoming_speed_rating, | 198 | fperfdata("in", adjusted_incoming_rate, incoming_speed_rating, |
| 199 | (int)incoming_warning_threshold, incoming_warning_threshold, | 199 | (int)incoming_warning_threshold, incoming_warning_threshold, |
| 200 | (int)incoming_critical_threshold, incoming_critical_threshold, | 200 | (int)incoming_critical_threshold, incoming_critical_threshold, |
| 201 | TRUE, 0, FALSE, 0), | 201 | true, 0, false, 0), |
| 202 | fperfdata("out", adjusted_outgoing_rate, outgoing_speed_rating, | 202 | fperfdata("out", adjusted_outgoing_rate, outgoing_speed_rating, |
| 203 | (int)outgoing_warning_threshold, outgoing_warning_threshold, | 203 | (int)outgoing_warning_threshold, outgoing_warning_threshold, |
| 204 | (int)outgoing_critical_threshold, outgoing_critical_threshold, | 204 | (int)outgoing_critical_threshold, outgoing_critical_threshold, |
| 205 | TRUE, 0, FALSE, 0)); | 205 | true, 0, false, 0)); |
| 206 | 206 | ||
| 207 | printf (_("Traffic %s - %s\n"), state_text(result), error_message); | 207 | printf (_("Traffic %s - %s\n"), state_text(result), error_message); |
| 208 | 208 | ||
| @@ -256,9 +256,9 @@ process_arguments (int argc, char **argv) | |||
| 256 | break; | 256 | break; |
| 257 | case 'a': /* aggregation (AVE or MAX) */ | 257 | case 'a': /* aggregation (AVE or MAX) */ |
| 258 | if (!strcmp (optarg, "MAX")) | 258 | if (!strcmp (optarg, "MAX")) |
| 259 | use_average = FALSE; | 259 | use_average = false; |
| 260 | else | 260 | else |
| 261 | use_average = TRUE; | 261 | use_average = true; |
| 262 | break; | 262 | break; |
| 263 | case 'c': /* warning threshold */ | 263 | case 'c': /* warning threshold */ |
| 264 | sscanf (optarg, "%lu,%lu", &incoming_critical_threshold, | 264 | sscanf (optarg, "%lu,%lu", &incoming_critical_threshold, |
| @@ -289,11 +289,11 @@ process_arguments (int argc, char **argv) | |||
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | if (argc > c && strcmp (argv[c], "MAX") == 0) { | 291 | if (argc > c && strcmp (argv[c], "MAX") == 0) { |
| 292 | use_average = FALSE; | 292 | use_average = false; |
| 293 | c++; | 293 | c++; |
| 294 | } | 294 | } |
| 295 | else if (argc > c && strcmp (argv[c], "AVG") == 0) { | 295 | else if (argc > c && strcmp (argv[c], "AVG") == 0) { |
| 296 | use_average = TRUE; | 296 | use_average = true; |
| 297 | c++; | 297 | c++; |
| 298 | } | 298 | } |
| 299 | 299 | ||
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index 7d855544..6a7daf11 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c | |||
| @@ -113,7 +113,7 @@ main (int argc, char **argv) | |||
| 113 | char slaveresult[SLAVERESULTSIZE] = { 0 }; | 113 | char slaveresult[SLAVERESULTSIZE] = { 0 }; |
| 114 | char* perf; | 114 | char* perf; |
| 115 | 115 | ||
| 116 | perf = strdup (""); | 116 | perf = strdup (""); |
| 117 | 117 | ||
| 118 | setlocale (LC_ALL, ""); | 118 | setlocale (LC_ALL, ""); |
| 119 | bindtextdomain (PACKAGE, LOCALEDIR); | 119 | bindtextdomain (PACKAGE, LOCALEDIR); |
| @@ -193,14 +193,14 @@ main (int argc, char **argv) | |||
| 193 | for(i = 0; i < LENGTH_METRIC_UNIT; i++) { | 193 | for(i = 0; i < LENGTH_METRIC_UNIT; i++) { |
| 194 | if (strcmp(row[0], metric_unit[i]) == 0) { | 194 | if (strcmp(row[0], metric_unit[i]) == 0) { |
| 195 | xasprintf(&perf, "%s%s ", perf, perfdata(metric_unit[i], | 195 | xasprintf(&perf, "%s%s ", perf, perfdata(metric_unit[i], |
| 196 | atol(row[1]), "", FALSE, 0, FALSE, 0, FALSE, 0, FALSE, 0)); | 196 | atol(row[1]), "", false, 0, false, 0, false, 0, false, 0)); |
| 197 | continue; | 197 | continue; |
| 198 | } | 198 | } |
| 199 | } | 199 | } |
| 200 | for(i = 0; i < LENGTH_METRIC_COUNTER; i++) { | 200 | for(i = 0; i < LENGTH_METRIC_COUNTER; i++) { |
| 201 | if (strcmp(row[0], metric_counter[i]) == 0) { | 201 | if (strcmp(row[0], metric_counter[i]) == 0) { |
| 202 | xasprintf(&perf, "%s%s ", perf, perfdata(metric_counter[i], | 202 | xasprintf(&perf, "%s%s ", perf, perfdata(metric_counter[i], |
| 203 | atol(row[1]), "c", FALSE, 0, FALSE, 0, FALSE, 0, FALSE, 0)); | 203 | atol(row[1]), "c", false, 0, false, 0, false, 0, false, 0)); |
| 204 | continue; | 204 | continue; |
| 205 | } | 205 | } |
| 206 | } | 206 | } |
| @@ -322,10 +322,10 @@ main (int argc, char **argv) | |||
| 322 | status = get_status(value, my_threshold); | 322 | status = get_status(value, my_threshold); |
| 323 | 323 | ||
| 324 | xasprintf (&perf, "%s %s", perf, fperfdata ("seconds behind master", value, "s", | 324 | xasprintf (&perf, "%s %s", perf, fperfdata ("seconds behind master", value, "s", |
| 325 | TRUE, (double) warning_time, | 325 | true, (double) warning_time, |
| 326 | TRUE, (double) critical_time, | 326 | true, (double) critical_time, |
| 327 | FALSE, 0, | 327 | false, 0, |
| 328 | FALSE, 0)); | 328 | false, 0)); |
| 329 | 329 | ||
| 330 | if (status == STATE_WARNING) { | 330 | if (status == STATE_WARNING) { |
| 331 | printf("SLOW_SLAVE %s: %s|%s\n", _("WARNING"), slaveresult, perf); | 331 | printf("SLOW_SLAVE %s: %s|%s\n", _("WARNING"), slaveresult, perf); |
diff --git a/plugins/check_mysql_query.c b/plugins/check_mysql_query.c index ac2fb15d..842b7a2f 100644 --- a/plugins/check_mysql_query.c +++ b/plugins/check_mysql_query.c | |||
| @@ -162,10 +162,10 @@ main (int argc, char **argv) | |||
| 162 | } | 162 | } |
| 163 | printf(_("'%s' returned %f | %s"), sql_query, value, | 163 | printf(_("'%s' returned %f | %s"), sql_query, value, |
| 164 | fperfdata("result", value, "", | 164 | fperfdata("result", value, "", |
| 165 | my_thresholds->warning?TRUE:FALSE, my_thresholds->warning?my_thresholds->warning->end:0, | 165 | my_thresholds->warning?true:false, my_thresholds->warning?my_thresholds->warning->end:0, |
| 166 | my_thresholds->critical?TRUE:FALSE, my_thresholds->critical?my_thresholds->critical->end:0, | 166 | my_thresholds->critical?true:false, my_thresholds->critical?my_thresholds->critical->end:0, |
| 167 | FALSE, 0, | 167 | false, 0, |
| 168 | FALSE, 0) | 168 | false, 0) |
| 169 | ); | 169 | ); |
| 170 | printf("\n"); | 170 | printf("\n"); |
| 171 | 171 | ||
diff --git a/plugins/check_nt.c b/plugins/check_nt.c index d73d83ce..19c050de 100644 --- a/plugins/check_nt.c +++ b/plugins/check_nt.c | |||
| @@ -67,17 +67,17 @@ char *req_password=NULL; | |||
| 67 | unsigned long lvalue_list[MAX_VALUE_LIST]; | 67 | unsigned long lvalue_list[MAX_VALUE_LIST]; |
| 68 | unsigned long warning_value=0L; | 68 | unsigned long warning_value=0L; |
| 69 | unsigned long critical_value=0L; | 69 | unsigned long critical_value=0L; |
| 70 | int check_warning_value=FALSE; | 70 | bool check_warning_value=false; |
| 71 | int check_critical_value=FALSE; | 71 | bool check_critical_value=false; |
| 72 | enum checkvars vars_to_check = CHECK_NONE; | 72 | enum checkvars vars_to_check = CHECK_NONE; |
| 73 | int show_all=FALSE; | 73 | bool show_all = false; |
| 74 | 74 | ||
| 75 | char recv_buffer[MAX_INPUT_BUFFER]; | 75 | char recv_buffer[MAX_INPUT_BUFFER]; |
| 76 | 76 | ||
| 77 | void fetch_data (const char* address, int port, const char* sendb); | 77 | void fetch_data (const char* address, int port, const char* sendb); |
| 78 | int process_arguments(int, char **); | 78 | int process_arguments(int, char **); |
| 79 | void preparelist(char *string); | 79 | void preparelist(char *string); |
| 80 | int strtoularray(unsigned long *array, char *string, const char *delim); | 80 | bool strtoularray(unsigned long *array, char *string, const char *delim); |
| 81 | void print_help(void); | 81 | void print_help(void); |
| 82 | void print_usage(void); | 82 | void print_usage(void); |
| 83 | 83 | ||
| @@ -113,8 +113,8 @@ int main(int argc, char **argv){ | |||
| 113 | int uphours=0; | 113 | int uphours=0; |
| 114 | int upminutes=0; | 114 | int upminutes=0; |
| 115 | 115 | ||
| 116 | int isPercent = FALSE; | 116 | bool isPercent = false; |
| 117 | int allRight = FALSE; | 117 | bool allRight = false; |
| 118 | 118 | ||
| 119 | setlocale (LC_ALL, ""); | 119 | setlocale (LC_ALL, ""); |
| 120 | bindtextdomain (PACKAGE, LOCALEDIR); | 120 | bindtextdomain (PACKAGE, LOCALEDIR); |
| @@ -151,7 +151,7 @@ int main(int argc, char **argv){ | |||
| 151 | 151 | ||
| 152 | if (value_list==NULL) | 152 | if (value_list==NULL) |
| 153 | output_message = strdup (_("missing -l parameters")); | 153 | output_message = strdup (_("missing -l parameters")); |
| 154 | else if (strtoularray(lvalue_list,value_list,",")==FALSE) | 154 | else if (! strtoularray(lvalue_list,value_list,",")) |
| 155 | output_message = strdup (_("wrong -l parameter.")); | 155 | output_message = strdup (_("wrong -l parameter.")); |
| 156 | else { | 156 | else { |
| 157 | /* -l parameters is present with only integers */ | 157 | /* -l parameters is present with only integers */ |
| @@ -224,9 +224,9 @@ int main(int argc, char **argv){ | |||
| 224 | 224 | ||
| 225 | xasprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s) |uptime=%lu"),updays, uphours, upminutes, uptime); | 225 | xasprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s) |uptime=%lu"),updays, uphours, upminutes, uptime); |
| 226 | 226 | ||
| 227 | if (check_critical_value==TRUE && uptime <= critical_value) | 227 | if (check_critical_value && uptime <= critical_value) |
| 228 | return_code=STATE_CRITICAL; | 228 | return_code=STATE_CRITICAL; |
| 229 | else if (check_warning_value==TRUE && uptime <= warning_value) | 229 | else if (check_warning_value && uptime <= warning_value) |
| 230 | return_code=STATE_WARNING; | 230 | return_code=STATE_WARNING; |
| 231 | else | 231 | else |
| 232 | return_code=STATE_OK; | 232 | return_code=STATE_OK; |
| @@ -261,9 +261,9 @@ int main(int argc, char **argv){ | |||
| 261 | (total_disk_space - free_disk_space) / 1073741824, warning_used_space / 1073741824, | 261 | (total_disk_space - free_disk_space) / 1073741824, warning_used_space / 1073741824, |
| 262 | critical_used_space / 1073741824, total_disk_space / 1073741824); | 262 | critical_used_space / 1073741824, total_disk_space / 1073741824); |
| 263 | 263 | ||
| 264 | if(check_critical_value==TRUE && percent_used_space >= critical_value) | 264 | if(check_critical_value && percent_used_space >= critical_value) |
| 265 | return_code=STATE_CRITICAL; | 265 | return_code=STATE_CRITICAL; |
| 266 | else if (check_warning_value==TRUE && percent_used_space >= warning_value) | 266 | else if (check_warning_value && percent_used_space >= warning_value) |
| 267 | return_code=STATE_WARNING; | 267 | return_code=STATE_WARNING; |
| 268 | else | 268 | else |
| 269 | return_code=STATE_OK; | 269 | return_code=STATE_OK; |
| @@ -285,7 +285,7 @@ int main(int argc, char **argv){ | |||
| 285 | else { | 285 | else { |
| 286 | preparelist(value_list); /* replace , between services with & to send the request */ | 286 | preparelist(value_list); /* replace , between services with & to send the request */ |
| 287 | xasprintf(&send_buffer,"%s&%u&%s&%s", req_password,(vars_to_check==CHECK_SERVICESTATE)?5:6, | 287 | xasprintf(&send_buffer,"%s&%u&%s&%s", req_password,(vars_to_check==CHECK_SERVICESTATE)?5:6, |
| 288 | (show_all==TRUE) ? "ShowAll" : "ShowFail",value_list); | 288 | (show_all) ? "ShowAll" : "ShowFail",value_list); |
| 289 | fetch_data (server_address, server_port, send_buffer); | 289 | fetch_data (server_address, server_port, send_buffer); |
| 290 | numstr = strtok(recv_buffer,"&"); | 290 | numstr = strtok(recv_buffer,"&"); |
| 291 | if (numstr == NULL) | 291 | if (numstr == NULL) |
| @@ -321,9 +321,9 @@ int main(int argc, char **argv){ | |||
| 321 | warning_used_space / 1048567, critical_used_space / 1048567, mem_commitLimit / 1048567); | 321 | warning_used_space / 1048567, critical_used_space / 1048567, mem_commitLimit / 1048567); |
| 322 | 322 | ||
| 323 | return_code=STATE_OK; | 323 | return_code=STATE_OK; |
| 324 | if(check_critical_value==TRUE && percent_used_space >= critical_value) | 324 | if(check_critical_value && percent_used_space >= critical_value) |
| 325 | return_code=STATE_CRITICAL; | 325 | return_code=STATE_CRITICAL; |
| 326 | else if (check_warning_value==TRUE && percent_used_space >= warning_value) | 326 | else if (check_warning_value && percent_used_space >= warning_value) |
| 327 | return_code=STATE_WARNING; | 327 | return_code=STATE_WARNING; |
| 328 | 328 | ||
| 329 | break; | 329 | break; |
| @@ -371,7 +371,7 @@ int main(int argc, char **argv){ | |||
| 371 | else if (isPercent) | 371 | else if (isPercent) |
| 372 | { | 372 | { |
| 373 | counter_unit = strdup ("%"); | 373 | counter_unit = strdup ("%"); |
| 374 | allRight = TRUE; | 374 | allRight = true; |
| 375 | } | 375 | } |
| 376 | 376 | ||
| 377 | if ((counter_unit != NULL) && (!allRight)) | 377 | if ((counter_unit != NULL) && (!allRight)) |
| @@ -391,7 +391,7 @@ int main(int argc, char **argv){ | |||
| 391 | if ((fmaxval == 0) && (maxval == errcvt)) | 391 | if ((fmaxval == 0) && (maxval == errcvt)) |
| 392 | output_message = strdup (_("Maximum value contains non-numbers")); | 392 | output_message = strdup (_("Maximum value contains non-numbers")); |
| 393 | else | 393 | else |
| 394 | allRight = TRUE; /* Everything is OK. */ | 394 | allRight = true; /* Everything is OK. */ |
| 395 | 395 | ||
| 396 | } | 396 | } |
| 397 | } | 397 | } |
| @@ -418,9 +418,9 @@ int main(int argc, char **argv){ | |||
| 418 | 418 | ||
| 419 | if (critical_value > warning_value) | 419 | if (critical_value > warning_value) |
| 420 | { /* Normal thresholds */ | 420 | { /* Normal thresholds */ |
| 421 | if (check_critical_value == TRUE && counter_value >= critical_value) | 421 | if (check_critical_value && counter_value >= critical_value) |
| 422 | return_code = STATE_CRITICAL; | 422 | return_code = STATE_CRITICAL; |
| 423 | else if (check_warning_value == TRUE && counter_value >= warning_value) | 423 | else if (check_warning_value && counter_value >= warning_value) |
| 424 | return_code = STATE_WARNING; | 424 | return_code = STATE_WARNING; |
| 425 | else | 425 | else |
| 426 | return_code = STATE_OK; | 426 | return_code = STATE_OK; |
| @@ -428,9 +428,9 @@ int main(int argc, char **argv){ | |||
| 428 | else | 428 | else |
| 429 | { /* inverse thresholds */ | 429 | { /* inverse thresholds */ |
| 430 | return_code = STATE_OK; | 430 | return_code = STATE_OK; |
| 431 | if (check_critical_value == TRUE && counter_value <= critical_value) | 431 | if (check_critical_value && counter_value <= critical_value) |
| 432 | return_code = STATE_CRITICAL; | 432 | return_code = STATE_CRITICAL; |
| 433 | else if (check_warning_value == TRUE && counter_value <= warning_value) | 433 | else if (check_warning_value && counter_value <= warning_value) |
| 434 | return_code = STATE_WARNING; | 434 | return_code = STATE_WARNING; |
| 435 | } | 435 | } |
| 436 | break; | 436 | break; |
| @@ -448,17 +448,17 @@ int main(int argc, char **argv){ | |||
| 448 | output_message = strdup (description); | 448 | output_message = strdup (description); |
| 449 | 449 | ||
| 450 | if (critical_value > warning_value) { /* Normal thresholds */ | 450 | if (critical_value > warning_value) { /* Normal thresholds */ |
| 451 | if(check_critical_value==TRUE && age_in_minutes >= critical_value) | 451 | if(check_critical_value && age_in_minutes >= critical_value) |
| 452 | return_code=STATE_CRITICAL; | 452 | return_code=STATE_CRITICAL; |
| 453 | else if (check_warning_value==TRUE && age_in_minutes >= warning_value) | 453 | else if (check_warning_value && age_in_minutes >= warning_value) |
| 454 | return_code=STATE_WARNING; | 454 | return_code=STATE_WARNING; |
| 455 | else | 455 | else |
| 456 | return_code=STATE_OK; | 456 | return_code=STATE_OK; |
| 457 | } | 457 | } |
| 458 | else { /* inverse thresholds */ | 458 | else { /* inverse thresholds */ |
| 459 | if(check_critical_value==TRUE && age_in_minutes <= critical_value) | 459 | if(check_critical_value && age_in_minutes <= critical_value) |
| 460 | return_code=STATE_CRITICAL; | 460 | return_code=STATE_CRITICAL; |
| 461 | else if (check_warning_value==TRUE && age_in_minutes <= warning_value) | 461 | else if (check_warning_value && age_in_minutes <= warning_value) |
| 462 | return_code=STATE_WARNING; | 462 | return_code=STATE_WARNING; |
| 463 | else | 463 | else |
| 464 | return_code=STATE_OK; | 464 | return_code=STATE_OK; |
| @@ -600,15 +600,15 @@ int process_arguments(int argc, char **argv){ | |||
| 600 | break; | 600 | break; |
| 601 | case 'w': /* warning threshold */ | 601 | case 'w': /* warning threshold */ |
| 602 | warning_value=strtoul(optarg,NULL,10); | 602 | warning_value=strtoul(optarg,NULL,10); |
| 603 | check_warning_value=TRUE; | 603 | check_warning_value=true; |
| 604 | break; | 604 | break; |
| 605 | case 'c': /* critical threshold */ | 605 | case 'c': /* critical threshold */ |
| 606 | critical_value=strtoul(optarg,NULL,10); | 606 | critical_value=strtoul(optarg,NULL,10); |
| 607 | check_critical_value=TRUE; | 607 | check_critical_value=true; |
| 608 | break; | 608 | break; |
| 609 | case 'd': /* Display select for services */ | 609 | case 'd': /* Display select for services */ |
| 610 | if (!strcmp(optarg,"SHOWALL")) | 610 | if (!strcmp(optarg,"SHOWALL")) |
| 611 | show_all = TRUE; | 611 | show_all = true; |
| 612 | break; | 612 | break; |
| 613 | case 'u': | 613 | case 'u': |
| 614 | socket_timeout_state=STATE_UNKNOWN; | 614 | socket_timeout_state=STATE_UNKNOWN; |
| @@ -646,7 +646,7 @@ void fetch_data (const char *address, int port, const char *sendb) { | |||
| 646 | die (STATE_UNKNOWN, "NSClient - %s\n",recv_buffer); | 646 | die (STATE_UNKNOWN, "NSClient - %s\n",recv_buffer); |
| 647 | } | 647 | } |
| 648 | 648 | ||
| 649 | int strtoularray(unsigned long *array, char *string, const char *delim) { | 649 | bool strtoularray(unsigned long *array, char *string, const char *delim) { |
| 650 | /* split a <delim> delimited string into a long array */ | 650 | /* split a <delim> delimited string into a long array */ |
| 651 | int idx=0; | 651 | int idx=0; |
| 652 | char *t1; | 652 | char *t1; |
| @@ -660,9 +660,9 @@ int strtoularray(unsigned long *array, char *string, const char *delim) { | |||
| 660 | array[idx]=strtoul(t1,NULL,10); | 660 | array[idx]=strtoul(t1,NULL,10); |
| 661 | idx++; | 661 | idx++; |
| 662 | } else | 662 | } else |
| 663 | return FALSE; | 663 | return false; |
| 664 | } | 664 | } |
| 665 | return TRUE; | 665 | return true; |
| 666 | } | 666 | } |
| 667 | 667 | ||
| 668 | void preparelist(char *string) { | 668 | void preparelist(char *string) { |
diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c index 99537c88..61b2d699 100644 --- a/plugins/check_ntp.c +++ b/plugins/check_ntp.c | |||
| @@ -40,10 +40,10 @@ const char *email = "devel@monitoring-plugins.org"; | |||
| 40 | 40 | ||
| 41 | static char *server_address=NULL; | 41 | static char *server_address=NULL; |
| 42 | static int verbose=0; | 42 | static int verbose=0; |
| 43 | static short do_offset=0; | 43 | static bool do_offset = false; |
| 44 | static char *owarn="60"; | 44 | static char *owarn="60"; |
| 45 | static char *ocrit="120"; | 45 | static char *ocrit="120"; |
| 46 | static short do_jitter=0; | 46 | static bool do_jitter = false; |
| 47 | static char *jwarn="5000"; | 47 | static char *jwarn="5000"; |
| 48 | static char *jcrit="10000"; | 48 | static char *jcrit="10000"; |
| 49 | 49 | ||
| @@ -513,7 +513,8 @@ setup_control_request(ntp_control_message *p, uint8_t opcode, uint16_t seq){ | |||
| 513 | 513 | ||
| 514 | /* XXX handle responses with the error bit set */ | 514 | /* XXX handle responses with the error bit set */ |
| 515 | double jitter_request(int *status){ | 515 | double jitter_request(int *status){ |
| 516 | int conn=-1, i, npeers=0, num_candidates=0, syncsource_found=0; | 516 | int conn=-1, i, npeers=0, num_candidates=0; |
| 517 | bool syncsource_found = false; | ||
| 517 | int run=0, min_peer_sel=PEER_INCLUDED, num_selected=0, num_valid=0; | 518 | int run=0, min_peer_sel=PEER_INCLUDED, num_selected=0, num_valid=0; |
| 518 | int peers_size=0, peer_offset=0; | 519 | int peers_size=0, peer_offset=0; |
| 519 | ntp_assoc_status_pair *peers=NULL; | 520 | ntp_assoc_status_pair *peers=NULL; |
| @@ -570,7 +571,7 @@ double jitter_request(int *status){ | |||
| 570 | if (PEER_SEL(peers[i].status) >= PEER_INCLUDED){ | 571 | if (PEER_SEL(peers[i].status) >= PEER_INCLUDED){ |
| 571 | num_candidates++; | 572 | num_candidates++; |
| 572 | if(PEER_SEL(peers[i].status) >= PEER_SYNCSOURCE){ | 573 | if(PEER_SEL(peers[i].status) >= PEER_SYNCSOURCE){ |
| 573 | syncsource_found=1; | 574 | syncsource_found = true; |
| 574 | min_peer_sel=PEER_SYNCSOURCE; | 575 | min_peer_sel=PEER_SYNCSOURCE; |
| 575 | } | 576 | } |
| 576 | } | 577 | } |
| @@ -699,23 +700,23 @@ int process_arguments(int argc, char **argv){ | |||
| 699 | verbose++; | 700 | verbose++; |
| 700 | break; | 701 | break; |
| 701 | case 'w': | 702 | case 'w': |
| 702 | do_offset=1; | 703 | do_offset = true; |
| 703 | owarn = optarg; | 704 | owarn = optarg; |
| 704 | break; | 705 | break; |
| 705 | case 'c': | 706 | case 'c': |
| 706 | do_offset=1; | 707 | do_offset = true; |
| 707 | ocrit = optarg; | 708 | ocrit = optarg; |
| 708 | break; | 709 | break; |
| 709 | case 'j': | 710 | case 'j': |
| 710 | do_jitter=1; | 711 | do_jitter = true; |
| 711 | jwarn = optarg; | 712 | jwarn = optarg; |
| 712 | break; | 713 | break; |
| 713 | case 'k': | 714 | case 'k': |
| 714 | do_jitter=1; | 715 | do_jitter = true; |
| 715 | jcrit = optarg; | 716 | jcrit = optarg; |
| 716 | break; | 717 | break; |
| 717 | case 'H': | 718 | case 'H': |
| 718 | if(is_host(optarg) == FALSE) | 719 | if(!is_host(optarg)) |
| 719 | usage2(_("Invalid hostname/address"), optarg); | 720 | usage2(_("Invalid hostname/address"), optarg); |
| 720 | server_address = strdup(optarg); | 721 | server_address = strdup(optarg); |
| 721 | break; | 722 | break; |
| @@ -749,9 +750,9 @@ int process_arguments(int argc, char **argv){ | |||
| 749 | char *perfd_offset (double offset) | 750 | char *perfd_offset (double offset) |
| 750 | { | 751 | { |
| 751 | return fperfdata ("offset", offset, "s", | 752 | return fperfdata ("offset", offset, "s", |
| 752 | TRUE, offset_thresholds->warning->end, | 753 | true, offset_thresholds->warning->end, |
| 753 | TRUE, offset_thresholds->critical->end, | 754 | true, offset_thresholds->critical->end, |
| 754 | FALSE, 0, FALSE, 0); | 755 | false, 0, false, 0); |
| 755 | } | 756 | } |
| 756 | 757 | ||
| 757 | char *perfd_jitter (double jitter) | 758 | char *perfd_jitter (double jitter) |
| @@ -759,7 +760,7 @@ char *perfd_jitter (double jitter) | |||
| 759 | return fperfdata ("jitter", jitter, "s", | 760 | return fperfdata ("jitter", jitter, "s", |
| 760 | do_jitter, jitter_thresholds->warning->end, | 761 | do_jitter, jitter_thresholds->warning->end, |
| 761 | do_jitter, jitter_thresholds->critical->end, | 762 | do_jitter, jitter_thresholds->critical->end, |
| 762 | TRUE, 0, FALSE, 0); | 763 | true, 0, false, 0); |
| 763 | } | 764 | } |
| 764 | 765 | ||
| 765 | int main(int argc, char *argv[]){ | 766 | int main(int argc, char *argv[]){ |
diff --git a/plugins/check_ntp_peer.c b/plugins/check_ntp_peer.c index 49cb1008..d4e5fd9a 100644 --- a/plugins/check_ntp_peer.c +++ b/plugins/check_ntp_peer.c | |||
| @@ -46,21 +46,20 @@ const char *email = "devel@monitoring-plugins.org"; | |||
| 46 | static char *server_address=NULL; | 46 | static char *server_address=NULL; |
| 47 | static int port=123; | 47 | static int port=123; |
| 48 | static int verbose=0; | 48 | static int verbose=0; |
| 49 | static int quiet=0; | 49 | static bool quiet = false; |
| 50 | static short do_offset=0; | ||
| 51 | static char *owarn="60"; | 50 | static char *owarn="60"; |
| 52 | static char *ocrit="120"; | 51 | static char *ocrit="120"; |
| 53 | static short do_stratum=0; | 52 | static bool do_stratum = false; |
| 54 | static char *swarn="-1:16"; | 53 | static char *swarn="-1:16"; |
| 55 | static char *scrit="-1:16"; | 54 | static char *scrit="-1:16"; |
| 56 | static short do_jitter=0; | 55 | static bool do_jitter = false; |
| 57 | static char *jwarn="-1:5000"; | 56 | static char *jwarn="-1:5000"; |
| 58 | static char *jcrit="-1:10000"; | 57 | static char *jcrit="-1:10000"; |
| 59 | static short do_truechimers=0; | 58 | static bool do_truechimers = false; |
| 60 | static char *twarn="0:"; | 59 | static char *twarn="0:"; |
| 61 | static char *tcrit="0:"; | 60 | static char *tcrit="0:"; |
| 62 | static int syncsource_found=0; | 61 | static bool syncsource_found = false; |
| 63 | static int li_alarm=0; | 62 | static bool li_alarm = false; |
| 64 | 63 | ||
| 65 | int process_arguments (int, char **); | 64 | int process_arguments (int, char **); |
| 66 | thresholds *offset_thresholds = NULL; | 65 | thresholds *offset_thresholds = NULL; |
| @@ -254,7 +253,7 @@ int ntp_request(double *offset, int *offset_result, double *jitter, int *stratum | |||
| 254 | die(STATE_CRITICAL, "NTP CRITICAL: Invalid packet received from NTP server\n"); | 253 | die(STATE_CRITICAL, "NTP CRITICAL: Invalid packet received from NTP server\n"); |
| 255 | } while (!(req.op&OP_READSTAT && ntohs(req.seq) == 1)); | 254 | } while (!(req.op&OP_READSTAT && ntohs(req.seq) == 1)); |
| 256 | 255 | ||
| 257 | if (LI(req.flags) == LI_ALARM) li_alarm = 1; | 256 | if (LI(req.flags) == LI_ALARM) li_alarm = true; |
| 258 | /* Each peer identifier is 4 bytes in the data section, which | 257 | /* Each peer identifier is 4 bytes in the data section, which |
| 259 | * we represent as a ntp_assoc_status_pair datatype. | 258 | * we represent as a ntp_assoc_status_pair datatype. |
| 260 | */ | 259 | */ |
| @@ -276,7 +275,7 @@ int ntp_request(double *offset, int *offset_result, double *jitter, int *stratum | |||
| 276 | if(PEER_SEL(peers[i].status) >= PEER_INCLUDED){ | 275 | if(PEER_SEL(peers[i].status) >= PEER_INCLUDED){ |
| 277 | num_candidates++; | 276 | num_candidates++; |
| 278 | if(PEER_SEL(peers[i].status) >= PEER_SYNCSOURCE){ | 277 | if(PEER_SEL(peers[i].status) >= PEER_SYNCSOURCE){ |
| 279 | syncsource_found=1; | 278 | syncsource_found = true; |
| 280 | min_peer_sel=PEER_SYNCSOURCE; | 279 | min_peer_sel=PEER_SYNCSOURCE; |
| 281 | } | 280 | } |
| 282 | } | 281 | } |
| @@ -440,7 +439,7 @@ int process_arguments(int argc, char **argv){ | |||
| 440 | if (argc < 2) | 439 | if (argc < 2) |
| 441 | usage ("\n"); | 440 | usage ("\n"); |
| 442 | 441 | ||
| 443 | while (1) { | 442 | while (true) { |
| 444 | c = getopt_long (argc, argv, "Vhv46qw:c:W:C:j:k:m:n:t:H:p:", longopts, &option); | 443 | c = getopt_long (argc, argv, "Vhv46qw:c:W:C:j:k:m:n:t:H:p:", longopts, &option); |
| 445 | if (c == -1 || c == EOF || c == 1) | 444 | if (c == -1 || c == EOF || c == 1) |
| 446 | break; | 445 | break; |
| @@ -458,42 +457,40 @@ int process_arguments(int argc, char **argv){ | |||
| 458 | verbose++; | 457 | verbose++; |
| 459 | break; | 458 | break; |
| 460 | case 'q': | 459 | case 'q': |
| 461 | quiet = 1; | 460 | quiet = true; |
| 462 | break; | 461 | break; |
| 463 | case 'w': | 462 | case 'w': |
| 464 | do_offset=1; | ||
| 465 | owarn = optarg; | 463 | owarn = optarg; |
| 466 | break; | 464 | break; |
| 467 | case 'c': | 465 | case 'c': |
| 468 | do_offset=1; | ||
| 469 | ocrit = optarg; | 466 | ocrit = optarg; |
| 470 | break; | 467 | break; |
| 471 | case 'W': | 468 | case 'W': |
| 472 | do_stratum=1; | 469 | do_stratum = true; |
| 473 | swarn = optarg; | 470 | swarn = optarg; |
| 474 | break; | 471 | break; |
| 475 | case 'C': | 472 | case 'C': |
| 476 | do_stratum=1; | 473 | do_stratum = true; |
| 477 | scrit = optarg; | 474 | scrit = optarg; |
| 478 | break; | 475 | break; |
| 479 | case 'j': | 476 | case 'j': |
| 480 | do_jitter=1; | 477 | do_jitter = true; |
| 481 | jwarn = optarg; | 478 | jwarn = optarg; |
| 482 | break; | 479 | break; |
| 483 | case 'k': | 480 | case 'k': |
| 484 | do_jitter=1; | 481 | do_jitter = true; |
| 485 | jcrit = optarg; | 482 | jcrit = optarg; |
| 486 | break; | 483 | break; |
| 487 | case 'm': | 484 | case 'm': |
| 488 | do_truechimers=1; | 485 | do_truechimers = true; |
| 489 | twarn = optarg; | 486 | twarn = optarg; |
| 490 | break; | 487 | break; |
| 491 | case 'n': | 488 | case 'n': |
| 492 | do_truechimers=1; | 489 | do_truechimers = true; |
| 493 | tcrit = optarg; | 490 | tcrit = optarg; |
| 494 | break; | 491 | break; |
| 495 | case 'H': | 492 | case 'H': |
| 496 | if(is_host(optarg) == FALSE) | 493 | if(!is_host(optarg)) |
| 497 | usage2(_("Invalid hostname/address"), optarg); | 494 | usage2(_("Invalid hostname/address"), optarg); |
| 498 | server_address = strdup(optarg); | 495 | server_address = strdup(optarg); |
| 499 | break; | 496 | break; |
| @@ -530,9 +527,9 @@ int process_arguments(int argc, char **argv){ | |||
| 530 | char *perfd_offset (double offset) | 527 | char *perfd_offset (double offset) |
| 531 | { | 528 | { |
| 532 | return fperfdata ("offset", offset, "s", | 529 | return fperfdata ("offset", offset, "s", |
| 533 | TRUE, offset_thresholds->warning->end, | 530 | true, offset_thresholds->warning->end, |
| 534 | TRUE, offset_thresholds->critical->end, | 531 | true, offset_thresholds->critical->end, |
| 535 | FALSE, 0, FALSE, 0); | 532 | false, 0, false, 0); |
| 536 | } | 533 | } |
| 537 | 534 | ||
| 538 | char *perfd_jitter (double jitter) | 535 | char *perfd_jitter (double jitter) |
| @@ -540,7 +537,7 @@ char *perfd_jitter (double jitter) | |||
| 540 | return fperfdata ("jitter", jitter, "", | 537 | return fperfdata ("jitter", jitter, "", |
| 541 | do_jitter, jitter_thresholds->warning->end, | 538 | do_jitter, jitter_thresholds->warning->end, |
| 542 | do_jitter, jitter_thresholds->critical->end, | 539 | do_jitter, jitter_thresholds->critical->end, |
| 543 | TRUE, 0, FALSE, 0); | 540 | true, 0, false, 0); |
| 544 | } | 541 | } |
| 545 | 542 | ||
| 546 | char *perfd_stratum (int stratum) | 543 | char *perfd_stratum (int stratum) |
| @@ -548,7 +545,7 @@ char *perfd_stratum (int stratum) | |||
| 548 | return perfdata ("stratum", stratum, "", | 545 | return perfdata ("stratum", stratum, "", |
| 549 | do_stratum, (int)stratum_thresholds->warning->end, | 546 | do_stratum, (int)stratum_thresholds->warning->end, |
| 550 | do_stratum, (int)stratum_thresholds->critical->end, | 547 | do_stratum, (int)stratum_thresholds->critical->end, |
| 551 | TRUE, 0, TRUE, 16); | 548 | true, 0, true, 16); |
| 552 | } | 549 | } |
| 553 | 550 | ||
| 554 | char *perfd_truechimers (int num_truechimers) | 551 | char *perfd_truechimers (int num_truechimers) |
| @@ -556,7 +553,7 @@ char *perfd_truechimers (int num_truechimers) | |||
| 556 | return perfdata ("truechimers", num_truechimers, "", | 553 | return perfdata ("truechimers", num_truechimers, "", |
| 557 | do_truechimers, (int)truechimer_thresholds->warning->end, | 554 | do_truechimers, (int)truechimer_thresholds->warning->end, |
| 558 | do_truechimers, (int)truechimer_thresholds->critical->end, | 555 | do_truechimers, (int)truechimer_thresholds->critical->end, |
| 559 | TRUE, 0, FALSE, 0); | 556 | true, 0, false, 0); |
| 560 | } | 557 | } |
| 561 | 558 | ||
| 562 | int main(int argc, char *argv[]){ | 559 | int main(int argc, char *argv[]){ |
| @@ -590,10 +587,10 @@ int main(int argc, char *argv[]){ | |||
| 590 | 587 | ||
| 591 | if(offset_result == STATE_UNKNOWN) { | 588 | if(offset_result == STATE_UNKNOWN) { |
| 592 | /* if there's no sync peer (this overrides ntp_request output): */ | 589 | /* if there's no sync peer (this overrides ntp_request output): */ |
| 593 | result = (quiet == 1 ? STATE_UNKNOWN : STATE_CRITICAL); | 590 | result = (quiet ? STATE_UNKNOWN : STATE_CRITICAL); |
| 594 | } else { | 591 | } else { |
| 595 | /* Be quiet if there's no candidates either */ | 592 | /* Be quiet if there's no candidates either */ |
| 596 | if (quiet == 1 && result == STATE_WARNING) | 593 | if (quiet && result == STATE_WARNING) |
| 597 | result = STATE_UNKNOWN; | 594 | result = STATE_UNKNOWN; |
| 598 | result = max_state_alt(result, get_status(fabs(offset), offset_thresholds)); | 595 | result = max_state_alt(result, get_status(fabs(offset), offset_thresholds)); |
| 599 | } | 596 | } |
diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c index 46cc604f..b2e16556 100644 --- a/plugins/check_ntp_time.c +++ b/plugins/check_ntp_time.c | |||
| @@ -45,7 +45,7 @@ const char *email = "devel@monitoring-plugins.org"; | |||
| 45 | static char *server_address=NULL; | 45 | static char *server_address=NULL; |
| 46 | static char *port="123"; | 46 | static char *port="123"; |
| 47 | static int verbose=0; | 47 | static int verbose=0; |
| 48 | static int quiet=0; | 48 | static bool quiet = false; |
| 49 | static char *owarn="60"; | 49 | static char *owarn="60"; |
| 50 | static char *ocrit="120"; | 50 | static char *ocrit="120"; |
| 51 | static int time_offset=0; | 51 | static 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; |
| @@ -531,12 +531,11 @@ int process_arguments(int argc, char **argv){ | |||
| 531 | return 0; | 531 | return 0; |
| 532 | } | 532 | } |
| 533 | 533 | ||
| 534 | char *perfd_offset (double offset) | 534 | char *perfd_offset (double offset) { |
| 535 | { | ||
| 536 | return fperfdata ("offset", offset, "s", | 535 | return fperfdata ("offset", offset, "s", |
| 537 | TRUE, offset_thresholds->warning->end, | 536 | true, offset_thresholds->warning->end, |
| 538 | TRUE, offset_thresholds->critical->end, | 537 | true, offset_thresholds->critical->end, |
| 539 | FALSE, 0, FALSE, 0); | 538 | false, 0, false, 0); |
| 540 | } | 539 | } |
| 541 | 540 | ||
| 542 | int main(int argc, char *argv[]){ | 541 | int main(int argc, char *argv[]){ |
| @@ -566,7 +565,7 @@ int main(int argc, char *argv[]){ | |||
| 566 | 565 | ||
| 567 | offset = offset_request(server_address, &offset_result); | 566 | offset = offset_request(server_address, &offset_result); |
| 568 | if (offset_result == STATE_UNKNOWN) { | 567 | if (offset_result == STATE_UNKNOWN) { |
| 569 | result = (quiet == 1 ? STATE_UNKNOWN : STATE_CRITICAL); | 568 | result = ( (!quiet) ? STATE_UNKNOWN : STATE_CRITICAL); |
| 570 | } else { | 569 | } else { |
| 571 | result = get_status(fabs(offset), offset_thresholds); | 570 | result = get_status(fabs(offset), offset_thresholds); |
| 572 | } | 571 | } |
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c index 3c9d23e2..12a729e0 100644 --- a/plugins/check_nwstat.c +++ b/plugins/check_nwstat.c | |||
| @@ -104,9 +104,9 @@ char *nss7_name=NULL; | |||
| 104 | int server_port=PORT; | 104 | int server_port=PORT; |
| 105 | unsigned long warning_value=0L; | 105 | unsigned long warning_value=0L; |
| 106 | unsigned long critical_value=0L; | 106 | unsigned long critical_value=0L; |
| 107 | int check_warning_value=FALSE; | 107 | bool check_warning_value = false; |
| 108 | int check_critical_value=FALSE; | 108 | bool check_critical_value = false; |
| 109 | int check_netware_version=FALSE; | 109 | bool check_netware_version = false; |
| 110 | enum checkvar vars_to_check = NONE; | 110 | enum checkvar vars_to_check = NONE; |
| 111 | int sap_number=-1; | 111 | int sap_number=-1; |
| 112 | 112 | ||
| @@ -182,7 +182,7 @@ main(int argc, char **argv) { | |||
| 182 | my_tcp_connect (server_address, server_port, &sd); | 182 | my_tcp_connect (server_address, server_port, &sd); |
| 183 | 183 | ||
| 184 | /* get OS version string */ | 184 | /* get OS version string */ |
| 185 | if (check_netware_version==TRUE) { | 185 | if (check_netware_version) { |
| 186 | send_buffer = strdup ("S19\r\n"); | 186 | send_buffer = strdup ("S19\r\n"); |
| 187 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); | 187 | result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer)); |
| 188 | if (result!=STATE_OK) | 188 | if (result!=STATE_OK) |
| @@ -231,9 +231,9 @@ main(int argc, char **argv) { | |||
| 231 | recv_buffer[strlen(recv_buffer)-1]=0; | 231 | recv_buffer[strlen(recv_buffer)-1]=0; |
| 232 | sprintf(uptime,_("Up %s,"),recv_buffer); | 232 | sprintf(uptime,_("Up %s,"),recv_buffer); |
| 233 | 233 | ||
| 234 | if (check_critical_value==TRUE && utilization >= critical_value) | 234 | if (check_critical_value && utilization >= critical_value) |
| 235 | result=STATE_CRITICAL; | 235 | result=STATE_CRITICAL; |
| 236 | else if (check_warning_value==TRUE && utilization >= warning_value) | 236 | else if (check_warning_value && utilization >= warning_value) |
| 237 | result=STATE_WARNING; | 237 | result=STATE_WARNING; |
| 238 | 238 | ||
| 239 | xasprintf (&output_message, | 239 | xasprintf (&output_message, |
| @@ -259,9 +259,9 @@ main(int argc, char **argv) { | |||
| 259 | return result; | 259 | return result; |
| 260 | current_connections=strtoul(recv_buffer,NULL,10); | 260 | current_connections=strtoul(recv_buffer,NULL,10); |
| 261 | 261 | ||
| 262 | if (check_critical_value==TRUE && current_connections >= critical_value) | 262 | if (check_critical_value && current_connections >= critical_value) |
| 263 | result=STATE_CRITICAL; | 263 | result=STATE_CRITICAL; |
| 264 | else if (check_warning_value==TRUE && current_connections >= warning_value) | 264 | else if (check_warning_value && current_connections >= warning_value) |
| 265 | result=STATE_WARNING; | 265 | result=STATE_WARNING; |
| 266 | 266 | ||
| 267 | xasprintf (&output_message, | 267 | xasprintf (&output_message, |
| @@ -284,9 +284,9 @@ main(int argc, char **argv) { | |||
| 284 | return result; | 284 | return result; |
| 285 | cache_hits=atoi(recv_buffer); | 285 | cache_hits=atoi(recv_buffer); |
| 286 | 286 | ||
| 287 | if (check_critical_value==TRUE && cache_hits <= critical_value) | 287 | if (check_critical_value && cache_hits <= critical_value) |
| 288 | result=STATE_CRITICAL; | 288 | result=STATE_CRITICAL; |
| 289 | else if (check_warning_value==TRUE && cache_hits <= warning_value) | 289 | else if (check_warning_value && cache_hits <= warning_value) |
| 290 | result=STATE_WARNING; | 290 | result=STATE_WARNING; |
| 291 | 291 | ||
| 292 | xasprintf (&output_message, | 292 | xasprintf (&output_message, |
| @@ -306,9 +306,9 @@ main(int argc, char **argv) { | |||
| 306 | return result; | 306 | return result; |
| 307 | cache_buffers=strtoul(recv_buffer,NULL,10); | 307 | cache_buffers=strtoul(recv_buffer,NULL,10); |
| 308 | 308 | ||
| 309 | if (check_critical_value==TRUE && cache_buffers <= critical_value) | 309 | if (check_critical_value && cache_buffers <= critical_value) |
| 310 | result=STATE_CRITICAL; | 310 | result=STATE_CRITICAL; |
| 311 | else if (check_warning_value==TRUE && cache_buffers <= warning_value) | 311 | else if (check_warning_value && cache_buffers <= warning_value) |
| 312 | result=STATE_WARNING; | 312 | result=STATE_WARNING; |
| 313 | 313 | ||
| 314 | xasprintf (&output_message, | 314 | xasprintf (&output_message, |
| @@ -331,9 +331,9 @@ main(int argc, char **argv) { | |||
| 331 | return result; | 331 | return result; |
| 332 | cache_buffers=strtoul(recv_buffer,NULL,10); | 332 | cache_buffers=strtoul(recv_buffer,NULL,10); |
| 333 | 333 | ||
| 334 | if (check_critical_value==TRUE && cache_buffers >= critical_value) | 334 | if (check_critical_value && cache_buffers >= critical_value) |
| 335 | result=STATE_CRITICAL; | 335 | result=STATE_CRITICAL; |
| 336 | else if (check_warning_value==TRUE && cache_buffers >= warning_value) | 336 | else if (check_warning_value && cache_buffers >= warning_value) |
| 337 | result=STATE_WARNING; | 337 | result=STATE_WARNING; |
| 338 | 338 | ||
| 339 | xasprintf (&output_message, | 339 | xasprintf (&output_message, |
| @@ -356,9 +356,9 @@ main(int argc, char **argv) { | |||
| 356 | return result; | 356 | return result; |
| 357 | lru_time=strtoul(recv_buffer,NULL,10); | 357 | lru_time=strtoul(recv_buffer,NULL,10); |
| 358 | 358 | ||
| 359 | if (check_critical_value==TRUE && lru_time <= critical_value) | 359 | if (check_critical_value && lru_time <= critical_value) |
| 360 | result=STATE_CRITICAL; | 360 | result=STATE_CRITICAL; |
| 361 | else if (check_warning_value==TRUE && lru_time <= warning_value) | 361 | else if (check_warning_value && lru_time <= warning_value) |
| 362 | result=STATE_WARNING; | 362 | result=STATE_WARNING; |
| 363 | 363 | ||
| 364 | xasprintf (&output_message, | 364 | xasprintf (&output_message, |
| @@ -383,9 +383,9 @@ main(int argc, char **argv) { | |||
| 383 | result=STATE_CRITICAL; | 383 | result=STATE_CRITICAL; |
| 384 | } else { | 384 | } else { |
| 385 | free_disk_space=strtoul(recv_buffer,NULL,10); | 385 | free_disk_space=strtoul(recv_buffer,NULL,10); |
| 386 | if (check_critical_value==TRUE && free_disk_space <= critical_value) | 386 | if (check_critical_value && free_disk_space <= critical_value) |
| 387 | result=STATE_CRITICAL; | 387 | result=STATE_CRITICAL; |
| 388 | else if (check_warning_value==TRUE && free_disk_space <= warning_value) | 388 | else if (check_warning_value && free_disk_space <= warning_value) |
| 389 | result=STATE_WARNING; | 389 | result=STATE_WARNING; |
| 390 | xasprintf (&output_message, | 390 | xasprintf (&output_message, |
| 391 | _("%s%lu KB free on volume %s|KBFree%s=%lu;%lu;%lu;;"), | 391 | _("%s%lu KB free on volume %s|KBFree%s=%lu;%lu;%lu;;"), |
| @@ -411,9 +411,9 @@ main(int argc, char **argv) { | |||
| 411 | result=STATE_CRITICAL; | 411 | result=STATE_CRITICAL; |
| 412 | } else { | 412 | } else { |
| 413 | free_disk_space=strtoul(recv_buffer,NULL,10); | 413 | free_disk_space=strtoul(recv_buffer,NULL,10); |
| 414 | if (check_critical_value==TRUE && free_disk_space <= critical_value) | 414 | if (check_critical_value && free_disk_space <= critical_value) |
| 415 | result=STATE_CRITICAL; | 415 | result=STATE_CRITICAL; |
| 416 | else if (check_warning_value==TRUE && free_disk_space <= warning_value) | 416 | else if (check_warning_value && free_disk_space <= warning_value) |
| 417 | result=STATE_WARNING; | 417 | result=STATE_WARNING; |
| 418 | xasprintf (&output_message, | 418 | xasprintf (&output_message, |
| 419 | _("%s%lu MB free on volume %s|MBFree%s=%lu;%lu;%lu;;"), | 419 | _("%s%lu MB free on volume %s|MBFree%s=%lu;%lu;%lu;;"), |
| @@ -438,9 +438,9 @@ main(int argc, char **argv) { | |||
| 438 | result=STATE_CRITICAL; | 438 | result=STATE_CRITICAL; |
| 439 | } else { | 439 | } else { |
| 440 | free_disk_space=strtoul(recv_buffer,NULL,10); | 440 | free_disk_space=strtoul(recv_buffer,NULL,10); |
| 441 | if (check_critical_value==TRUE && free_disk_space <= critical_value) | 441 | if (check_critical_value && free_disk_space <= critical_value) |
| 442 | result=STATE_CRITICAL; | 442 | result=STATE_CRITICAL; |
| 443 | else if (check_warning_value==TRUE && free_disk_space <= warning_value) | 443 | else if (check_warning_value && free_disk_space <= warning_value) |
| 444 | result=STATE_WARNING; | 444 | result=STATE_WARNING; |
| 445 | xasprintf (&output_message, | 445 | xasprintf (&output_message, |
| 446 | _("%s%lu MB used on volume %s|MBUsed%s=%lu;%lu;%lu;;"), | 446 | _("%s%lu MB used on volume %s|MBUsed%s=%lu;%lu;%lu;;"), |
| @@ -485,9 +485,9 @@ main(int argc, char **argv) { | |||
| 485 | 485 | ||
| 486 | percent_free_space=(unsigned long)(((double)free_disk_space/(double)total_disk_space)*100.0); | 486 | percent_free_space=(unsigned long)(((double)free_disk_space/(double)total_disk_space)*100.0); |
| 487 | 487 | ||
| 488 | if (check_critical_value==TRUE && percent_free_space <= critical_value) | 488 | if (check_critical_value && percent_free_space <= critical_value) |
| 489 | result=STATE_CRITICAL; | 489 | result=STATE_CRITICAL; |
| 490 | else if (check_warning_value==TRUE && percent_free_space <= warning_value) | 490 | else if (check_warning_value && percent_free_space <= warning_value) |
| 491 | result=STATE_WARNING; | 491 | result=STATE_WARNING; |
| 492 | free_disk_space/=1024; | 492 | free_disk_space/=1024; |
| 493 | total_disk_space/=1024; | 493 | total_disk_space/=1024; |
| @@ -596,14 +596,14 @@ main(int argc, char **argv) { | |||
| 596 | percent_used_packet_receive_buffers=(unsigned long)(((double)used_packet_receive_buffers/(double)max_packet_receive_buffers)*100.0); | 596 | percent_used_packet_receive_buffers=(unsigned long)(((double)used_packet_receive_buffers/(double)max_packet_receive_buffers)*100.0); |
| 597 | 597 | ||
| 598 | if (vars_to_check==UPRB) { | 598 | if (vars_to_check==UPRB) { |
| 599 | if (check_critical_value==TRUE && used_packet_receive_buffers >= critical_value) | 599 | if (check_critical_value && used_packet_receive_buffers >= critical_value) |
| 600 | result=STATE_CRITICAL; | 600 | result=STATE_CRITICAL; |
| 601 | else if (check_warning_value==TRUE && used_packet_receive_buffers >= warning_value) | 601 | else if (check_warning_value && used_packet_receive_buffers >= warning_value) |
| 602 | result=STATE_WARNING; | 602 | result=STATE_WARNING; |
| 603 | } else { | 603 | } else { |
| 604 | if (check_critical_value==TRUE && percent_used_packet_receive_buffers >= critical_value) | 604 | if (check_critical_value && percent_used_packet_receive_buffers >= critical_value) |
| 605 | result=STATE_CRITICAL; | 605 | result=STATE_CRITICAL; |
| 606 | else if (check_warning_value==TRUE && percent_used_packet_receive_buffers >= warning_value) | 606 | else if (check_warning_value && percent_used_packet_receive_buffers >= warning_value) |
| 607 | result=STATE_WARNING; | 607 | result=STATE_WARNING; |
| 608 | } | 608 | } |
| 609 | 609 | ||
| @@ -625,9 +625,9 @@ main(int argc, char **argv) { | |||
| 625 | 625 | ||
| 626 | sap_entries=atoi(recv_buffer); | 626 | sap_entries=atoi(recv_buffer); |
| 627 | 627 | ||
| 628 | if (check_critical_value==TRUE && sap_entries >= critical_value) | 628 | if (check_critical_value && sap_entries >= critical_value) |
| 629 | result=STATE_CRITICAL; | 629 | result=STATE_CRITICAL; |
| 630 | else if (check_warning_value==TRUE && sap_entries >= warning_value) | 630 | else if (check_warning_value && sap_entries >= warning_value) |
| 631 | result=STATE_WARNING; | 631 | result=STATE_WARNING; |
| 632 | 632 | ||
| 633 | if (sap_number==-1) | 633 | if (sap_number==-1) |
| @@ -651,9 +651,9 @@ main(int argc, char **argv) { | |||
| 651 | result=STATE_CRITICAL; | 651 | result=STATE_CRITICAL; |
| 652 | } else { | 652 | } else { |
| 653 | purgeable_disk_space=strtoul(recv_buffer,NULL,10); | 653 | purgeable_disk_space=strtoul(recv_buffer,NULL,10); |
| 654 | if (check_critical_value==TRUE && purgeable_disk_space >= critical_value) | 654 | if (check_critical_value && purgeable_disk_space >= critical_value) |
| 655 | result=STATE_CRITICAL; | 655 | result=STATE_CRITICAL; |
| 656 | else if (check_warning_value==TRUE && purgeable_disk_space >= warning_value) | 656 | else if (check_warning_value && purgeable_disk_space >= warning_value) |
| 657 | result=STATE_WARNING; | 657 | result=STATE_WARNING; |
| 658 | xasprintf (&output_message,_("%s%lu KB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"), | 658 | xasprintf (&output_message,_("%s%lu KB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"), |
| 659 | (result==STATE_OK)?"":_("Only "), | 659 | (result==STATE_OK)?"":_("Only "), |
| @@ -677,9 +677,9 @@ main(int argc, char **argv) { | |||
| 677 | result=STATE_CRITICAL; | 677 | result=STATE_CRITICAL; |
| 678 | } else { | 678 | } else { |
| 679 | purgeable_disk_space=strtoul(recv_buffer,NULL,10); | 679 | purgeable_disk_space=strtoul(recv_buffer,NULL,10); |
| 680 | if (check_critical_value==TRUE && purgeable_disk_space >= critical_value) | 680 | if (check_critical_value && purgeable_disk_space >= critical_value) |
| 681 | result=STATE_CRITICAL; | 681 | result=STATE_CRITICAL; |
| 682 | else if (check_warning_value==TRUE && purgeable_disk_space >= warning_value) | 682 | else if (check_warning_value && purgeable_disk_space >= warning_value) |
| 683 | result=STATE_WARNING; | 683 | result=STATE_WARNING; |
| 684 | xasprintf (&output_message,_("%s%lu MB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"), | 684 | xasprintf (&output_message,_("%s%lu MB purgeable on volume %s|Purge%s=%lu;%lu;%lu;;"), |
| 685 | (result==STATE_OK)?"":_("Only "), | 685 | (result==STATE_OK)?"":_("Only "), |
| @@ -722,9 +722,9 @@ main(int argc, char **argv) { | |||
| 722 | 722 | ||
| 723 | percent_purgeable_space=(unsigned long)(((double)purgeable_disk_space/(double)total_disk_space)*100.0); | 723 | percent_purgeable_space=(unsigned long)(((double)purgeable_disk_space/(double)total_disk_space)*100.0); |
| 724 | 724 | ||
| 725 | if (check_critical_value==TRUE && percent_purgeable_space >= critical_value) | 725 | if (check_critical_value && percent_purgeable_space >= critical_value) |
| 726 | result=STATE_CRITICAL; | 726 | result=STATE_CRITICAL; |
| 727 | else if (check_warning_value==TRUE && percent_purgeable_space >= warning_value) | 727 | else if (check_warning_value && percent_purgeable_space >= warning_value) |
| 728 | result=STATE_WARNING; | 728 | result=STATE_WARNING; |
| 729 | purgeable_disk_space/=1024; | 729 | purgeable_disk_space/=1024; |
| 730 | xasprintf (&output_message,_("%lu MB (%lu%%) purgeable on volume %s|Purgeable%s=%lu;%lu;%lu;0;100"), | 730 | xasprintf (&output_message,_("%lu MB (%lu%%) purgeable on volume %s|Purgeable%s=%lu;%lu;%lu;0;100"), |
| @@ -754,9 +754,9 @@ main(int argc, char **argv) { | |||
| 754 | result=STATE_CRITICAL; | 754 | result=STATE_CRITICAL; |
| 755 | } else { | 755 | } else { |
| 756 | non_purgeable_disk_space=strtoul(recv_buffer,NULL,10); | 756 | non_purgeable_disk_space=strtoul(recv_buffer,NULL,10); |
| 757 | if (check_critical_value==TRUE && non_purgeable_disk_space >= critical_value) | 757 | if (check_critical_value && non_purgeable_disk_space >= critical_value) |
| 758 | result=STATE_CRITICAL; | 758 | result=STATE_CRITICAL; |
| 759 | else if (check_warning_value==TRUE && non_purgeable_disk_space >= warning_value) | 759 | else if (check_warning_value && non_purgeable_disk_space >= warning_value) |
| 760 | result=STATE_WARNING; | 760 | result=STATE_WARNING; |
| 761 | xasprintf (&output_message,_("%s%lu KB not yet purgeable on volume %s"),(result==STATE_OK)?"":_("Only "),non_purgeable_disk_space,volume_name); | 761 | xasprintf (&output_message,_("%s%lu KB not yet purgeable on volume %s"),(result==STATE_OK)?"":_("Only "),non_purgeable_disk_space,volume_name); |
| 762 | } | 762 | } |
| @@ -792,9 +792,9 @@ main(int argc, char **argv) { | |||
| 792 | 792 | ||
| 793 | percent_non_purgeable_space=(unsigned long)(((double)non_purgeable_disk_space/(double)total_disk_space)*100.0); | 793 | percent_non_purgeable_space=(unsigned long)(((double)non_purgeable_disk_space/(double)total_disk_space)*100.0); |
| 794 | 794 | ||
| 795 | if (check_critical_value==TRUE && percent_non_purgeable_space >= critical_value) | 795 | if (check_critical_value && percent_non_purgeable_space >= critical_value) |
| 796 | result=STATE_CRITICAL; | 796 | result=STATE_CRITICAL; |
| 797 | else if (check_warning_value==TRUE && percent_non_purgeable_space >= warning_value) | 797 | else if (check_warning_value && percent_non_purgeable_space >= warning_value) |
| 798 | result=STATE_WARNING; | 798 | result=STATE_WARNING; |
| 799 | purgeable_disk_space/=1024; | 799 | purgeable_disk_space/=1024; |
| 800 | xasprintf (&output_message,_("%lu MB (%lu%%) not yet purgeable on volume %s"),non_purgeable_disk_space,percent_non_purgeable_space,volume_name); | 800 | xasprintf (&output_message,_("%lu MB (%lu%%) not yet purgeable on volume %s"),non_purgeable_disk_space,percent_non_purgeable_space,volume_name); |
| @@ -813,9 +813,9 @@ main(int argc, char **argv) { | |||
| 813 | 813 | ||
| 814 | open_files=atoi(recv_buffer); | 814 | open_files=atoi(recv_buffer); |
| 815 | 815 | ||
| 816 | if (check_critical_value==TRUE && open_files >= critical_value) | 816 | if (check_critical_value && open_files >= critical_value) |
| 817 | result=STATE_CRITICAL; | 817 | result=STATE_CRITICAL; |
| 818 | else if (check_warning_value==TRUE && open_files >= warning_value) | 818 | else if (check_warning_value && open_files >= warning_value) |
| 819 | result=STATE_WARNING; | 819 | result=STATE_WARNING; |
| 820 | 820 | ||
| 821 | xasprintf (&output_message,_("%lu open files|Openfiles=%lu;%lu;%lu;0,0"), | 821 | xasprintf (&output_message,_("%lu open files|Openfiles=%lu;%lu;%lu;0,0"), |
| @@ -838,9 +838,9 @@ main(int argc, char **argv) { | |||
| 838 | 838 | ||
| 839 | abended_threads=atoi(recv_buffer); | 839 | abended_threads=atoi(recv_buffer); |
| 840 | 840 | ||
| 841 | if (check_critical_value==TRUE && abended_threads >= critical_value) | 841 | if (check_critical_value && abended_threads >= critical_value) |
| 842 | result=STATE_CRITICAL; | 842 | result=STATE_CRITICAL; |
| 843 | else if (check_warning_value==TRUE && abended_threads >= warning_value) | 843 | else if (check_warning_value && abended_threads >= warning_value) |
| 844 | result=STATE_WARNING; | 844 | result=STATE_WARNING; |
| 845 | 845 | ||
| 846 | xasprintf (&output_message,_("%lu abended threads|Abends=%lu;%lu;%lu;;"), | 846 | xasprintf (&output_message,_("%lu abended threads|Abends=%lu;%lu;%lu;;"), |
| @@ -872,9 +872,9 @@ main(int argc, char **argv) { | |||
| 872 | 872 | ||
| 873 | current_service_processes=atoi(recv_buffer); | 873 | current_service_processes=atoi(recv_buffer); |
| 874 | 874 | ||
| 875 | if (check_critical_value==TRUE && current_service_processes >= critical_value) | 875 | if (check_critical_value && current_service_processes >= critical_value) |
| 876 | result=STATE_CRITICAL; | 876 | result=STATE_CRITICAL; |
| 877 | else if (check_warning_value==TRUE && current_service_processes >= warning_value) | 877 | else if (check_warning_value && current_service_processes >= warning_value) |
| 878 | result=STATE_WARNING; | 878 | result=STATE_WARNING; |
| 879 | 879 | ||
| 880 | xasprintf (&output_message, | 880 | xasprintf (&output_message, |
| @@ -923,9 +923,9 @@ main(int argc, char **argv) { | |||
| 923 | return result; | 923 | return result; |
| 924 | lru_time=strtoul(recv_buffer,NULL,10); | 924 | lru_time=strtoul(recv_buffer,NULL,10); |
| 925 | 925 | ||
| 926 | if (check_critical_value==TRUE && lru_time <= critical_value) | 926 | if (check_critical_value && lru_time <= critical_value) |
| 927 | result=STATE_CRITICAL; | 927 | result=STATE_CRITICAL; |
| 928 | else if (check_warning_value==TRUE && lru_time <= warning_value) | 928 | else if (check_warning_value && lru_time <= warning_value) |
| 929 | result=STATE_WARNING; | 929 | result=STATE_WARNING; |
| 930 | xasprintf (&output_message,_("LRU sitting time = %lu seconds"),lru_time); | 930 | xasprintf (&output_message,_("LRU sitting time = %lu seconds"),lru_time); |
| 931 | 931 | ||
| @@ -942,9 +942,9 @@ main(int argc, char **argv) { | |||
| 942 | return result; | 942 | return result; |
| 943 | dirty_cache_buffers=atoi(recv_buffer); | 943 | dirty_cache_buffers=atoi(recv_buffer); |
| 944 | 944 | ||
| 945 | if (check_critical_value==TRUE && dirty_cache_buffers <= critical_value) | 945 | if (check_critical_value && dirty_cache_buffers <= critical_value) |
| 946 | result=STATE_CRITICAL; | 946 | result=STATE_CRITICAL; |
| 947 | else if (check_warning_value==TRUE && dirty_cache_buffers <= warning_value) | 947 | else if (check_warning_value && dirty_cache_buffers <= warning_value) |
| 948 | result=STATE_WARNING; | 948 | result=STATE_WARNING; |
| 949 | xasprintf (&output_message,_("Dirty cache buffers = %lu%% of the total|DCB=%lu;%lu;%lu;0;100"), | 949 | xasprintf (&output_message,_("Dirty cache buffers = %lu%% of the total|DCB=%lu;%lu;%lu;0;100"), |
| 950 | dirty_cache_buffers, | 950 | dirty_cache_buffers, |
| @@ -964,9 +964,9 @@ main(int argc, char **argv) { | |||
| 964 | return result; | 964 | return result; |
| 965 | total_cache_buffers=atoi(recv_buffer); | 965 | total_cache_buffers=atoi(recv_buffer); |
| 966 | 966 | ||
| 967 | if (check_critical_value==TRUE && total_cache_buffers <= critical_value) | 967 | if (check_critical_value && total_cache_buffers <= critical_value) |
| 968 | result=STATE_CRITICAL; | 968 | result=STATE_CRITICAL; |
| 969 | else if (check_warning_value==TRUE && total_cache_buffers <= warning_value) | 969 | else if (check_warning_value && total_cache_buffers <= warning_value) |
| 970 | result=STATE_WARNING; | 970 | result=STATE_WARNING; |
| 971 | xasprintf (&output_message,_("Total cache buffers = %lu%% of the original|TCB=%lu;%lu;%lu;0;100"), | 971 | xasprintf (&output_message,_("Total cache buffers = %lu%% of the original|TCB=%lu;%lu;%lu;0;100"), |
| 972 | total_cache_buffers, | 972 | total_cache_buffers, |
| @@ -1034,9 +1034,9 @@ main(int argc, char **argv) { | |||
| 1034 | result=STATE_CRITICAL; | 1034 | result=STATE_CRITICAL; |
| 1035 | } else { | 1035 | } else { |
| 1036 | nrmp_value=strtoul(recv_buffer,NULL,10); | 1036 | nrmp_value=strtoul(recv_buffer,NULL,10); |
| 1037 | if (check_critical_value==TRUE && nrmp_value <= critical_value) | 1037 | if (check_critical_value && nrmp_value <= critical_value) |
| 1038 | result=STATE_CRITICAL; | 1038 | result=STATE_CRITICAL; |
| 1039 | else if (check_warning_value==TRUE && nrmp_value <= warning_value) | 1039 | else if (check_warning_value && nrmp_value <= warning_value) |
| 1040 | result=STATE_WARNING; | 1040 | result=STATE_WARNING; |
| 1041 | xasprintf (&output_message, | 1041 | xasprintf (&output_message, |
| 1042 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1042 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
| @@ -1060,9 +1060,9 @@ main(int argc, char **argv) { | |||
| 1060 | result=STATE_CRITICAL; | 1060 | result=STATE_CRITICAL; |
| 1061 | } else { | 1061 | } else { |
| 1062 | nrmm_value=strtoul(recv_buffer,NULL,10); | 1062 | nrmm_value=strtoul(recv_buffer,NULL,10); |
| 1063 | if (check_critical_value==TRUE && nrmm_value <= critical_value) | 1063 | if (check_critical_value && nrmm_value <= critical_value) |
| 1064 | result=STATE_CRITICAL; | 1064 | result=STATE_CRITICAL; |
| 1065 | else if (check_warning_value==TRUE && nrmm_value <= warning_value) | 1065 | else if (check_warning_value && nrmm_value <= warning_value) |
| 1066 | result=STATE_WARNING; | 1066 | result=STATE_WARNING; |
| 1067 | xasprintf (&output_message, | 1067 | xasprintf (&output_message, |
| 1068 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1068 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
| @@ -1086,9 +1086,9 @@ main(int argc, char **argv) { | |||
| 1086 | result=STATE_CRITICAL; | 1086 | result=STATE_CRITICAL; |
| 1087 | } else { | 1087 | } else { |
| 1088 | nrms_value=strtoul(recv_buffer,NULL,10); | 1088 | nrms_value=strtoul(recv_buffer,NULL,10); |
| 1089 | if (check_critical_value==TRUE && nrms_value >= critical_value) | 1089 | if (check_critical_value && nrms_value >= critical_value) |
| 1090 | result=STATE_CRITICAL; | 1090 | result=STATE_CRITICAL; |
| 1091 | else if (check_warning_value==TRUE && nrms_value >= warning_value) | 1091 | else if (check_warning_value && nrms_value >= warning_value) |
| 1092 | result=STATE_WARNING; | 1092 | result=STATE_WARNING; |
| 1093 | xasprintf (&output_message, | 1093 | xasprintf (&output_message, |
| 1094 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1094 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
| @@ -1112,9 +1112,9 @@ main(int argc, char **argv) { | |||
| 1112 | result=STATE_CRITICAL; | 1112 | result=STATE_CRITICAL; |
| 1113 | } else { | 1113 | } else { |
| 1114 | nss1_value=strtoul(recv_buffer,NULL,10); | 1114 | nss1_value=strtoul(recv_buffer,NULL,10); |
| 1115 | if (check_critical_value==TRUE && nss1_value >= critical_value) | 1115 | if (check_critical_value && nss1_value >= critical_value) |
| 1116 | result=STATE_CRITICAL; | 1116 | result=STATE_CRITICAL; |
| 1117 | else if (check_warning_value==TRUE && nss1_value >= warning_value) | 1117 | else if (check_warning_value && nss1_value >= warning_value) |
| 1118 | result=STATE_WARNING; | 1118 | result=STATE_WARNING; |
| 1119 | xasprintf (&output_message, | 1119 | xasprintf (&output_message, |
| 1120 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1120 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
| @@ -1138,9 +1138,9 @@ main(int argc, char **argv) { | |||
| 1138 | result=STATE_CRITICAL; | 1138 | result=STATE_CRITICAL; |
| 1139 | } else { | 1139 | } else { |
| 1140 | nss2_value=strtoul(recv_buffer,NULL,10); | 1140 | nss2_value=strtoul(recv_buffer,NULL,10); |
| 1141 | if (check_critical_value==TRUE && nss2_value >= critical_value) | 1141 | if (check_critical_value && nss2_value >= critical_value) |
| 1142 | result=STATE_CRITICAL; | 1142 | result=STATE_CRITICAL; |
| 1143 | else if (check_warning_value==TRUE && nss2_value >= warning_value) | 1143 | else if (check_warning_value && nss2_value >= warning_value) |
| 1144 | result=STATE_WARNING; | 1144 | result=STATE_WARNING; |
| 1145 | xasprintf (&output_message, | 1145 | xasprintf (&output_message, |
| 1146 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1146 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
| @@ -1164,9 +1164,9 @@ main(int argc, char **argv) { | |||
| 1164 | result=STATE_CRITICAL; | 1164 | result=STATE_CRITICAL; |
| 1165 | } else { | 1165 | } else { |
| 1166 | nss3_value=strtoul(recv_buffer,NULL,10); | 1166 | nss3_value=strtoul(recv_buffer,NULL,10); |
| 1167 | if (check_critical_value==TRUE && nss3_value >= critical_value) | 1167 | if (check_critical_value && nss3_value >= critical_value) |
| 1168 | result=STATE_CRITICAL; | 1168 | result=STATE_CRITICAL; |
| 1169 | else if (check_warning_value==TRUE && nss3_value >= warning_value) | 1169 | else if (check_warning_value && nss3_value >= warning_value) |
| 1170 | result=STATE_WARNING; | 1170 | result=STATE_WARNING; |
| 1171 | xasprintf (&output_message, | 1171 | xasprintf (&output_message, |
| 1172 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1172 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
| @@ -1190,9 +1190,9 @@ main(int argc, char **argv) { | |||
| 1190 | result=STATE_CRITICAL; | 1190 | result=STATE_CRITICAL; |
| 1191 | } else { | 1191 | } else { |
| 1192 | nss4_value=strtoul(recv_buffer,NULL,10); | 1192 | nss4_value=strtoul(recv_buffer,NULL,10); |
| 1193 | if (check_critical_value==TRUE && nss4_value >= critical_value) | 1193 | if (check_critical_value && nss4_value >= critical_value) |
| 1194 | result=STATE_CRITICAL; | 1194 | result=STATE_CRITICAL; |
| 1195 | else if (check_warning_value==TRUE && nss4_value >= warning_value) | 1195 | else if (check_warning_value && nss4_value >= warning_value) |
| 1196 | result=STATE_WARNING; | 1196 | result=STATE_WARNING; |
| 1197 | xasprintf (&output_message, | 1197 | xasprintf (&output_message, |
| 1198 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1198 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
| @@ -1216,9 +1216,9 @@ main(int argc, char **argv) { | |||
| 1216 | result=STATE_CRITICAL; | 1216 | result=STATE_CRITICAL; |
| 1217 | } else { | 1217 | } else { |
| 1218 | nss5_value=strtoul(recv_buffer,NULL,10); | 1218 | nss5_value=strtoul(recv_buffer,NULL,10); |
| 1219 | if (check_critical_value==TRUE && nss5_value >= critical_value) | 1219 | if (check_critical_value && nss5_value >= critical_value) |
| 1220 | result=STATE_CRITICAL; | 1220 | result=STATE_CRITICAL; |
| 1221 | else if (check_warning_value==TRUE && nss5_value >= warning_value) | 1221 | else if (check_warning_value && nss5_value >= warning_value) |
| 1222 | result=STATE_WARNING; | 1222 | result=STATE_WARNING; |
| 1223 | xasprintf (&output_message, | 1223 | xasprintf (&output_message, |
| 1224 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1224 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
| @@ -1242,9 +1242,9 @@ main(int argc, char **argv) { | |||
| 1242 | result=STATE_CRITICAL; | 1242 | result=STATE_CRITICAL; |
| 1243 | } else { | 1243 | } else { |
| 1244 | nss6_value=strtoul(recv_buffer,NULL,10); | 1244 | nss6_value=strtoul(recv_buffer,NULL,10); |
| 1245 | if (check_critical_value==TRUE && nss6_value >= critical_value) | 1245 | if (check_critical_value && nss6_value >= critical_value) |
| 1246 | result=STATE_CRITICAL; | 1246 | result=STATE_CRITICAL; |
| 1247 | else if (check_warning_value==TRUE && nss6_value >= warning_value) | 1247 | else if (check_warning_value && nss6_value >= warning_value) |
| 1248 | result=STATE_WARNING; | 1248 | result=STATE_WARNING; |
| 1249 | xasprintf (&output_message, | 1249 | xasprintf (&output_message, |
| 1250 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1250 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
| @@ -1268,9 +1268,9 @@ main(int argc, char **argv) { | |||
| 1268 | result=STATE_CRITICAL; | 1268 | result=STATE_CRITICAL; |
| 1269 | } else { | 1269 | } else { |
| 1270 | nss7_value=strtoul(recv_buffer,NULL,10); | 1270 | nss7_value=strtoul(recv_buffer,NULL,10); |
| 1271 | if (check_critical_value==TRUE && nss7_value >= critical_value) | 1271 | if (check_critical_value && nss7_value >= critical_value) |
| 1272 | result=STATE_CRITICAL; | 1272 | result=STATE_CRITICAL; |
| 1273 | else if (check_warning_value==TRUE && nss7_value >= warning_value) | 1273 | else if (check_warning_value && nss7_value >= warning_value) |
| 1274 | result=STATE_WARNING; | 1274 | result=STATE_WARNING; |
| 1275 | xasprintf (&output_message, | 1275 | xasprintf (&output_message, |
| 1276 | _("%s is %lu|%s=%lu;%lu;%lu;;"), | 1276 | _("%s is %lu|%s=%lu;%lu;%lu;;"), |
| @@ -1362,7 +1362,7 @@ int process_arguments(int argc, char **argv) { | |||
| 1362 | server_address=optarg; | 1362 | server_address=optarg; |
| 1363 | break; | 1363 | break; |
| 1364 | case 'o': /* display nos version */ | 1364 | case 'o': /* display nos version */ |
| 1365 | check_netware_version=TRUE; | 1365 | check_netware_version = true; |
| 1366 | break; | 1366 | break; |
| 1367 | case 'p': /* port */ | 1367 | case 'p': /* port */ |
| 1368 | if (is_intnonneg(optarg)) | 1368 | if (is_intnonneg(optarg)) |
| @@ -1569,11 +1569,11 @@ int process_arguments(int argc, char **argv) { | |||
| 1569 | break; | 1569 | break; |
| 1570 | case 'w': /* warning threshold */ | 1570 | case 'w': /* warning threshold */ |
| 1571 | warning_value=strtoul(optarg,NULL,10); | 1571 | warning_value=strtoul(optarg,NULL,10); |
| 1572 | check_warning_value=TRUE; | 1572 | check_warning_value = true; |
| 1573 | break; | 1573 | break; |
| 1574 | case 'c': /* critical threshold */ | 1574 | case 'c': /* critical threshold */ |
| 1575 | critical_value=strtoul(optarg,NULL,10); | 1575 | critical_value=strtoul(optarg,NULL,10); |
| 1576 | check_critical_value=TRUE; | 1576 | check_critical_value = true; |
| 1577 | break; | 1577 | break; |
| 1578 | case 't': /* timeout */ | 1578 | case 't': /* timeout */ |
| 1579 | socket_timeout=atoi(optarg); | 1579 | socket_timeout=atoi(optarg); |
diff --git a/plugins/check_overcr.c b/plugins/check_overcr.c index 9a4d25fa..5165c828 100644 --- a/plugins/check_overcr.c +++ b/plugins/check_overcr.c | |||
| @@ -56,15 +56,15 @@ char *server_address = NULL; | |||
| 56 | int server_port = PORT; | 56 | int server_port = PORT; |
| 57 | double warning_value = 0L; | 57 | double warning_value = 0L; |
| 58 | double critical_value = 0L; | 58 | double critical_value = 0L; |
| 59 | int check_warning_value = FALSE; | 59 | bool check_warning_value = false; |
| 60 | int check_critical_value = FALSE; | 60 | bool check_critical_value = false; |
| 61 | enum checkvar vars_to_check = NONE; | 61 | enum checkvar vars_to_check = NONE; |
| 62 | int cmd_timeout = 1; | 62 | int cmd_timeout = 1; |
| 63 | 63 | ||
| 64 | int netstat_port = 0; | 64 | int netstat_port = 0; |
| 65 | char *disk_name = NULL; | 65 | char *disk_name = NULL; |
| 66 | char *process_name = NULL; | 66 | char *process_name = NULL; |
| 67 | char send_buffer[MAX_INPUT_BUFFER]; | 67 | char send_buffer[MAX_INPUT_BUFFER]; |
| 68 | 68 | ||
| 69 | int process_arguments (int, char **); | 69 | int process_arguments (int, char **); |
| 70 | void print_usage (void); | 70 | void print_usage (void); |
| @@ -77,7 +77,7 @@ main (int argc, char **argv) | |||
| 77 | char recv_buffer[MAX_INPUT_BUFFER]; | 77 | char recv_buffer[MAX_INPUT_BUFFER]; |
| 78 | char temp_buffer[MAX_INPUT_BUFFER]; | 78 | char temp_buffer[MAX_INPUT_BUFFER]; |
| 79 | char *temp_ptr = NULL; | 79 | char *temp_ptr = NULL; |
| 80 | int found_disk = FALSE; | 80 | bool found_disk = false; |
| 81 | unsigned long percent_used_disk_space = 100; | 81 | unsigned long percent_used_disk_space = 100; |
| 82 | double load; | 82 | double load; |
| 83 | double load_1min; | 83 | double load_1min; |
| @@ -155,9 +155,9 @@ main (int argc, char **argv) | |||
| 155 | break; | 155 | break; |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | if (check_critical_value == TRUE && (load >= critical_value)) | 158 | if (check_critical_value && (load >= critical_value)) |
| 159 | result = STATE_CRITICAL; | 159 | result = STATE_CRITICAL; |
| 160 | else if (check_warning_value == TRUE && (load >= warning_value)) | 160 | else if (check_warning_value && (load >= warning_value)) |
| 161 | result = STATE_WARNING; | 161 | result = STATE_WARNING; |
| 162 | 162 | ||
| 163 | die (result, | 163 | die (result, |
| @@ -178,7 +178,7 @@ main (int argc, char **argv) | |||
| 178 | temp_ptr = (char *) strtok (NULL, " ")) { | 178 | temp_ptr = (char *) strtok (NULL, " ")) { |
| 179 | 179 | ||
| 180 | if (!strcmp (temp_ptr, disk_name)) { | 180 | if (!strcmp (temp_ptr, disk_name)) { |
| 181 | found_disk = TRUE; | 181 | found_disk = true; |
| 182 | temp_ptr = (char *) strtok (NULL, "%"); | 182 | temp_ptr = (char *) strtok (NULL, "%"); |
| 183 | if (temp_ptr == NULL) | 183 | if (temp_ptr == NULL) |
| 184 | die (STATE_CRITICAL, _("Invalid response from server\n")); | 184 | die (STATE_CRITICAL, _("Invalid response from server\n")); |
| @@ -191,14 +191,14 @@ main (int argc, char **argv) | |||
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | /* error if we couldn't find the info for the disk */ | 193 | /* error if we couldn't find the info for the disk */ |
| 194 | if (found_disk == FALSE) | 194 | if (!found_disk) |
| 195 | die (STATE_CRITICAL, | 195 | die (STATE_CRITICAL, |
| 196 | "CRITICAL - Disk '%s' non-existent or not mounted", | 196 | "CRITICAL - Disk '%s' non-existent or not mounted", |
| 197 | disk_name); | 197 | disk_name); |
| 198 | 198 | ||
| 199 | if (check_critical_value == TRUE && (percent_used_disk_space >= critical_value)) | 199 | if (check_critical_value && (percent_used_disk_space >= critical_value)) |
| 200 | result = STATE_CRITICAL; | 200 | result = STATE_CRITICAL; |
| 201 | else if (check_warning_value == TRUE && (percent_used_disk_space >= warning_value)) | 201 | else if (check_warning_value && (percent_used_disk_space >= warning_value)) |
| 202 | result = STATE_WARNING; | 202 | result = STATE_WARNING; |
| 203 | 203 | ||
| 204 | die (result, "Disk %s - %lu%% used on %s", state_text(result), percent_used_disk_space, disk_name); | 204 | die (result, "Disk %s - %lu%% used on %s", state_text(result), percent_used_disk_space, disk_name); |
| @@ -212,9 +212,9 @@ main (int argc, char **argv) | |||
| 212 | else | 212 | else |
| 213 | port_connections = strtod (recv_buffer, NULL); | 213 | port_connections = strtod (recv_buffer, NULL); |
| 214 | 214 | ||
| 215 | if (check_critical_value == TRUE && (port_connections >= critical_value)) | 215 | if (check_critical_value && (port_connections >= critical_value)) |
| 216 | result = STATE_CRITICAL; | 216 | result = STATE_CRITICAL; |
| 217 | else if (check_warning_value == TRUE && (port_connections >= warning_value)) | 217 | else if (check_warning_value && (port_connections >= warning_value)) |
| 218 | result = STATE_WARNING; | 218 | result = STATE_WARNING; |
| 219 | 219 | ||
| 220 | die (result, | 220 | die (result, |
| @@ -241,9 +241,9 @@ main (int argc, char **argv) | |||
| 241 | else | 241 | else |
| 242 | processes = strtod (temp_ptr, NULL); | 242 | processes = strtod (temp_ptr, NULL); |
| 243 | 243 | ||
| 244 | if (check_critical_value == TRUE && (processes >= critical_value)) | 244 | if (check_critical_value && (processes >= critical_value)) |
| 245 | result = STATE_CRITICAL; | 245 | result = STATE_CRITICAL; |
| 246 | else if (check_warning_value == TRUE && (processes >= warning_value)) | 246 | else if (check_warning_value && (processes >= warning_value)) |
| 247 | result = STATE_WARNING; | 247 | result = STATE_WARNING; |
| 248 | 248 | ||
| 249 | die (result, | 249 | die (result, |
| @@ -262,9 +262,9 @@ main (int argc, char **argv) | |||
| 262 | uptime_raw_hours = strtod (recv_buffer, NULL); | 262 | uptime_raw_hours = strtod (recv_buffer, NULL); |
| 263 | uptime_raw_minutes = (unsigned long) (uptime_raw_hours * 60.0); | 263 | uptime_raw_minutes = (unsigned long) (uptime_raw_hours * 60.0); |
| 264 | 264 | ||
| 265 | if (check_critical_value == TRUE && (uptime_raw_minutes <= critical_value)) | 265 | if (check_critical_value && (uptime_raw_minutes <= critical_value)) |
| 266 | result = STATE_CRITICAL; | 266 | result = STATE_CRITICAL; |
| 267 | else if (check_warning_value == TRUE && (uptime_raw_minutes <= warning_value)) | 267 | else if (check_warning_value && (uptime_raw_minutes <= warning_value)) |
| 268 | result = STATE_WARNING; | 268 | result = STATE_WARNING; |
| 269 | 269 | ||
| 270 | uptime_days = uptime_raw_minutes / 1440; | 270 | uptime_days = uptime_raw_minutes / 1440; |
| @@ -388,11 +388,11 @@ process_arguments (int argc, char **argv) | |||
| 388 | break; | 388 | break; |
| 389 | case 'w': /* warning threshold */ | 389 | case 'w': /* warning threshold */ |
| 390 | warning_value = strtoul (optarg, NULL, 10); | 390 | warning_value = strtoul (optarg, NULL, 10); |
| 391 | check_warning_value = TRUE; | 391 | check_warning_value = true; |
| 392 | break; | 392 | break; |
| 393 | case 'c': /* critical threshold */ | 393 | case 'c': /* critical threshold */ |
| 394 | critical_value = strtoul (optarg, NULL, 10); | 394 | critical_value = strtoul (optarg, NULL, 10); |
| 395 | check_critical_value = TRUE; | 395 | check_critical_value = true; |
| 396 | break; | 396 | break; |
| 397 | case 't': /* timeout */ | 397 | case 't': /* timeout */ |
| 398 | socket_timeout = atoi (optarg); | 398 | socket_timeout = atoi (optarg); |
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index 61990335..94d589e1 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c | |||
| @@ -69,7 +69,7 @@ int process_arguments (int, char **); | |||
| 69 | int validate_arguments (void); | 69 | int validate_arguments (void); |
| 70 | void print_usage (void); | 70 | void print_usage (void); |
| 71 | void print_help (void); | 71 | void print_help (void); |
| 72 | int is_pg_logname (char *); | 72 | bool is_pg_logname (char *); |
| 73 | int do_query (PGconn *, char *); | 73 | int do_query (PGconn *, char *); |
| 74 | 74 | ||
| 75 | char *pghost = NULL; /* host name of the backend server */ | 75 | char *pghost = NULL; /* host name of the backend server */ |
| @@ -252,7 +252,7 @@ main (int argc, char **argv) | |||
| 252 | printf (_(" %s - database %s (%f sec.)|%s\n"), | 252 | printf (_(" %s - database %s (%f sec.)|%s\n"), |
| 253 | state_text(status), dbName, elapsed_time, | 253 | state_text(status), dbName, elapsed_time, |
| 254 | fperfdata("time", elapsed_time, "s", | 254 | fperfdata("time", elapsed_time, "s", |
| 255 | !!(twarn > 0.0), twarn, !!(tcrit > 0.0), tcrit, TRUE, 0, FALSE,0)); | 255 | !!(twarn > 0.0), twarn, !!(tcrit > 0.0), tcrit, true, 0, false,0)); |
| 256 | 256 | ||
| 257 | if (pgquery) | 257 | if (pgquery) |
| 258 | query_status = do_query (conn, pgquery); | 258 | query_status = do_query (conn, pgquery); |
| @@ -393,7 +393,7 @@ process_arguments (int argc, char **argv) | |||
| 393 | 393 | ||
| 394 | <para>&PROTO_validate_arguments;</para> | 394 | <para>&PROTO_validate_arguments;</para> |
| 395 | 395 | ||
| 396 | <para>Given a database name, this function returns TRUE if the string | 396 | <para>Given a database name, this function returns true if the string |
| 397 | is a valid PostgreSQL database name, and returns false if it is | 397 | is a valid PostgreSQL database name, and returns false if it is |
| 398 | not.</para> | 398 | not.</para> |
| 399 | 399 | ||
| @@ -424,7 +424,7 @@ function prototype | |||
| 424 | 424 | ||
| 425 | <para>&PROTO_is_pg_logname;</para> | 425 | <para>&PROTO_is_pg_logname;</para> |
| 426 | 426 | ||
| 427 | <para>Given a username, this function returns TRUE if the string is a | 427 | <para>Given a username, this function returns true if the string is a |
| 428 | valid PostgreSQL username, and returns false if it is not. Valid PostgreSQL | 428 | valid PostgreSQL username, and returns false if it is not. Valid PostgreSQL |
| 429 | usernames are less than &NAMEDATALEN; characters long and consist of | 429 | usernames are less than &NAMEDATALEN; characters long and consist of |
| 430 | letters, numbers, dashes, and underscores, plus possibly some other | 430 | letters, numbers, dashes, and underscores, plus possibly some other |
| @@ -439,12 +439,10 @@ should be added.</para> | |||
| 439 | 439 | ||
| 440 | 440 | ||
| 441 | 441 | ||
| 442 | int | 442 | bool is_pg_logname (char *username) { |
| 443 | is_pg_logname (char *username) | ||
| 444 | { | ||
| 445 | if (strlen (username) > NAMEDATALEN - 1) | 443 | if (strlen (username) > NAMEDATALEN - 1) |
| 446 | return (FALSE); | 444 | return (false); |
| 447 | return (TRUE); | 445 | return (true); |
| 448 | } | 446 | } |
| 449 | 447 | ||
| 450 | /****************************************************************************** | 448 | /****************************************************************************** |
diff --git a/plugins/check_ping.c b/plugins/check_ping.c index 741f732e..6e162e6a 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 | ||
diff --git a/plugins/check_radius.c b/plugins/check_radius.c index b1b4938c..6b32710a 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c | |||
| @@ -93,7 +93,7 @@ char *expect = NULL; | |||
| 93 | char *config_file = NULL; | 93 | char *config_file = NULL; |
| 94 | unsigned short port = PW_AUTH_UDP_PORT; | 94 | unsigned short port = PW_AUTH_UDP_PORT; |
| 95 | int retries = 1; | 95 | int retries = 1; |
| 96 | int verbose = FALSE; | 96 | bool verbose = false; |
| 97 | 97 | ||
| 98 | /****************************************************************************** | 98 | /****************************************************************************** |
| 99 | 99 | ||
| @@ -272,10 +272,10 @@ process_arguments (int argc, char **argv) | |||
| 272 | print_revision (progname, NP_VERSION); | 272 | print_revision (progname, NP_VERSION); |
| 273 | exit (STATE_UNKNOWN); | 273 | exit (STATE_UNKNOWN); |
| 274 | case 'v': /* verbose mode */ | 274 | case 'v': /* verbose mode */ |
| 275 | verbose = TRUE; | 275 | verbose = true; |
| 276 | break; | 276 | break; |
| 277 | case 'H': /* hostname */ | 277 | case 'H': /* hostname */ |
| 278 | if (is_host (optarg) == FALSE) { | 278 | if (!is_host (optarg)) { |
| 279 | usage2 (_("Invalid hostname/address"), optarg); | 279 | usage2 (_("Invalid hostname/address"), optarg); |
| 280 | } | 280 | } |
| 281 | server = optarg; | 281 | server = optarg; |
diff --git a/plugins/check_real.c b/plugins/check_real.c index fbdb70f3..15e035b6 100644 --- a/plugins/check_real.c +++ b/plugins/check_real.c | |||
| @@ -54,10 +54,10 @@ char *host_name; | |||
| 54 | char *server_url = NULL; | 54 | char *server_url = NULL; |
| 55 | char *server_expect; | 55 | char *server_expect; |
| 56 | int warning_time = 0; | 56 | int warning_time = 0; |
| 57 | int check_warning_time = FALSE; | 57 | bool check_warning_time = false; |
| 58 | int critical_time = 0; | 58 | int critical_time = 0; |
| 59 | int check_critical_time = FALSE; | 59 | bool check_critical_time = false; |
| 60 | int verbose = FALSE; | 60 | bool verbose = false; |
| 61 | 61 | ||
| 62 | 62 | ||
| 63 | 63 | ||
| @@ -238,9 +238,9 @@ main (int argc, char **argv) | |||
| 238 | /* Return results */ | 238 | /* Return results */ |
| 239 | if (result == STATE_OK) { | 239 | if (result == STATE_OK) { |
| 240 | 240 | ||
| 241 | if (check_critical_time == TRUE | 241 | if (check_critical_time |
| 242 | && (end_time - start_time) > critical_time) result = STATE_CRITICAL; | 242 | && (end_time - start_time) > critical_time) result = STATE_CRITICAL; |
| 243 | else if (check_warning_time == TRUE | 243 | else if (check_warning_time |
| 244 | && (end_time - start_time) > warning_time) result = | 244 | && (end_time - start_time) > warning_time) result = |
| 245 | STATE_WARNING; | 245 | STATE_WARNING; |
| 246 | 246 | ||
| @@ -331,7 +331,7 @@ process_arguments (int argc, char **argv) | |||
| 331 | case 'w': /* warning time threshold */ | 331 | case 'w': /* warning time threshold */ |
| 332 | if (is_intnonneg (optarg)) { | 332 | if (is_intnonneg (optarg)) { |
| 333 | warning_time = atoi (optarg); | 333 | warning_time = atoi (optarg); |
| 334 | check_warning_time = TRUE; | 334 | check_warning_time = true; |
| 335 | } | 335 | } |
| 336 | else { | 336 | else { |
| 337 | usage4 (_("Warning time must be a positive integer")); | 337 | usage4 (_("Warning time must be a positive integer")); |
| @@ -340,14 +340,14 @@ process_arguments (int argc, char **argv) | |||
| 340 | case 'c': /* critical time threshold */ | 340 | case 'c': /* critical time threshold */ |
| 341 | if (is_intnonneg (optarg)) { | 341 | if (is_intnonneg (optarg)) { |
| 342 | critical_time = atoi (optarg); | 342 | critical_time = atoi (optarg); |
| 343 | check_critical_time = TRUE; | 343 | check_critical_time = true; |
| 344 | } | 344 | } |
| 345 | else { | 345 | else { |
| 346 | usage4 (_("Critical time must be a positive integer")); | 346 | usage4 (_("Critical time must be a positive integer")); |
| 347 | } | 347 | } |
| 348 | break; | 348 | break; |
| 349 | case 'v': /* verbose */ | 349 | case 'v': /* verbose */ |
| 350 | verbose = TRUE; | 350 | verbose = true; |
| 351 | break; | 351 | break; |
| 352 | case 't': /* timeout */ | 352 | case 't': /* timeout */ |
| 353 | if (is_intnonneg (optarg)) { | 353 | if (is_intnonneg (optarg)) { |
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index fc0ae2c4..d1c24666 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c | |||
| @@ -40,7 +40,7 @@ const char *email = "devel@monitoring-plugins.org"; | |||
| 40 | #include <ctype.h> | 40 | #include <ctype.h> |
| 41 | 41 | ||
| 42 | #ifdef HAVE_SSL | 42 | #ifdef HAVE_SSL |
| 43 | int check_cert = FALSE; | 43 | bool check_cert = false; |
| 44 | int days_till_exp_warn, days_till_exp_crit; | 44 | int days_till_exp_warn, days_till_exp_crit; |
| 45 | # define my_recv(buf, len) (((use_starttls || use_ssl) && ssl_established) ? np_net_ssl_read(buf, len) : read(sd, buf, len)) | 45 | # define my_recv(buf, len) (((use_starttls || use_ssl) && ssl_established) ? np_net_ssl_read(buf, len) : read(sd, buf, len)) |
| 46 | # define my_send(buf, len) (((use_starttls || use_ssl) && ssl_established) ? np_net_ssl_write(buf, len) : send(sd, buf, len, 0)) | 46 | # define my_send(buf, len) (((use_starttls || use_ssl) && ssl_established) ? np_net_ssl_write(buf, len) : send(sd, buf, len, 0)) |
| @@ -100,17 +100,17 @@ char *authtype = NULL; | |||
| 100 | char *authuser = NULL; | 100 | char *authuser = NULL; |
| 101 | char *authpass = NULL; | 101 | char *authpass = NULL; |
| 102 | double warning_time = 0; | 102 | double warning_time = 0; |
| 103 | int check_warning_time = FALSE; | 103 | bool check_warning_time = false; |
| 104 | double critical_time = 0; | 104 | double critical_time = 0; |
| 105 | int check_critical_time = FALSE; | 105 | bool check_critical_time = false; |
| 106 | int verbose = 0; | 106 | int verbose = 0; |
| 107 | int use_ssl = FALSE; | 107 | bool use_ssl = false; |
| 108 | int use_starttls = FALSE; | 108 | bool use_starttls = false; |
| 109 | int use_sni = FALSE; | 109 | bool use_sni = false; |
| 110 | short use_proxy_prefix = FALSE; | 110 | bool use_proxy_prefix = false; |
| 111 | short use_ehlo = FALSE; | 111 | bool use_ehlo = false; |
| 112 | short use_lhlo = FALSE; | 112 | bool use_lhlo = false; |
| 113 | short ssl_established = 0; | 113 | bool ssl_established = false; |
| 114 | char *localhostname = NULL; | 114 | char *localhostname = NULL; |
| 115 | int sd; | 115 | int sd; |
| 116 | char buffer[MAX_INPUT_BUFFER]; | 116 | char buffer[MAX_INPUT_BUFFER]; |
| @@ -118,13 +118,13 @@ enum { | |||
| 118 | TCP_PROTOCOL = 1, | 118 | TCP_PROTOCOL = 1, |
| 119 | UDP_PROTOCOL = 2, | 119 | UDP_PROTOCOL = 2, |
| 120 | }; | 120 | }; |
| 121 | int ignore_send_quit_failure = FALSE; | 121 | bool ignore_send_quit_failure = false; |
| 122 | 122 | ||
| 123 | 123 | ||
| 124 | int | 124 | int |
| 125 | main (int argc, char **argv) | 125 | main (int argc, char **argv) |
| 126 | { | 126 | { |
| 127 | short supports_tls=FALSE; | 127 | bool supports_tls = false; |
| 128 | int n = 0; | 128 | int n = 0; |
| 129 | double elapsed_time; | 129 | double elapsed_time; |
| 130 | long microsec; | 130 | long microsec; |
| @@ -230,7 +230,7 @@ main (int argc, char **argv) | |||
| 230 | } else if(use_ehlo || use_lhlo){ | 230 | } else if(use_ehlo || use_lhlo){ |
| 231 | if(strstr(buffer, "250 STARTTLS") != NULL || | 231 | if(strstr(buffer, "250 STARTTLS") != NULL || |
| 232 | strstr(buffer, "250-STARTTLS") != NULL){ | 232 | strstr(buffer, "250-STARTTLS") != NULL){ |
| 233 | supports_tls=TRUE; | 233 | supports_tls=true; |
| 234 | } | 234 | } |
| 235 | } | 235 | } |
| 236 | 236 | ||
| @@ -466,7 +466,7 @@ main (int argc, char **argv) | |||
| 466 | fperfdata ("time", elapsed_time, "s", | 466 | fperfdata ("time", elapsed_time, "s", |
| 467 | (int)check_warning_time, warning_time, | 467 | (int)check_warning_time, warning_time, |
| 468 | (int)check_critical_time, critical_time, | 468 | (int)check_critical_time, critical_time, |
| 469 | TRUE, 0, FALSE, 0)); | 469 | true, 0, false, 0)); |
| 470 | 470 | ||
| 471 | return result; | 471 | return result; |
| 472 | } | 472 | } |
| @@ -560,7 +560,7 @@ process_arguments (int argc, char **argv) | |||
| 560 | break; | 560 | break; |
| 561 | case 'A': | 561 | case 'A': |
| 562 | authtype = optarg; | 562 | authtype = optarg; |
| 563 | use_ehlo = TRUE; | 563 | use_ehlo = true; |
| 564 | break; | 564 | break; |
| 565 | case 'U': | 565 | case 'U': |
| 566 | authuser = optarg; | 566 | authuser = optarg; |
| @@ -600,7 +600,7 @@ process_arguments (int argc, char **argv) | |||
| 600 | usage4 (_("Critical time must be a positive")); | 600 | usage4 (_("Critical time must be a positive")); |
| 601 | else { | 601 | else { |
| 602 | critical_time = strtod (optarg, NULL); | 602 | critical_time = strtod (optarg, NULL); |
| 603 | check_critical_time = TRUE; | 603 | check_critical_time = true; |
| 604 | } | 604 | } |
| 605 | break; | 605 | break; |
| 606 | case 'w': /* warning time threshold */ | 606 | case 'w': /* warning time threshold */ |
| @@ -608,14 +608,14 @@ process_arguments (int argc, char **argv) | |||
| 608 | usage4 (_("Warning time must be a positive")); | 608 | usage4 (_("Warning time must be a positive")); |
| 609 | else { | 609 | else { |
| 610 | warning_time = strtod (optarg, NULL); | 610 | warning_time = strtod (optarg, NULL); |
| 611 | check_warning_time = TRUE; | 611 | check_warning_time = true; |
| 612 | } | 612 | } |
| 613 | break; | 613 | break; |
| 614 | case 'v': /* verbose */ | 614 | case 'v': /* verbose */ |
| 615 | verbose++; | 615 | verbose++; |
| 616 | break; | 616 | break; |
| 617 | case 'q': | 617 | case 'q': |
| 618 | ignore_send_quit_failure++; /* ignore problem sending QUIT */ | 618 | ignore_send_quit_failure = true; /* ignore problem sending QUIT */ |
| 619 | break; | 619 | break; |
| 620 | case 't': /* timeout */ | 620 | case 't': /* timeout */ |
| 621 | if (is_intnonneg (optarg)) { | 621 | if (is_intnonneg (optarg)) { |
| @@ -645,33 +645,33 @@ process_arguments (int argc, char **argv) | |||
| 645 | usage2 ("Invalid certificate expiration period", optarg); | 645 | usage2 ("Invalid certificate expiration period", optarg); |
| 646 | days_till_exp_warn = atoi (optarg); | 646 | days_till_exp_warn = atoi (optarg); |
| 647 | } | 647 | } |
| 648 | check_cert = TRUE; | 648 | check_cert = true; |
| 649 | ignore_send_quit_failure = TRUE; | 649 | ignore_send_quit_failure = true; |
| 650 | #else | 650 | #else |
| 651 | usage (_("SSL support not available - install OpenSSL and recompile")); | 651 | usage (_("SSL support not available - install OpenSSL and recompile")); |
| 652 | #endif | 652 | #endif |
| 653 | case 's': | 653 | case 's': |
| 654 | /* ssl */ | 654 | /* ssl */ |
| 655 | use_ssl = TRUE; | 655 | use_ssl = true; |
| 656 | server_port = SMTPS_PORT; | 656 | server_port = SMTPS_PORT; |
| 657 | break; | 657 | break; |
| 658 | case 'S': | 658 | case 'S': |
| 659 | /* starttls */ | 659 | /* starttls */ |
| 660 | use_starttls = TRUE; | 660 | use_starttls = true; |
| 661 | use_ehlo = TRUE; | 661 | use_ehlo = true; |
| 662 | break; | 662 | break; |
| 663 | case SNI_OPTION: | 663 | case SNI_OPTION: |
| 664 | #ifdef HAVE_SSL | 664 | #ifdef HAVE_SSL |
| 665 | use_sni = TRUE; | 665 | use_sni = true; |
| 666 | #else | 666 | #else |
| 667 | usage (_("SSL support not available - install OpenSSL and recompile")); | 667 | usage (_("SSL support not available - install OpenSSL and recompile")); |
| 668 | #endif | 668 | #endif |
| 669 | break; | 669 | break; |
| 670 | case 'r': | 670 | case 'r': |
| 671 | use_proxy_prefix = TRUE; | 671 | use_proxy_prefix = true; |
| 672 | break; | 672 | break; |
| 673 | case 'L': | 673 | case 'L': |
| 674 | use_lhlo = TRUE; | 674 | use_lhlo = true; |
| 675 | break; | 675 | break; |
| 676 | case '4': | 676 | case '4': |
| 677 | address_family = AF_INET; | 677 | address_family = AF_INET; |
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 56a586ad..405ede3a 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
| @@ -135,7 +135,7 @@ int numoids = 0; | |||
| 135 | int numauthpriv = 0; | 135 | int numauthpriv = 0; |
| 136 | int numcontext = 0; | 136 | int numcontext = 0; |
| 137 | int verbose = 0; | 137 | int verbose = 0; |
| 138 | int usesnmpgetnext = FALSE; | 138 | bool usesnmpgetnext = false; |
| 139 | char *warning_thresholds = NULL; | 139 | char *warning_thresholds = NULL; |
| 140 | char *critical_thresholds = NULL; | 140 | char *critical_thresholds = NULL; |
| 141 | thresholds **thlds; | 141 | thresholds **thlds; |
| @@ -148,7 +148,7 @@ size_t eval_size = OID_COUNT_STEP; | |||
| 148 | char *delimiter; | 148 | char *delimiter; |
| 149 | char *output_delim; | 149 | char *output_delim; |
| 150 | char *miblist = NULL; | 150 | char *miblist = NULL; |
| 151 | int needmibs = FALSE; | 151 | bool needmibs = false; |
| 152 | int calculate_rate = 0; | 152 | int calculate_rate = 0; |
| 153 | double offset = 0.0; | 153 | double offset = 0.0; |
| 154 | int rate_multiplier = 1; | 154 | int rate_multiplier = 1; |
| @@ -302,7 +302,7 @@ main (int argc, char **argv) | |||
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | /* Create the command array to execute */ | 304 | /* Create the command array to execute */ |
| 305 | if(usesnmpgetnext == TRUE) { | 305 | if(usesnmpgetnext) { |
| 306 | snmpcmd = strdup (PATH_TO_SNMPGETNEXT); | 306 | snmpcmd = strdup (PATH_TO_SNMPGETNEXT); |
| 307 | }else{ | 307 | }else{ |
| 308 | snmpcmd = strdup (PATH_TO_SNMPGET); | 308 | snmpcmd = strdup (PATH_TO_SNMPGET); |
| @@ -777,7 +777,7 @@ process_arguments (int argc, char **argv) | |||
| 777 | miblist = optarg; | 777 | miblist = optarg; |
| 778 | break; | 778 | break; |
| 779 | case 'n': /* usesnmpgetnext */ | 779 | case 'n': /* usesnmpgetnext */ |
| 780 | usesnmpgetnext = TRUE; | 780 | usesnmpgetnext = true; |
| 781 | break; | 781 | break; |
| 782 | case 'P': /* SNMP protocol version */ | 782 | case 'P': /* SNMP protocol version */ |
| 783 | proto = optarg; | 783 | proto = optarg; |
| @@ -831,7 +831,7 @@ process_arguments (int argc, char **argv) | |||
| 831 | * so we have a mib variable, rather than just an SNMP OID, | 831 | * so we have a mib variable, rather than just an SNMP OID, |
| 832 | * so we have to actually read the mib files | 832 | * so we have to actually read the mib files |
| 833 | */ | 833 | */ |
| 834 | needmibs = TRUE; | 834 | needmibs = true; |
| 835 | } | 835 | } |
| 836 | for (ptr = strtok(optarg, ", "); ptr != NULL; ptr = strtok(NULL, ", "), j++) { | 836 | for (ptr = strtok(optarg, ", "); ptr != NULL; ptr = strtok(NULL, ", "), j++) { |
| 837 | while (j >= oids_size) { | 837 | while (j >= oids_size) { |
| @@ -1034,7 +1034,7 @@ validate_arguments () | |||
| 1034 | { | 1034 | { |
| 1035 | /* check whether to load locally installed MIBS (CPU/disk intensive) */ | 1035 | /* check whether to load locally installed MIBS (CPU/disk intensive) */ |
| 1036 | if (miblist == NULL) { | 1036 | if (miblist == NULL) { |
| 1037 | if ( needmibs == TRUE ) { | 1037 | if (needmibs) { |
| 1038 | miblist = strdup (DEFAULT_MIBLIST); | 1038 | miblist = strdup (DEFAULT_MIBLIST); |
| 1039 | }else{ | 1039 | }else{ |
| 1040 | miblist = ""; /* don't read any mib files for numeric oids */ | 1040 | miblist = ""; /* don't read any mib files for numeric oids */ |
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c index 8ccbd5a7..4eb746cb 100644 --- a/plugins/check_ssh.c +++ b/plugins/check_ssh.c | |||
| @@ -47,7 +47,7 @@ int port = -1; | |||
| 47 | char *server_name = NULL; | 47 | char *server_name = NULL; |
| 48 | char *remote_version = NULL; | 48 | char *remote_version = NULL; |
| 49 | char *remote_protocol = NULL; | 49 | char *remote_protocol = NULL; |
| 50 | int verbose = FALSE; | 50 | bool verbose = false; |
| 51 | 51 | ||
| 52 | int process_arguments (int, char **); | 52 | int process_arguments (int, char **); |
| 53 | int validate_arguments (void); | 53 | int validate_arguments (void); |
| @@ -57,7 +57,6 @@ void print_usage (void); | |||
| 57 | int ssh_connect (char *haddr, int hport, char *remote_version, char *remote_protocol); | 57 | int ssh_connect (char *haddr, int hport, char *remote_version, char *remote_protocol); |
| 58 | 58 | ||
| 59 | 59 | ||
| 60 | |||
| 61 | int | 60 | int |
| 62 | main (int argc, char **argv) | 61 | main (int argc, char **argv) |
| 63 | { | 62 | { |
| @@ -133,7 +132,7 @@ process_arguments (int argc, char **argv) | |||
| 133 | print_help (); | 132 | print_help (); |
| 134 | exit (STATE_UNKNOWN); | 133 | exit (STATE_UNKNOWN); |
| 135 | case 'v': /* verbose */ | 134 | case 'v': /* verbose */ |
| 136 | verbose = TRUE; | 135 | verbose = true; |
| 137 | break; | 136 | break; |
| 138 | case 't': /* timeout period */ | 137 | case 't': /* timeout period */ |
| 139 | if (!is_integer (optarg)) | 138 | if (!is_integer (optarg)) |
| @@ -158,7 +157,7 @@ process_arguments (int argc, char **argv) | |||
| 158 | remote_protocol = optarg; | 157 | remote_protocol = optarg; |
| 159 | break; | 158 | break; |
| 160 | case 'H': /* host */ | 159 | case 'H': /* host */ |
| 161 | if (is_host (optarg) == FALSE) | 160 | if (!is_host (optarg)) |
| 162 | usage2 (_("Invalid hostname/address"), optarg); | 161 | usage2 (_("Invalid hostname/address"), optarg); |
| 163 | server_name = optarg; | 162 | server_name = optarg; |
| 164 | break; | 163 | break; |
| @@ -272,7 +271,7 @@ ssh_connect (char *haddr, int hport, char *remote_version, char *remote_protocol | |||
| 272 | printf | 271 | printf |
| 273 | (_("SSH OK - %s (protocol %s) | %s\n"), | 272 | (_("SSH OK - %s (protocol %s) | %s\n"), |
| 274 | ssh_server, ssh_proto, fperfdata("time", elapsed_time, "s", | 273 | ssh_server, ssh_proto, fperfdata("time", elapsed_time, "s", |
| 275 | FALSE, 0, FALSE, 0, TRUE, 0, TRUE, (int)socket_timeout)); | 274 | false, 0, false, 0, true, 0, true, (int)socket_timeout)); |
| 276 | close(sd); | 275 | close(sd); |
| 277 | exit (STATE_OK); | 276 | exit (STATE_OK); |
| 278 | } | 277 | } |
diff --git a/plugins/check_swap.c b/plugins/check_swap.c index cd965e31..fddd93fa 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c | |||
| @@ -65,7 +65,7 @@ void print_help (void); | |||
| 65 | threshold_t warn; | 65 | threshold_t warn; |
| 66 | threshold_t crit; | 66 | threshold_t crit; |
| 67 | int verbose; | 67 | int verbose; |
| 68 | int allswaps; | 68 | bool allswaps = false; |
| 69 | int no_swap_state = STATE_CRITICAL; | 69 | int no_swap_state = STATE_CRITICAL; |
| 70 | 70 | ||
| 71 | int | 71 | int |
| @@ -383,10 +383,10 @@ main (int argc, char **argv) | |||
| 383 | if (crit.is_percentage) crit_print = crit.value * (total_swap_mb *1024 *1024/100); | 383 | if (crit.is_percentage) crit_print = crit.value * (total_swap_mb *1024 *1024/100); |
| 384 | 384 | ||
| 385 | puts (perfdata_uint64 ("swap", free_swap_mb *1024 *1024, "B", | 385 | puts (perfdata_uint64 ("swap", free_swap_mb *1024 *1024, "B", |
| 386 | TRUE, warn_print, | 386 | true, warn_print, |
| 387 | TRUE, crit_print, | 387 | true, crit_print, |
| 388 | TRUE, 0, | 388 | true, 0, |
| 389 | TRUE, (long) total_swap_mb * 1024 * 1024)); | 389 | true, (long) total_swap_mb * 1024 * 1024)); |
| 390 | 390 | ||
| 391 | return result; | 391 | return result; |
| 392 | } | 392 | } |
| @@ -514,7 +514,7 @@ process_arguments (int argc, char **argv) | |||
| 514 | } | 514 | } |
| 515 | } | 515 | } |
| 516 | case 'a': /* all swap */ | 516 | case 'a': /* all swap */ |
| 517 | allswaps = TRUE; | 517 | allswaps = true; |
| 518 | break; | 518 | break; |
| 519 | case 'n': | 519 | case 'n': |
| 520 | if ((no_swap_state = mp_translate_state(optarg)) == ERROR) { | 520 | if ((no_swap_state = mp_translate_state(optarg)) == ERROR) { |
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 1d307cf3..a1a14b45 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c | |||
| @@ -41,7 +41,7 @@ const char *email = "devel@monitoring-plugins.org"; | |||
| 41 | #include <sys/select.h> | 41 | #include <sys/select.h> |
| 42 | 42 | ||
| 43 | #ifdef HAVE_SSL | 43 | #ifdef HAVE_SSL |
| 44 | static int check_cert = FALSE; | 44 | static bool check_cert = false; |
| 45 | static int days_till_exp_warn, days_till_exp_crit; | 45 | static int days_till_exp_warn, days_till_exp_crit; |
| 46 | # define my_recv(buf, len) ((flags & FLAG_SSL) ? np_net_ssl_read(buf, len) : read(sd, buf, len)) | 46 | # define my_recv(buf, len) ((flags & FLAG_SSL) ? np_net_ssl_read(buf, len) : read(sd, buf, len)) |
| 47 | # define my_send(buf, len) ((flags & FLAG_SSL) ? np_net_ssl_write(buf, len) : send(sd, buf, len, 0)) | 47 | # define my_send(buf, len) ((flags & FLAG_SSL) ? np_net_ssl_write(buf, len) : send(sd, buf, len, 0)) |
| @@ -65,7 +65,7 @@ static int READ_TIMEOUT = 2; | |||
| 65 | 65 | ||
| 66 | static int server_port = 0; | 66 | static int server_port = 0; |
| 67 | static char *server_address = NULL; | 67 | static char *server_address = NULL; |
| 68 | static int host_specified = FALSE; | 68 | static bool host_specified = false; |
| 69 | static char *server_send = NULL; | 69 | static char *server_send = NULL; |
| 70 | static char *server_quit = NULL; | 70 | static char *server_quit = NULL; |
| 71 | static char **server_expect; | 71 | static char **server_expect; |
| @@ -88,7 +88,7 @@ static int match_flags = NP_MATCH_EXACT; | |||
| 88 | 88 | ||
| 89 | #ifdef HAVE_SSL | 89 | #ifdef HAVE_SSL |
| 90 | static char *sni = NULL; | 90 | static char *sni = NULL; |
| 91 | static int sni_specified = FALSE; | 91 | static bool sni_specified = false; |
| 92 | #endif | 92 | #endif |
| 93 | 93 | ||
| 94 | #define FLAG_SSL 0x01 | 94 | #define FLAG_SSL 0x01 |
| @@ -247,7 +247,7 @@ main (int argc, char **argv) | |||
| 247 | #ifdef HAVE_SSL | 247 | #ifdef HAVE_SSL |
| 248 | if (flags & FLAG_SSL){ | 248 | if (flags & FLAG_SSL){ |
| 249 | result = np_net_ssl_init_with_hostname(sd, (sni_specified ? sni : NULL)); | 249 | result = np_net_ssl_init_with_hostname(sd, (sni_specified ? sni : NULL)); |
| 250 | if (result == STATE_OK && check_cert == TRUE) { | 250 | if (result == STATE_OK && check_cert) { |
| 251 | result = np_net_ssl_check_cert(days_till_exp_warn, days_till_exp_crit); | 251 | result = np_net_ssl_check_cert(days_till_exp_warn, days_till_exp_crit); |
| 252 | } | 252 | } |
| 253 | } | 253 | } |
| @@ -378,18 +378,18 @@ main (int argc, char **argv) | |||
| 378 | if(match == NP_MATCH_FAILURE) | 378 | if(match == NP_MATCH_FAILURE) |
| 379 | printf ("|%s", | 379 | printf ("|%s", |
| 380 | fperfdata ("time", elapsed_time, "s", | 380 | fperfdata ("time", elapsed_time, "s", |
| 381 | (flags & FLAG_TIME_WARN ? TRUE : FALSE), 0, | 381 | (flags & FLAG_TIME_WARN ? true : false), 0, |
| 382 | (flags & FLAG_TIME_CRIT ? TRUE : FALSE), 0, | 382 | (flags & FLAG_TIME_CRIT ? true : false), 0, |
| 383 | TRUE, 0, | 383 | true, 0, |
| 384 | TRUE, socket_timeout) | 384 | true, socket_timeout) |
| 385 | ); | 385 | ); |
| 386 | else | 386 | else |
| 387 | printf("|%s", | 387 | printf("|%s", |
| 388 | fperfdata ("time", elapsed_time, "s", | 388 | fperfdata ("time", elapsed_time, "s", |
| 389 | (flags & FLAG_TIME_WARN ? TRUE : FALSE), warning_time, | 389 | (flags & FLAG_TIME_WARN ? true : false), warning_time, |
| 390 | (flags & FLAG_TIME_CRIT ? TRUE : FALSE), critical_time, | 390 | (flags & FLAG_TIME_CRIT ? true : false), critical_time, |
| 391 | TRUE, 0, | 391 | true, 0, |
| 392 | TRUE, socket_timeout) | 392 | true, socket_timeout) |
| 393 | ); | 393 | ); |
| 394 | 394 | ||
| 395 | putchar('\n'); | 395 | putchar('\n'); |
| @@ -399,11 +399,9 @@ main (int argc, char **argv) | |||
| 399 | 399 | ||
| 400 | 400 | ||
| 401 | /* process command-line arguments */ | 401 | /* process command-line arguments */ |
| 402 | static int | 402 | static int process_arguments (int argc, char **argv) { |
| 403 | process_arguments (int argc, char **argv) | ||
| 404 | { | ||
| 405 | int c; | 403 | int c; |
| 406 | int escape = 0; | 404 | bool escape = false; |
| 407 | char *temp; | 405 | char *temp; |
| 408 | 406 | ||
| 409 | enum { | 407 | enum { |
| @@ -492,7 +490,7 @@ process_arguments (int argc, char **argv) | |||
| 492 | #endif | 490 | #endif |
| 493 | break; | 491 | break; |
| 494 | case 'H': /* hostname */ | 492 | case 'H': /* hostname */ |
| 495 | host_specified = TRUE; | 493 | host_specified = true; |
| 496 | server_address = optarg; | 494 | server_address = optarg; |
| 497 | break; | 495 | break; |
| 498 | case 'c': /* critical */ | 496 | case 'c': /* critical */ |
| @@ -527,7 +525,7 @@ process_arguments (int argc, char **argv) | |||
| 527 | server_port = atoi (optarg); | 525 | server_port = atoi (optarg); |
| 528 | break; | 526 | break; |
| 529 | case 'E': | 527 | case 'E': |
| 530 | escape = 1; | 528 | escape = true; |
| 531 | break; | 529 | break; |
| 532 | case 's': | 530 | case 's': |
| 533 | if (escape) | 531 | if (escape) |
| @@ -601,7 +599,7 @@ process_arguments (int argc, char **argv) | |||
| 601 | usage2 (_("Invalid certificate expiration period"), optarg); | 599 | usage2 (_("Invalid certificate expiration period"), optarg); |
| 602 | days_till_exp_warn = atoi (optarg); | 600 | days_till_exp_warn = atoi (optarg); |
| 603 | } | 601 | } |
| 604 | check_cert = TRUE; | 602 | check_cert = true; |
| 605 | flags |= FLAG_SSL; | 603 | flags |= FLAG_SSL; |
| 606 | break; | 604 | break; |
| 607 | # endif /* USE_OPENSSL */ | 605 | # endif /* USE_OPENSSL */ |
| @@ -617,7 +615,7 @@ process_arguments (int argc, char **argv) | |||
| 617 | case SNI_OPTION: | 615 | case SNI_OPTION: |
| 618 | #ifdef HAVE_SSL | 616 | #ifdef HAVE_SSL |
| 619 | flags |= FLAG_SSL; | 617 | flags |= FLAG_SSL; |
| 620 | sni_specified = TRUE; | 618 | sni_specified = true; |
| 621 | sni = optarg; | 619 | sni = optarg; |
| 622 | #else | 620 | #else |
| 623 | die (STATE_UNKNOWN, _("Invalid option - SSL is not available")); | 621 | die (STATE_UNKNOWN, _("Invalid option - SSL is not available")); |
| @@ -630,15 +628,15 @@ process_arguments (int argc, char **argv) | |||
| 630 | } | 628 | } |
| 631 | 629 | ||
| 632 | c = optind; | 630 | c = optind; |
| 633 | if(host_specified == FALSE && c < argc) | 631 | if(!host_specified && c < argc) |
| 634 | server_address = strdup (argv[c++]); | 632 | server_address = strdup (argv[c++]); |
| 635 | 633 | ||
| 636 | if (server_address == NULL) | 634 | if (server_address == NULL) |
| 637 | usage4 (_("You must provide a server address")); | 635 | usage4 (_("You must provide a server address")); |
| 638 | else if (server_address[0] != '/' && is_host (server_address) == FALSE) | 636 | else if (server_address[0] != '/' && !is_host(server_address)) |
| 639 | die (STATE_CRITICAL, "%s %s - %s: %s\n", SERVICE, state_text(STATE_CRITICAL), _("Invalid hostname, address or socket"), server_address); | 637 | die (STATE_CRITICAL, "%s %s - %s: %s\n", SERVICE, state_text(STATE_CRITICAL), _("Invalid hostname, address or socket"), server_address); |
| 640 | 638 | ||
| 641 | return TRUE; | 639 | return OK; |
| 642 | } | 640 | } |
| 643 | 641 | ||
| 644 | 642 | ||
diff --git a/plugins/check_time.c b/plugins/check_time.c index baf8c591..f50ea427 100644 --- a/plugins/check_time.c +++ b/plugins/check_time.c | |||
| @@ -45,16 +45,16 @@ enum { | |||
| 45 | uint32_t raw_server_time; | 45 | uint32_t raw_server_time; |
| 46 | unsigned long server_time, diff_time; | 46 | unsigned long server_time, diff_time; |
| 47 | int warning_time = 0; | 47 | int warning_time = 0; |
| 48 | int check_warning_time = FALSE; | 48 | bool check_warning_time = false; |
| 49 | int critical_time = 0; | 49 | int critical_time = 0; |
| 50 | int check_critical_time = FALSE; | 50 | bool check_critical_time = false; |
| 51 | unsigned long warning_diff = 0; | 51 | unsigned long warning_diff = 0; |
| 52 | int check_warning_diff = FALSE; | 52 | bool check_warning_diff = false; |
| 53 | unsigned long critical_diff = 0; | 53 | unsigned long critical_diff = 0; |
| 54 | int check_critical_diff = FALSE; | 54 | bool check_critical_diff = false; |
| 55 | int server_port = TIME_PORT; | 55 | int server_port = TIME_PORT; |
| 56 | char *server_address = NULL; | 56 | char *server_address = NULL; |
| 57 | int use_udp = FALSE; | 57 | bool use_udp = false; |
| 58 | 58 | ||
| 59 | int process_arguments (int, char **); | 59 | int process_arguments (int, char **); |
| 60 | void print_help (void); | 60 | void print_help (void); |
| @@ -92,9 +92,9 @@ main (int argc, char **argv) | |||
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | if (result != STATE_OK) { | 94 | if (result != STATE_OK) { |
| 95 | if (check_critical_time == TRUE) | 95 | if (check_critical_time) |
| 96 | result = STATE_CRITICAL; | 96 | result = STATE_CRITICAL; |
| 97 | else if (check_warning_time == TRUE) | 97 | else if (check_warning_time) |
| 98 | result = STATE_WARNING; | 98 | result = STATE_WARNING; |
| 99 | else | 99 | else |
| 100 | result = STATE_UNKNOWN; | 100 | result = STATE_UNKNOWN; |
| @@ -105,9 +105,9 @@ main (int argc, char **argv) | |||
| 105 | 105 | ||
| 106 | if (use_udp) { | 106 | if (use_udp) { |
| 107 | if (send (sd, "", 0, 0) < 0) { | 107 | if (send (sd, "", 0, 0) < 0) { |
| 108 | if (check_critical_time == TRUE) | 108 | if (check_critical_time) |
| 109 | result = STATE_CRITICAL; | 109 | result = STATE_CRITICAL; |
| 110 | else if (check_warning_time == TRUE) | 110 | else if (check_warning_time) |
| 111 | result = STATE_WARNING; | 111 | result = STATE_WARNING; |
| 112 | else | 112 | else |
| 113 | result = STATE_UNKNOWN; | 113 | result = STATE_UNKNOWN; |
| @@ -129,9 +129,9 @@ main (int argc, char **argv) | |||
| 129 | 129 | ||
| 130 | /* return a WARNING status if we couldn't read any data */ | 130 | /* return a WARNING status if we couldn't read any data */ |
| 131 | if (result <= 0) { | 131 | if (result <= 0) { |
| 132 | if (check_critical_time == TRUE) | 132 | if (check_critical_time) |
| 133 | result = STATE_CRITICAL; | 133 | result = STATE_CRITICAL; |
| 134 | else if (check_warning_time == TRUE) | 134 | else if (check_warning_time) |
| 135 | result = STATE_WARNING; | 135 | result = STATE_WARNING; |
| 136 | else | 136 | else |
| 137 | result = STATE_UNKNOWN; | 137 | result = STATE_UNKNOWN; |
| @@ -143,9 +143,9 @@ main (int argc, char **argv) | |||
| 143 | result = STATE_OK; | 143 | result = STATE_OK; |
| 144 | 144 | ||
| 145 | conntime = (end_time - start_time); | 145 | conntime = (end_time - start_time); |
| 146 | if (check_critical_time == TRUE && conntime > critical_time) | 146 | if (check_critical_time&& conntime > critical_time) |
| 147 | result = STATE_CRITICAL; | 147 | result = STATE_CRITICAL; |
| 148 | else if (check_warning_time == TRUE && conntime > warning_time) | 148 | else if (check_warning_time && conntime > warning_time) |
| 149 | result = STATE_WARNING; | 149 | result = STATE_WARNING; |
| 150 | 150 | ||
| 151 | if (result != STATE_OK) | 151 | if (result != STATE_OK) |
| @@ -154,7 +154,7 @@ main (int argc, char **argv) | |||
| 154 | perfdata ("time", (long)conntime, "s", | 154 | perfdata ("time", (long)conntime, "s", |
| 155 | check_warning_time, (long)warning_time, | 155 | check_warning_time, (long)warning_time, |
| 156 | check_critical_time, (long)critical_time, | 156 | check_critical_time, (long)critical_time, |
| 157 | TRUE, 0, FALSE, 0)); | 157 | true, 0, false, 0)); |
| 158 | 158 | ||
| 159 | server_time = ntohl (raw_server_time) - UNIX_EPOCH; | 159 | server_time = ntohl (raw_server_time) - UNIX_EPOCH; |
| 160 | if (server_time > (unsigned long)end_time) | 160 | if (server_time > (unsigned long)end_time) |
| @@ -162,9 +162,9 @@ main (int argc, char **argv) | |||
| 162 | else | 162 | else |
| 163 | diff_time = (unsigned long)end_time - server_time; | 163 | diff_time = (unsigned long)end_time - server_time; |
| 164 | 164 | ||
| 165 | if (check_critical_diff == TRUE && diff_time > critical_diff) | 165 | if (check_critical_diff&& diff_time > critical_diff) |
| 166 | result = STATE_CRITICAL; | 166 | result = STATE_CRITICAL; |
| 167 | else if (check_warning_diff == TRUE && diff_time > warning_diff) | 167 | else if (check_warning_diff&& diff_time > warning_diff) |
| 168 | result = STATE_WARNING; | 168 | result = STATE_WARNING; |
| 169 | 169 | ||
| 170 | printf (_("TIME %s - %lu second time difference|%s %s\n"), | 170 | printf (_("TIME %s - %lu second time difference|%s %s\n"), |
| @@ -172,11 +172,11 @@ main (int argc, char **argv) | |||
| 172 | perfdata ("time", (long)conntime, "s", | 172 | perfdata ("time", (long)conntime, "s", |
| 173 | check_warning_time, (long)warning_time, | 173 | check_warning_time, (long)warning_time, |
| 174 | check_critical_time, (long)critical_time, | 174 | check_critical_time, (long)critical_time, |
| 175 | TRUE, 0, FALSE, 0), | 175 | true, 0, false, 0), |
| 176 | perfdata ("offset", diff_time, "s", | 176 | perfdata ("offset", diff_time, "s", |
| 177 | check_warning_diff, warning_diff, | 177 | check_warning_diff, warning_diff, |
| 178 | check_critical_diff, critical_diff, | 178 | check_critical_diff, critical_diff, |
| 179 | TRUE, 0, FALSE, 0)); | 179 | true, 0, false, 0)); |
| 180 | return result; | 180 | return result; |
| 181 | } | 181 | } |
| 182 | 182 | ||
| @@ -219,7 +219,7 @@ process_arguments (int argc, char **argv) | |||
| 219 | strcpy (argv[c], "-C"); | 219 | strcpy (argv[c], "-C"); |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | while (1) { | 222 | while (true) { |
| 223 | c = getopt_long (argc, argv, "hVH:w:c:W:C:p:t:u", longopts, | 223 | c = getopt_long (argc, argv, "hVH:w:c:W:C:p:t:u", longopts, |
| 224 | &option); | 224 | &option); |
| 225 | 225 | ||
| @@ -236,19 +236,19 @@ process_arguments (int argc, char **argv) | |||
| 236 | print_revision (progname, NP_VERSION); | 236 | print_revision (progname, NP_VERSION); |
| 237 | exit (STATE_UNKNOWN); | 237 | exit (STATE_UNKNOWN); |
| 238 | case 'H': /* hostname */ | 238 | case 'H': /* hostname */ |
| 239 | if (is_host (optarg) == FALSE) | 239 | if (!is_host (optarg)) |
| 240 | usage2 (_("Invalid hostname/address"), optarg); | 240 | usage2 (_("Invalid hostname/address"), optarg); |
| 241 | server_address = optarg; | 241 | server_address = optarg; |
| 242 | break; | 242 | break; |
| 243 | case 'w': /* warning-variance */ | 243 | case 'w': /* warning-variance */ |
| 244 | if (is_intnonneg (optarg)) { | 244 | if (is_intnonneg (optarg)) { |
| 245 | warning_diff = strtoul (optarg, NULL, 10); | 245 | warning_diff = strtoul (optarg, NULL, 10); |
| 246 | check_warning_diff = TRUE; | 246 | check_warning_diff = true; |
| 247 | } | 247 | } |
| 248 | else if (strspn (optarg, "0123456789:,") > 0) { | 248 | else if (strspn (optarg, "0123456789:,") > 0) { |
| 249 | if (sscanf (optarg, "%lu%*[:,]%d", &warning_diff, &warning_time) == 2) { | 249 | if (sscanf (optarg, "%lu%*[:,]%d", &warning_diff, &warning_time) == 2) { |
| 250 | check_warning_diff = TRUE; | 250 | check_warning_diff = true; |
| 251 | check_warning_time = TRUE; | 251 | check_warning_time = true; |
| 252 | } | 252 | } |
| 253 | else { | 253 | else { |
| 254 | usage4 (_("Warning thresholds must be a positive integer")); | 254 | usage4 (_("Warning thresholds must be a positive integer")); |
| @@ -261,13 +261,13 @@ process_arguments (int argc, char **argv) | |||
| 261 | case 'c': /* critical-variance */ | 261 | case 'c': /* critical-variance */ |
| 262 | if (is_intnonneg (optarg)) { | 262 | if (is_intnonneg (optarg)) { |
| 263 | critical_diff = strtoul (optarg, NULL, 10); | 263 | critical_diff = strtoul (optarg, NULL, 10); |
| 264 | check_critical_diff = TRUE; | 264 | check_critical_diff = true; |
| 265 | } | 265 | } |
| 266 | else if (strspn (optarg, "0123456789:,") > 0) { | 266 | else if (strspn (optarg, "0123456789:,") > 0) { |
| 267 | if (sscanf (optarg, "%lu%*[:,]%d", &critical_diff, &critical_time) == | 267 | if (sscanf (optarg, "%lu%*[:,]%d", &critical_diff, &critical_time) == |
| 268 | 2) { | 268 | 2) { |
| 269 | check_critical_diff = TRUE; | 269 | check_critical_diff = true; |
| 270 | check_critical_time = TRUE; | 270 | check_critical_time = true; |
| 271 | } | 271 | } |
| 272 | else { | 272 | else { |
| 273 | usage4 (_("Critical thresholds must be a positive integer")); | 273 | usage4 (_("Critical thresholds must be a positive integer")); |
| @@ -282,14 +282,14 @@ process_arguments (int argc, char **argv) | |||
| 282 | usage4 (_("Warning threshold must be a positive integer")); | 282 | usage4 (_("Warning threshold must be a positive integer")); |
| 283 | else | 283 | else |
| 284 | warning_time = atoi (optarg); | 284 | warning_time = atoi (optarg); |
| 285 | check_warning_time = TRUE; | 285 | check_warning_time = true; |
| 286 | break; | 286 | break; |
| 287 | case 'C': /* critical-connect */ | 287 | case 'C': /* critical-connect */ |
| 288 | if (!is_intnonneg (optarg)) | 288 | if (!is_intnonneg (optarg)) |
| 289 | usage4 (_("Critical threshold must be a positive integer")); | 289 | usage4 (_("Critical threshold must be a positive integer")); |
| 290 | else | 290 | else |
| 291 | critical_time = atoi (optarg); | 291 | critical_time = atoi (optarg); |
| 292 | check_critical_time = TRUE; | 292 | check_critical_time = true; |
| 293 | break; | 293 | break; |
| 294 | case 'p': /* port */ | 294 | case 'p': /* port */ |
| 295 | if (!is_intnonneg (optarg)) | 295 | if (!is_intnonneg (optarg)) |
| @@ -304,14 +304,14 @@ process_arguments (int argc, char **argv) | |||
| 304 | socket_timeout = atoi (optarg); | 304 | socket_timeout = atoi (optarg); |
| 305 | break; | 305 | break; |
| 306 | case 'u': /* udp */ | 306 | case 'u': /* udp */ |
| 307 | use_udp = TRUE; | 307 | use_udp = true; |
| 308 | } | 308 | } |
| 309 | } | 309 | } |
| 310 | 310 | ||
| 311 | c = optind; | 311 | c = optind; |
| 312 | if (server_address == NULL) { | 312 | if (server_address == NULL) { |
| 313 | if (argc > c) { | 313 | if (argc > c) { |
| 314 | if (is_host (argv[c]) == FALSE) | 314 | if (!is_host (argv[c])) |
| 315 | usage2 (_("Invalid hostname/address"), optarg); | 315 | usage2 (_("Invalid hostname/address"), optarg); |
| 316 | server_address = argv[c]; | 316 | server_address = argv[c]; |
| 317 | } | 317 | } |
diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 68737c4b..d1ded620 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c | |||
| @@ -75,8 +75,8 @@ char *server_address; | |||
| 75 | char *ups_name = NULL; | 75 | char *ups_name = NULL; |
| 76 | double warning_value = 0.0; | 76 | double warning_value = 0.0; |
| 77 | double critical_value = 0.0; | 77 | double critical_value = 0.0; |
| 78 | int check_warn = FALSE; | 78 | bool check_warn = false; |
| 79 | int check_crit = FALSE; | 79 | bool check_crit = false; |
| 80 | int check_variable = UPS_NONE; | 80 | int check_variable = UPS_NONE; |
| 81 | int supported_options = UPS_NONE; | 81 | int supported_options = UPS_NONE; |
| 82 | int status = UPSSTATUS_NONE; | 82 | int status = UPSSTATUS_NONE; |
| @@ -86,7 +86,7 @@ double ups_battery_percent = 0.0; | |||
| 86 | double ups_load_percent = 0.0; | 86 | double ups_load_percent = 0.0; |
| 87 | double ups_temperature = 0.0; | 87 | double ups_temperature = 0.0; |
| 88 | char *ups_status; | 88 | char *ups_status; |
| 89 | int temp_output_c = 0; | 89 | bool temp_output_c = false; |
| 90 | 90 | ||
| 91 | int determine_status (void); | 91 | int determine_status (void); |
| 92 | int get_ups_variable (const char *, char *); | 92 | int get_ups_variable (const char *, char *); |
| @@ -205,21 +205,21 @@ main (int argc, char **argv) | |||
| 205 | ups_utility_deviation = ups_utility_voltage - 120.0; | 205 | ups_utility_deviation = ups_utility_voltage - 120.0; |
| 206 | 206 | ||
| 207 | if (check_variable == UPS_UTILITY) { | 207 | if (check_variable == UPS_UTILITY) { |
| 208 | if (check_crit==TRUE && ups_utility_deviation>=critical_value) { | 208 | if (check_crit && ups_utility_deviation>=critical_value) { |
| 209 | result = STATE_CRITICAL; | 209 | result = STATE_CRITICAL; |
| 210 | } | 210 | } |
| 211 | else if (check_warn==TRUE && ups_utility_deviation>=warning_value) { | 211 | else if (check_warn && ups_utility_deviation>=warning_value) { |
| 212 | result = max_state (result, STATE_WARNING); | 212 | result = max_state (result, STATE_WARNING); |
| 213 | } | 213 | } |
| 214 | xasprintf (&data, "%s", | 214 | xasprintf (&data, "%s", |
| 215 | perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | 215 | perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", |
| 216 | check_warn, (long)(1000*warning_value), | 216 | check_warn, (long)(1000*warning_value), |
| 217 | check_crit, (long)(1000*critical_value), | 217 | check_crit, (long)(1000*critical_value), |
| 218 | TRUE, 0, FALSE, 0)); | 218 | true, 0, false, 0)); |
| 219 | } else { | 219 | } else { |
| 220 | xasprintf (&data, "%s", | 220 | xasprintf (&data, "%s", |
| 221 | perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | 221 | perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", |
| 222 | FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | 222 | false, 0, false, 0, true, 0, false, 0)); |
| 223 | } | 223 | } |
| 224 | } | 224 | } |
| 225 | 225 | ||
| @@ -234,21 +234,21 @@ main (int argc, char **argv) | |||
| 234 | xasprintf (&message, "%sBatt=%3.1f%% ", message, ups_battery_percent); | 234 | xasprintf (&message, "%sBatt=%3.1f%% ", message, ups_battery_percent); |
| 235 | 235 | ||
| 236 | if (check_variable == UPS_BATTPCT) { | 236 | if (check_variable == UPS_BATTPCT) { |
| 237 | if (check_crit==TRUE && ups_battery_percent <= critical_value) { | 237 | if (check_crit && ups_battery_percent <= critical_value) { |
| 238 | result = STATE_CRITICAL; | 238 | result = STATE_CRITICAL; |
| 239 | } | 239 | } |
| 240 | else if (check_warn==TRUE && ups_battery_percent<=warning_value) { | 240 | else if (check_warn && ups_battery_percent<=warning_value) { |
| 241 | result = max_state (result, STATE_WARNING); | 241 | result = max_state (result, STATE_WARNING); |
| 242 | } | 242 | } |
| 243 | xasprintf (&data, "%s %s", data, | 243 | xasprintf (&data, "%s %s", data, |
| 244 | perfdata ("battery", (long)ups_battery_percent, "%", | 244 | perfdata ("battery", (long)ups_battery_percent, "%", |
| 245 | check_warn, (long)(warning_value), | 245 | check_warn, (long)(warning_value), |
| 246 | check_crit, (long)(critical_value), | 246 | check_crit, (long)(critical_value), |
| 247 | TRUE, 0, TRUE, 100)); | 247 | true, 0, true, 100)); |
| 248 | } else { | 248 | } else { |
| 249 | xasprintf (&data, "%s %s", data, | 249 | xasprintf (&data, "%s %s", data, |
| 250 | perfdata ("battery", (long)ups_battery_percent, "%", | 250 | perfdata ("battery", (long)ups_battery_percent, "%", |
| 251 | FALSE, 0, FALSE, 0, TRUE, 0, TRUE, 100)); | 251 | false, 0, false, 0, true, 0, true, 100)); |
| 252 | } | 252 | } |
| 253 | } | 253 | } |
| 254 | 254 | ||
| @@ -263,21 +263,21 @@ main (int argc, char **argv) | |||
| 263 | xasprintf (&message, "%sLoad=%3.1f%% ", message, ups_load_percent); | 263 | xasprintf (&message, "%sLoad=%3.1f%% ", message, ups_load_percent); |
| 264 | 264 | ||
| 265 | if (check_variable == UPS_LOADPCT) { | 265 | if (check_variable == UPS_LOADPCT) { |
| 266 | if (check_crit==TRUE && ups_load_percent>=critical_value) { | 266 | if (check_crit && ups_load_percent>=critical_value) { |
| 267 | result = STATE_CRITICAL; | 267 | result = STATE_CRITICAL; |
| 268 | } | 268 | } |
| 269 | else if (check_warn==TRUE && ups_load_percent>=warning_value) { | 269 | else if (check_warn && ups_load_percent>=warning_value) { |
| 270 | result = max_state (result, STATE_WARNING); | 270 | result = max_state (result, STATE_WARNING); |
| 271 | } | 271 | } |
| 272 | xasprintf (&data, "%s %s", data, | 272 | xasprintf (&data, "%s %s", data, |
| 273 | perfdata ("load", (long)ups_load_percent, "%", | 273 | perfdata ("load", (long)ups_load_percent, "%", |
| 274 | check_warn, (long)(warning_value), | 274 | check_warn, (long)(warning_value), |
| 275 | check_crit, (long)(critical_value), | 275 | check_crit, (long)(critical_value), |
| 276 | TRUE, 0, TRUE, 100)); | 276 | true, 0, true, 100)); |
| 277 | } else { | 277 | } else { |
| 278 | xasprintf (&data, "%s %s", data, | 278 | xasprintf (&data, "%s %s", data, |
| 279 | perfdata ("load", (long)ups_load_percent, "%", | 279 | perfdata ("load", (long)ups_load_percent, "%", |
| 280 | FALSE, 0, FALSE, 0, TRUE, 0, TRUE, 100)); | 280 | false, 0, false, 0, true, 0, true, 100)); |
| 281 | } | 281 | } |
| 282 | } | 282 | } |
| 283 | 283 | ||
| @@ -300,21 +300,21 @@ main (int argc, char **argv) | |||
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | if (check_variable == UPS_TEMP) { | 302 | if (check_variable == UPS_TEMP) { |
| 303 | if (check_crit==TRUE && ups_temperature>=critical_value) { | 303 | if (check_crit && ups_temperature>=critical_value) { |
| 304 | result = STATE_CRITICAL; | 304 | result = STATE_CRITICAL; |
| 305 | } | 305 | } |
| 306 | else if (check_warn == TRUE && ups_temperature>=warning_value) { | 306 | else if (check_warn && ups_temperature>=warning_value) { |
| 307 | result = max_state (result, STATE_WARNING); | 307 | result = max_state (result, STATE_WARNING); |
| 308 | } | 308 | } |
| 309 | xasprintf (&data, "%s %s", data, | 309 | xasprintf (&data, "%s %s", data, |
| 310 | perfdata ("temp", (long)ups_temperature, tunits, | 310 | perfdata ("temp", (long)ups_temperature, tunits, |
| 311 | check_warn, (long)(warning_value), | 311 | check_warn, (long)(warning_value), |
| 312 | check_crit, (long)(critical_value), | 312 | check_crit, (long)(critical_value), |
| 313 | TRUE, 0, FALSE, 0)); | 313 | true, 0, false, 0)); |
| 314 | } else { | 314 | } else { |
| 315 | xasprintf (&data, "%s %s", data, | 315 | xasprintf (&data, "%s %s", data, |
| 316 | perfdata ("temp", (long)ups_temperature, tunits, | 316 | perfdata ("temp", (long)ups_temperature, tunits, |
| 317 | FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | 317 | false, 0, false, 0, true, 0, false, 0)); |
| 318 | } | 318 | } |
| 319 | } | 319 | } |
| 320 | 320 | ||
| @@ -508,7 +508,7 @@ process_arguments (int argc, char **argv) | |||
| 508 | } | 508 | } |
| 509 | break; | 509 | break; |
| 510 | case 'T': /* FIXME: to be improved (ie "-T C" for Celsius or "-T F" for Fahrenheit) */ | 510 | case 'T': /* FIXME: to be improved (ie "-T C" for Celsius or "-T F" for Fahrenheit) */ |
| 511 | temp_output_c = 1; | 511 | temp_output_c = true; |
| 512 | break; | 512 | break; |
| 513 | case 'u': /* ups name */ | 513 | case 'u': /* ups name */ |
| 514 | ups_name = optarg; | 514 | ups_name = optarg; |
| @@ -524,7 +524,7 @@ process_arguments (int argc, char **argv) | |||
| 524 | case 'c': /* critical time threshold */ | 524 | case 'c': /* critical time threshold */ |
| 525 | if (is_intnonneg (optarg)) { | 525 | if (is_intnonneg (optarg)) { |
| 526 | critical_value = atoi (optarg); | 526 | critical_value = atoi (optarg); |
| 527 | check_crit = TRUE; | 527 | check_crit = true; |
| 528 | } | 528 | } |
| 529 | else { | 529 | else { |
| 530 | usage2 (_("Critical time must be a positive integer"), optarg); | 530 | usage2 (_("Critical time must be a positive integer"), optarg); |
| @@ -533,7 +533,7 @@ process_arguments (int argc, char **argv) | |||
| 533 | case 'w': /* warning time threshold */ | 533 | case 'w': /* warning time threshold */ |
| 534 | if (is_intnonneg (optarg)) { | 534 | if (is_intnonneg (optarg)) { |
| 535 | warning_value = atoi (optarg); | 535 | warning_value = atoi (optarg); |
| 536 | check_warn = TRUE; | 536 | check_warn = true; |
| 537 | } | 537 | } |
| 538 | else { | 538 | else { |
| 539 | usage2 (_("Warning time must be a positive integer"), optarg); | 539 | usage2 (_("Warning time must be a positive integer"), optarg); |
diff --git a/plugins/check_users.c b/plugins/check_users.c index 2a9ee986..7cf7a2cc 100644 --- a/plugins/check_users.c +++ b/plugins/check_users.c | |||
| @@ -179,7 +179,7 @@ main (int argc, char **argv) | |||
| 179 | printf (_("USERS %s - %d users currently logged in |%s\n"), | 179 | printf (_("USERS %s - %d users currently logged in |%s\n"), |
| 180 | state_text(result), users, | 180 | state_text(result), users, |
| 181 | sperfdata_int("users", users, "", warning_range, | 181 | sperfdata_int("users", users, "", warning_range, |
| 182 | critical_range, TRUE, 0, FALSE, 0)); | 182 | critical_range, true, 0, false, 0)); |
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | return result; | 185 | return result; |
| @@ -202,7 +202,7 @@ process_arguments (int argc, char **argv) | |||
| 202 | if (argc < 2) | 202 | if (argc < 2) |
| 203 | usage ("\n"); | 203 | usage ("\n"); |
| 204 | 204 | ||
| 205 | while (1) { | 205 | while (true) { |
| 206 | c = getopt_long (argc, argv, "+hVvc:w:", longopts, &option); | 206 | c = getopt_long (argc, argv, "+hVvc:w:", longopts, &option); |
| 207 | 207 | ||
| 208 | if (c == -1 || c == EOF || c == 1) | 208 | if (c == -1 || c == EOF || c == 1) |
diff --git a/plugins/common.h b/plugins/common.h index 6bf4fca4..833479ce 100644 --- a/plugins/common.h +++ b/plugins/common.h | |||
| @@ -184,14 +184,6 @@ enum { | |||
| 184 | ERROR = -1 | 184 | ERROR = -1 |
| 185 | }; | 185 | }; |
| 186 | 186 | ||
| 187 | /* AIX seems to have this defined somewhere else */ | ||
| 188 | #ifndef FALSE | ||
| 189 | enum { | ||
| 190 | FALSE, | ||
| 191 | TRUE | ||
| 192 | }; | ||
| 193 | #endif | ||
| 194 | |||
| 195 | enum { | 187 | enum { |
| 196 | STATE_OK, | 188 | STATE_OK, |
| 197 | STATE_WARNING, | 189 | STATE_WARNING, |
diff --git a/plugins/negate.c b/plugins/negate.c index 50f62d33..79cca7e0 100644 --- a/plugins/negate.c +++ b/plugins/negate.c | |||
| @@ -47,7 +47,7 @@ static const char **process_arguments (int, char **); | |||
| 47 | void validate_arguments (char **); | 47 | void validate_arguments (char **); |
| 48 | void print_help (void); | 48 | void print_help (void); |
| 49 | void print_usage (void); | 49 | void print_usage (void); |
| 50 | int subst_text = FALSE; | 50 | bool subst_text = false; |
| 51 | 51 | ||
| 52 | static int state[4] = { | 52 | static int state[4] = { |
| 53 | STATE_OK, | 53 | STATE_OK, |
| @@ -122,7 +122,7 @@ static const char ** | |||
| 122 | process_arguments (int argc, char **argv) | 122 | process_arguments (int argc, char **argv) |
| 123 | { | 123 | { |
| 124 | int c; | 124 | int c; |
| 125 | int permute = TRUE; | 125 | bool permute = true; |
| 126 | 126 | ||
| 127 | int option = 0; | 127 | int option = 0; |
| 128 | static struct option longopts[] = { | 128 | static struct option longopts[] = { |
| @@ -168,26 +168,26 @@ process_arguments (int argc, char **argv) | |||
| 168 | case 'o': /* replacement for OK */ | 168 | case 'o': /* replacement for OK */ |
| 169 | if ((state[STATE_OK] = mp_translate_state(optarg)) == ERROR) | 169 | if ((state[STATE_OK] = mp_translate_state(optarg)) == ERROR) |
| 170 | usage4 (_("Ok must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3).")); | 170 | usage4 (_("Ok must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3).")); |
| 171 | permute = FALSE; | 171 | permute = false; |
| 172 | break; | 172 | break; |
| 173 | 173 | ||
| 174 | case 'w': /* replacement for WARNING */ | 174 | case 'w': /* replacement for WARNING */ |
| 175 | if ((state[STATE_WARNING] = mp_translate_state(optarg)) == ERROR) | 175 | if ((state[STATE_WARNING] = mp_translate_state(optarg)) == ERROR) |
| 176 | usage4 (_("Warning must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3).")); | 176 | usage4 (_("Warning must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3).")); |
| 177 | permute = FALSE; | 177 | permute = false; |
| 178 | break; | 178 | break; |
| 179 | case 'c': /* replacement for CRITICAL */ | 179 | case 'c': /* replacement for CRITICAL */ |
| 180 | if ((state[STATE_CRITICAL] = mp_translate_state(optarg)) == ERROR) | 180 | if ((state[STATE_CRITICAL] = mp_translate_state(optarg)) == ERROR) |
| 181 | usage4 (_("Critical must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3).")); | 181 | usage4 (_("Critical must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3).")); |
| 182 | permute = FALSE; | 182 | permute = false; |
| 183 | break; | 183 | break; |
| 184 | case 'u': /* replacement for UNKNOWN */ | 184 | case 'u': /* replacement for UNKNOWN */ |
| 185 | if ((state[STATE_UNKNOWN] = mp_translate_state(optarg)) == ERROR) | 185 | if ((state[STATE_UNKNOWN] = mp_translate_state(optarg)) == ERROR) |
| 186 | usage4 (_("Unknown must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3).")); | 186 | usage4 (_("Unknown must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3).")); |
| 187 | permute = FALSE; | 187 | permute = false; |
| 188 | break; | 188 | break; |
| 189 | case 's': /* Substitute status text */ | 189 | case 's': /* Substitute status text */ |
| 190 | subst_text = TRUE; | 190 | subst_text = true; |
| 191 | break; | 191 | break; |
| 192 | } | 192 | } |
| 193 | } | 193 | } |
diff --git a/plugins/netutils.c b/plugins/netutils.c index 1bb4f076..c6af248e 100644 --- a/plugins/netutils.c +++ b/plugins/netutils.c | |||
| @@ -34,7 +34,7 @@ unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT; | |||
| 34 | unsigned int socket_timeout_state = STATE_CRITICAL; | 34 | unsigned int socket_timeout_state = STATE_CRITICAL; |
| 35 | 35 | ||
| 36 | int econn_refuse_state = STATE_CRITICAL; | 36 | int econn_refuse_state = STATE_CRITICAL; |
| 37 | int was_refused = FALSE; | 37 | bool was_refused = false; |
| 38 | #if USE_IPV6 | 38 | #if USE_IPV6 |
| 39 | int address_family = AF_UNSPEC; | 39 | int address_family = AF_UNSPEC; |
| 40 | #else | 40 | #else |
| @@ -215,14 +215,14 @@ np_net_connect (const char *host_name, int port, int *sd, int proto) | |||
| 215 | result = connect (*sd, r->ai_addr, r->ai_addrlen); | 215 | result = connect (*sd, r->ai_addr, r->ai_addrlen); |
| 216 | 216 | ||
| 217 | if (result == 0) { | 217 | if (result == 0) { |
| 218 | was_refused = FALSE; | 218 | was_refused = false; |
| 219 | break; | 219 | break; |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | if (result < 0) { | 222 | if (result < 0) { |
| 223 | switch (errno) { | 223 | switch (errno) { |
| 224 | case ECONNREFUSED: | 224 | case ECONNREFUSED: |
| 225 | was_refused = TRUE; | 225 | was_refused = true; |
| 226 | break; | 226 | break; |
| 227 | } | 227 | } |
| 228 | } | 228 | } |
| @@ -246,7 +246,7 @@ np_net_connect (const char *host_name, int port, int *sd, int proto) | |||
| 246 | } | 246 | } |
| 247 | result = connect(*sd, (struct sockaddr *)&su, sizeof(su)); | 247 | result = connect(*sd, (struct sockaddr *)&su, sizeof(su)); |
| 248 | if (result < 0 && errno == ECONNREFUSED) | 248 | if (result < 0 && errno == ECONNREFUSED) |
| 249 | was_refused = TRUE; | 249 | was_refused = true; |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | if (result == 0) | 252 | if (result == 0) |
| @@ -326,13 +326,11 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int | |||
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | 328 | ||
| 329 | int | 329 | bool is_host (const char *address) { |
| 330 | is_host (const char *address) | ||
| 331 | { | ||
| 332 | if (is_addr (address) || is_hostname (address)) | 330 | if (is_addr (address) || is_hostname (address)) |
| 333 | return (TRUE); | 331 | return (true); |
| 334 | 332 | ||
| 335 | return (FALSE); | 333 | return (false); |
| 336 | } | 334 | } |
| 337 | 335 | ||
| 338 | void | 336 | void |
| @@ -342,20 +340,18 @@ host_or_die(const char *str) | |||
| 342 | usage_va(_("Invalid hostname/address - %s"), str); | 340 | usage_va(_("Invalid hostname/address - %s"), str); |
| 343 | } | 341 | } |
| 344 | 342 | ||
| 345 | int | 343 | bool is_addr (const char *address) { |
| 346 | is_addr (const char *address) | ||
| 347 | { | ||
| 348 | #ifdef USE_IPV6 | 344 | #ifdef USE_IPV6 |
| 349 | if (address_family == AF_INET && is_inet_addr (address)) | 345 | if (address_family == AF_INET && is_inet_addr (address)) |
| 350 | return TRUE; | 346 | return true; |
| 351 | else if (address_family == AF_INET6 && is_inet6_addr (address)) | 347 | else if (address_family == AF_INET6 && is_inet6_addr (address)) |
| 352 | return TRUE; | 348 | return true; |
| 353 | #else | 349 | #else |
| 354 | if (is_inet_addr (address)) | 350 | if (is_inet_addr (address)) |
| 355 | return (TRUE); | 351 | return (true); |
| 356 | #endif | 352 | #endif |
| 357 | 353 | ||
| 358 | return (FALSE); | 354 | return (false); |
| 359 | } | 355 | } |
| 360 | 356 | ||
| 361 | int | 357 | int |
| @@ -370,10 +366,10 @@ dns_lookup (const char *in, struct sockaddr_storage *ss, int family) | |||
| 370 | 366 | ||
| 371 | retval = getaddrinfo (in, NULL, &hints, &res); | 367 | retval = getaddrinfo (in, NULL, &hints, &res); |
| 372 | if (retval != 0) | 368 | if (retval != 0) |
| 373 | return FALSE; | 369 | return false; |
| 374 | 370 | ||
| 375 | if (ss != NULL) | 371 | if (ss != NULL) |
| 376 | memcpy (ss, res->ai_addr, res->ai_addrlen); | 372 | memcpy (ss, res->ai_addr, res->ai_addrlen); |
| 377 | freeaddrinfo (res); | 373 | freeaddrinfo (res); |
| 378 | return TRUE; | 374 | return true; |
| 379 | } | 375 | } |
diff --git a/plugins/netutils.h b/plugins/netutils.h index ea653e72..a95057e0 100644 --- a/plugins/netutils.h +++ b/plugins/netutils.h | |||
| @@ -73,8 +73,8 @@ int send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, | |||
| 73 | 73 | ||
| 74 | 74 | ||
| 75 | /* "is_*" wrapper macros and functions */ | 75 | /* "is_*" wrapper macros and functions */ |
| 76 | int is_host (const char *); | 76 | bool is_host (const char *); |
| 77 | int is_addr (const char *); | 77 | bool is_addr (const char *); |
| 78 | int dns_lookup (const char *, struct sockaddr_storage *, int); | 78 | int dns_lookup (const char *, struct sockaddr_storage *, int); |
| 79 | void host_or_die(const char *str); | 79 | void host_or_die(const char *str); |
| 80 | #define resolve_host_or_addr(addr, family) dns_lookup(addr, NULL, family) | 80 | #define resolve_host_or_addr(addr, family) dns_lookup(addr, NULL, family) |
| @@ -89,7 +89,7 @@ void host_or_die(const char *str); | |||
| 89 | extern unsigned int socket_timeout; | 89 | extern unsigned int socket_timeout; |
| 90 | extern unsigned int socket_timeout_state; | 90 | extern unsigned int socket_timeout_state; |
| 91 | extern int econn_refuse_state; | 91 | extern int econn_refuse_state; |
| 92 | extern int was_refused; | 92 | extern bool was_refused; |
| 93 | extern int address_family; | 93 | extern int address_family; |
| 94 | 94 | ||
| 95 | void socket_timeout_alarm_handler (int) __attribute__((noreturn)); | 95 | void socket_timeout_alarm_handler (int) __attribute__((noreturn)); |
diff --git a/plugins/utils.c b/plugins/utils.c index 71c0bdd8..7e14b6e4 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
| @@ -147,98 +147,80 @@ print_revision (const char *command_name, const char *revision) | |||
| 147 | command_name, revision, PACKAGE, VERSION); | 147 | command_name, revision, PACKAGE, VERSION); |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | int | 150 | bool is_numeric (char *number) { |
| 151 | is_numeric (char *number) | ||
| 152 | { | ||
| 153 | char tmp[1]; | 151 | char tmp[1]; |
| 154 | float x; | 152 | float x; |
| 155 | 153 | ||
| 156 | if (!number) | 154 | if (!number) |
| 157 | return FALSE; | 155 | return false; |
| 158 | else if (sscanf (number, "%f%c", &x, tmp) == 1) | 156 | else if (sscanf (number, "%f%c", &x, tmp) == 1) |
| 159 | return TRUE; | 157 | return true; |
| 160 | else | 158 | else |
| 161 | return FALSE; | 159 | return false; |
| 162 | } | 160 | } |
| 163 | 161 | ||
| 164 | int | 162 | bool is_positive (char *number) { |
| 165 | is_positive (char *number) | ||
| 166 | { | ||
| 167 | if (is_numeric (number) && atof (number) > 0.0) | 163 | if (is_numeric (number) && atof (number) > 0.0) |
| 168 | return TRUE; | 164 | return true; |
| 169 | else | 165 | else |
| 170 | return FALSE; | 166 | return false; |
| 171 | } | 167 | } |
| 172 | 168 | ||
| 173 | int | 169 | bool is_negative (char *number) { |
| 174 | is_negative (char *number) | ||
| 175 | { | ||
| 176 | if (is_numeric (number) && atof (number) < 0.0) | 170 | if (is_numeric (number) && atof (number) < 0.0) |
| 177 | return TRUE; | 171 | return true; |
| 178 | else | 172 | else |
| 179 | return FALSE; | 173 | return false; |
| 180 | } | 174 | } |
| 181 | 175 | ||
| 182 | int | 176 | bool is_nonnegative (char *number) { |
| 183 | is_nonnegative (char *number) | ||
| 184 | { | ||
| 185 | if (is_numeric (number) && atof (number) >= 0.0) | 177 | if (is_numeric (number) && atof (number) >= 0.0) |
| 186 | return TRUE; | 178 | return true; |
| 187 | else | 179 | else |
| 188 | return FALSE; | 180 | return false; |
| 189 | } | 181 | } |
| 190 | 182 | ||
| 191 | int | 183 | bool is_percentage (char *number) { |
| 192 | is_percentage (char *number) | ||
| 193 | { | ||
| 194 | int x; | 184 | int x; |
| 195 | if (is_numeric (number) && (x = atof (number)) >= 0 && x <= 100) | 185 | if (is_numeric (number) && (x = atof (number)) >= 0 && x <= 100) |
| 196 | return TRUE; | 186 | return true; |
| 197 | else | 187 | else |
| 198 | return FALSE; | 188 | return false; |
| 199 | } | 189 | } |
| 200 | 190 | ||
| 201 | int | 191 | bool is_integer (char *number) { |
| 202 | is_integer (char *number) | ||
| 203 | { | ||
| 204 | long int n; | 192 | long int n; |
| 205 | 193 | ||
| 206 | if (!number || (strspn (number, "-0123456789 ") != strlen (number))) | 194 | if (!number || (strspn (number, "-0123456789 ") != strlen (number))) |
| 207 | return FALSE; | 195 | return false; |
| 208 | 196 | ||
| 209 | n = strtol (number, NULL, 10); | 197 | n = strtol (number, NULL, 10); |
| 210 | 198 | ||
| 211 | if (errno != ERANGE && n >= INT_MIN && n <= INT_MAX) | 199 | if (errno != ERANGE && n >= INT_MIN && n <= INT_MAX) |
| 212 | return TRUE; | 200 | return true; |
| 213 | else | 201 | else |
| 214 | return FALSE; | 202 | return false; |
| 215 | } | 203 | } |
| 216 | 204 | ||
| 217 | int | 205 | bool is_intpos (char *number) { |
| 218 | is_intpos (char *number) | ||
| 219 | { | ||
| 220 | if (is_integer (number) && atoi (number) > 0) | 206 | if (is_integer (number) && atoi (number) > 0) |
| 221 | return TRUE; | 207 | return true; |
| 222 | else | 208 | else |
| 223 | return FALSE; | 209 | return false; |
| 224 | } | 210 | } |
| 225 | 211 | ||
| 226 | int | 212 | bool is_intneg (char *number) { |
| 227 | is_intneg (char *number) | ||
| 228 | { | ||
| 229 | if (is_integer (number) && atoi (number) < 0) | 213 | if (is_integer (number) && atoi (number) < 0) |
| 230 | return TRUE; | 214 | return true; |
| 231 | else | 215 | else |
| 232 | return FALSE; | 216 | return false; |
| 233 | } | 217 | } |
| 234 | 218 | ||
| 235 | int | 219 | bool is_intnonneg (char *number) { |
| 236 | is_intnonneg (char *number) | ||
| 237 | { | ||
| 238 | if (is_integer (number) && atoi (number) >= 0) | 220 | if (is_integer (number) && atoi (number) >= 0) |
| 239 | return TRUE; | 221 | return true; |
| 240 | else | 222 | else |
| 241 | return FALSE; | 223 | return false; |
| 242 | } | 224 | } |
| 243 | 225 | ||
| 244 | /* | 226 | /* |
| @@ -246,19 +228,19 @@ is_intnonneg (char *number) | |||
| 246 | * On success the number will be written to the _target_ address, if _target_ is not set | 228 | * On success the number will be written to the _target_ address, if _target_ is not set |
| 247 | * to NULL. | 229 | * to NULL. |
| 248 | */ | 230 | */ |
| 249 | int is_int64(char *number, int64_t *target) { | 231 | bool is_int64(char *number, int64_t *target) { |
| 250 | errno = 0; | 232 | errno = 0; |
| 251 | uint64_t tmp = strtoll(number, NULL, 10); | 233 | uint64_t tmp = strtoll(number, NULL, 10); |
| 252 | if (errno != 0) { | 234 | if (errno != 0) { |
| 253 | return 0; | 235 | return false; |
| 254 | } | 236 | } |
| 255 | if (tmp < INT64_MIN || tmp > INT64_MAX) { | 237 | if (tmp < INT64_MIN || tmp > INT64_MAX) { |
| 256 | return 0; | 238 | return false; |
| 257 | } | 239 | } |
| 258 | if (target != NULL) { | 240 | if (target != NULL) { |
| 259 | *target = tmp; | 241 | *target = tmp; |
| 260 | } | 242 | } |
| 261 | return 1; | 243 | return true; |
| 262 | } | 244 | } |
| 263 | 245 | ||
| 264 | /* | 246 | /* |
| @@ -266,40 +248,36 @@ int is_int64(char *number, int64_t *target) { | |||
| 266 | * On success the number will be written to the _target_ address, if _target_ is not set | 248 | * On success the number will be written to the _target_ address, if _target_ is not set |
| 267 | * to NULL. | 249 | * to NULL. |
| 268 | */ | 250 | */ |
| 269 | int is_uint64(char *number, uint64_t *target) { | 251 | bool is_uint64(char *number, uint64_t *target) { |
| 270 | errno = 0; | 252 | errno = 0; |
| 271 | uint64_t tmp = strtoll(number, NULL, 10); | 253 | uint64_t tmp = strtoll(number, NULL, 10); |
| 272 | if (errno != 0) { | 254 | if (errno != 0) { |
| 273 | return 0; | 255 | return false; |
| 274 | } | 256 | } |
| 275 | if (tmp < 0 || tmp > UINT64_MAX) { | 257 | if (tmp < 0 || tmp > UINT64_MAX) { |
| 276 | return 0; | 258 | return false; |
| 277 | } | 259 | } |
| 278 | if (target != NULL) { | 260 | if (target != NULL) { |
| 279 | *target = tmp; | 261 | *target = tmp; |
| 280 | } | 262 | } |
| 281 | return 1; | 263 | return true; |
| 282 | } | 264 | } |
| 283 | 265 | ||
| 284 | int | 266 | bool is_intpercent (char *number) { |
| 285 | is_intpercent (char *number) | ||
| 286 | { | ||
| 287 | int i; | 267 | int i; |
| 288 | if (is_integer (number) && (i = atoi (number)) >= 0 && i <= 100) | 268 | if (is_integer (number) && (i = atoi (number)) >= 0 && i <= 100) |
| 289 | return TRUE; | 269 | return true; |
| 290 | else | 270 | else |
| 291 | return FALSE; | 271 | return false; |
| 292 | } | 272 | } |
| 293 | 273 | ||
| 294 | int | 274 | bool is_option (char *str) { |
| 295 | is_option (char *str) | ||
| 296 | { | ||
| 297 | if (!str) | 275 | if (!str) |
| 298 | return FALSE; | 276 | return false; |
| 299 | else if (strspn (str, "-") == 1 || strspn (str, "-") == 2) | 277 | else if (strspn (str, "-") == 1 || strspn (str, "-") == 2) |
| 300 | return TRUE; | 278 | return true; |
| 301 | else | 279 | else |
| 302 | return FALSE; | 280 | return false; |
| 303 | } | 281 | } |
| 304 | 282 | ||
| 305 | #ifdef NEED_GETTIMEOFDAY | 283 | #ifdef NEED_GETTIMEOFDAY |
diff --git a/plugins/utils.h b/plugins/utils.h index cb979ce7..62e489be 100644 --- a/plugins/utils.h +++ b/plugins/utils.h | |||
| @@ -16,6 +16,8 @@ suite of plugins. */ | |||
| 16 | /* now some functions etc are being defined in ../lib/utils_base.c */ | 16 | /* now some functions etc are being defined in ../lib/utils_base.c */ |
| 17 | #include "utils_base.h" | 17 | #include "utils_base.h" |
| 18 | 18 | ||
| 19 | #include <stdbool.h> | ||
| 20 | |||
| 19 | 21 | ||
| 20 | #ifdef NP_EXTRA_OPTS | 22 | #ifdef NP_EXTRA_OPTS |
| 21 | /* Include extra-opts functions if compiled in */ | 23 | /* Include extra-opts functions if compiled in */ |
| @@ -34,21 +36,21 @@ extern time_t start_time, end_time; | |||
| 34 | 36 | ||
| 35 | /* Test input types */ | 37 | /* Test input types */ |
| 36 | 38 | ||
| 37 | int is_integer (char *); | 39 | bool is_integer (char *); |
| 38 | int is_intpos (char *); | 40 | bool is_intpos (char *); |
| 39 | int is_intneg (char *); | 41 | bool is_intneg (char *); |
| 40 | int is_intnonneg (char *); | 42 | bool is_intnonneg (char *); |
| 41 | int is_intpercent (char *); | 43 | bool is_intpercent (char *); |
| 42 | int is_uint64(char *number, uint64_t *target); | 44 | bool is_uint64(char *number, uint64_t *target); |
| 43 | int is_int64(char *number, int64_t *target); | 45 | bool is_int64(char *number, int64_t *target); |
| 44 | 46 | ||
| 45 | int is_numeric (char *); | 47 | bool is_numeric (char *); |
| 46 | int is_positive (char *); | 48 | bool is_positive (char *); |
| 47 | int is_negative (char *); | 49 | bool is_negative (char *); |
| 48 | int is_nonnegative (char *); | 50 | bool is_nonnegative (char *); |
| 49 | int is_percentage (char *); | 51 | bool is_percentage (char *); |
| 50 | 52 | ||
| 51 | int is_option (char *); | 53 | bool is_option (char *); |
| 52 | 54 | ||
| 53 | /* Generalized timer that will do milliseconds if available */ | 55 | /* Generalized timer that will do milliseconds if available */ |
| 54 | #ifndef HAVE_STRUCT_TIMEVAL | 56 | #ifndef HAVE_STRUCT_TIMEVAL |
