diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2021-10-02 23:37:12 +0200 |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2021-10-02 23:37:12 +0200 |
commit | 46c5327e348540ab04dc37d42f6d1c5408179fa6 (patch) | |
tree | 06daa9142183c0f6c6624bebcffd7d11de1ab976 /plugins/check_swap.c | |
parent | d2f2da175eda5a06291a974d971968a1241d7935 (diff) | |
download | monitoring-plugins-46c5327e348540ab04dc37d42f6d1c5408179fa6.tar.gz |
Revert to poor man's logic
Diffstat (limited to 'plugins/check_swap.c')
-rw-r--r-- | plugins/check_swap.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/check_swap.c b/plugins/check_swap.c index 4d124a35..685c2cc5 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c | |||
@@ -37,7 +37,6 @@ const char *email = "devel@monitoring-plugins.org"; | |||
37 | #include <string.h> | 37 | #include <string.h> |
38 | #include <math.h> | 38 | #include <math.h> |
39 | #include <libintl.h> | 39 | #include <libintl.h> |
40 | #include <stdbool.h> | ||
41 | 40 | ||
42 | #ifdef HAVE_DECL_SWAPCTL | 41 | #ifdef HAVE_DECL_SWAPCTL |
43 | # ifdef HAVE_SYS_PARAM_H | 42 | # ifdef HAVE_SYS_PARAM_H |
@@ -56,7 +55,7 @@ const char *email = "devel@monitoring-plugins.org"; | |||
56 | #endif | 55 | #endif |
57 | 56 | ||
58 | typedef struct { | 57 | typedef struct { |
59 | bool is_percentage; | 58 | int is_percentage; |
60 | uint64_t value; | 59 | uint64_t value; |
61 | } threshold_t; | 60 | } threshold_t; |
62 | 61 | ||
@@ -69,7 +68,7 @@ void print_help (void); | |||
69 | threshold_t warn; | 68 | threshold_t warn; |
70 | threshold_t crit; | 69 | threshold_t crit; |
71 | int verbose; | 70 | int verbose; |
72 | bool allswaps; | 71 | int allswaps; |
73 | int no_swap_state = STATE_CRITICAL; | 72 | int no_swap_state = STATE_CRITICAL; |
74 | 73 | ||
75 | int | 74 | int |
@@ -467,7 +466,7 @@ process_arguments (int argc, char **argv) | |||
467 | 466 | ||
468 | if (optarg[length - 1] == '%') { | 467 | if (optarg[length - 1] == '%') { |
469 | /* It's percentage */ | 468 | /* It's percentage */ |
470 | warn.is_percentage = true; | 469 | warn.is_percentage = 1; |
471 | optarg[length - 1] = '\0'; | 470 | optarg[length - 1] = '\0'; |
472 | if (is_uint64(optarg, &warn.value)) { | 471 | if (is_uint64(optarg, &warn.value)) { |
473 | if (warn.value > 100) { | 472 | if (warn.value > 100) { |
@@ -478,7 +477,7 @@ process_arguments (int argc, char **argv) | |||
478 | } | 477 | } |
479 | } else { | 478 | } else { |
480 | /* It's Bytes */ | 479 | /* It's Bytes */ |
481 | warn.is_percentage = false; | 480 | warn.is_percentage = 0; |
482 | if (is_uint64(optarg, &warn.value)) { | 481 | if (is_uint64(optarg, &warn.value)) { |
483 | break; | 482 | break; |
484 | } else { | 483 | } else { |
@@ -498,7 +497,7 @@ process_arguments (int argc, char **argv) | |||
498 | 497 | ||
499 | if (optarg[length - 1] == '%') { | 498 | if (optarg[length - 1] == '%') { |
500 | /* It's percentage */ | 499 | /* It's percentage */ |
501 | crit.is_percentage = true; | 500 | crit.is_percentage = 1; |
502 | optarg[length - 1] = '\0'; | 501 | optarg[length - 1] = '\0'; |
503 | if (is_uint64(optarg, &crit.value)) { | 502 | if (is_uint64(optarg, &crit.value)) { |
504 | if (crit.value> 100) { | 503 | if (crit.value> 100) { |
@@ -509,7 +508,7 @@ process_arguments (int argc, char **argv) | |||
509 | } | 508 | } |
510 | } else { | 509 | } else { |
511 | /* It's Bytes */ | 510 | /* It's Bytes */ |
512 | crit.is_percentage = false; | 511 | crit.is_percentage = 0; |
513 | if (is_uint64(optarg, &crit.value)) { | 512 | if (is_uint64(optarg, &crit.value)) { |
514 | break; | 513 | break; |
515 | } else { | 514 | } else { |