diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-03-23 10:22:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-23 10:22:06 (GMT) |
commit | 8698a6d976012908ea0af36ca1a520c3111928c7 (patch) | |
tree | 730b99d2f0e14f1c0b56b133f1461b068cdf43ea /plugins/check_swap.c | |
parent | 152acfabcf9faa3600b5ebb80a3fb569cd691ef3 (diff) | |
download | monitoring-plugins-8698a6d976012908ea0af36ca1a520c3111928c7.tar.gz |
check_swap: replace another fake boolen and small improvements (#1996)
* check_swap: Change another fake boolen to a real one
* check_swap: Rename type since *_t is reserved for C standard types
* check_swap: Update copyright
Diffstat (limited to 'plugins/check_swap.c')
-rw-r--r-- | plugins/check_swap.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/plugins/check_swap.c b/plugins/check_swap.c index fddd93f..499a8d2 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * License: GPL | 5 | * License: GPL |
6 | * Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net) | 6 | * Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net) |
7 | * Copyright (c) 2000-2007 Monitoring Plugins Development Team | 7 | * Copyright (c) 2000-2024 Monitoring Plugins Development Team |
8 | * | 8 | * |
9 | * Description: | 9 | * Description: |
10 | * | 10 | * |
@@ -28,7 +28,7 @@ | |||
28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
29 | 29 | ||
30 | const char *progname = "check_swap"; | 30 | const char *progname = "check_swap"; |
31 | const char *copyright = "2000-2007"; | 31 | const char *copyright = "2000-2024"; |
32 | const char *email = "devel@monitoring-plugins.org"; | 32 | const char *email = "devel@monitoring-plugins.org"; |
33 | 33 | ||
34 | #include "common.h" | 34 | #include "common.h" |
@@ -52,9 +52,9 @@ const char *email = "devel@monitoring-plugins.org"; | |||
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | typedef struct { | 54 | typedef struct { |
55 | int is_percentage; | 55 | bool is_percentage; |
56 | uint64_t value; | 56 | uint64_t value; |
57 | } threshold_t; | 57 | } threshold; |
58 | 58 | ||
59 | int check_swap (float free_swap_mb, float total_swap_mb); | 59 | int check_swap (float free_swap_mb, float total_swap_mb); |
60 | int process_arguments (int argc, char **argv); | 60 | int process_arguments (int argc, char **argv); |
@@ -62,8 +62,8 @@ int validate_arguments (void); | |||
62 | void print_usage (void); | 62 | void print_usage (void); |
63 | void print_help (void); | 63 | void print_help (void); |
64 | 64 | ||
65 | threshold_t warn; | 65 | threshold warn; |
66 | threshold_t crit; | 66 | threshold crit; |
67 | int verbose; | 67 | int verbose; |
68 | bool allswaps = false; | 68 | bool allswaps = false; |
69 | int no_swap_state = STATE_CRITICAL; | 69 | int no_swap_state = STATE_CRITICAL; |
@@ -465,7 +465,7 @@ process_arguments (int argc, char **argv) | |||
465 | 465 | ||
466 | if (optarg[length - 1] == '%') { | 466 | if (optarg[length - 1] == '%') { |
467 | /* It's percentage */ | 467 | /* It's percentage */ |
468 | warn.is_percentage = 1; | 468 | warn.is_percentage = true; |
469 | optarg[length - 1] = '\0'; | 469 | optarg[length - 1] = '\0'; |
470 | if (is_uint64(optarg, &warn.value)) { | 470 | if (is_uint64(optarg, &warn.value)) { |
471 | if (warn.value > 100) { | 471 | if (warn.value > 100) { |
@@ -475,7 +475,7 @@ process_arguments (int argc, char **argv) | |||
475 | break; | 475 | break; |
476 | } else { | 476 | } else { |
477 | /* It's Bytes */ | 477 | /* It's Bytes */ |
478 | warn.is_percentage = 0; | 478 | warn.is_percentage = false; |
479 | if (is_uint64(optarg, &warn.value)) { | 479 | if (is_uint64(optarg, &warn.value)) { |
480 | break; | 480 | break; |
481 | } else { | 481 | } else { |
@@ -495,7 +495,7 @@ process_arguments (int argc, char **argv) | |||
495 | 495 | ||
496 | if (optarg[length - 1] == '%') { | 496 | if (optarg[length - 1] == '%') { |
497 | /* It's percentage */ | 497 | /* It's percentage */ |
498 | crit.is_percentage = 1; | 498 | crit.is_percentage = true; |
499 | optarg[length - 1] = '\0'; | 499 | optarg[length - 1] = '\0'; |
500 | if (is_uint64(optarg, &crit.value)) { | 500 | if (is_uint64(optarg, &crit.value)) { |
501 | if (crit.value> 100) { | 501 | if (crit.value> 100) { |
@@ -505,7 +505,7 @@ process_arguments (int argc, char **argv) | |||
505 | break; | 505 | break; |
506 | } else { | 506 | } else { |
507 | /* It's Bytes */ | 507 | /* It's Bytes */ |
508 | crit.is_percentage = 0; | 508 | crit.is_percentage = false; |
509 | if (is_uint64(optarg, &crit.value)) { | 509 | if (is_uint64(optarg, &crit.value)) { |
510 | break; | 510 | break; |
511 | } else { | 511 | } else { |