summaryrefslogtreecommitdiffstats
path: root/plugins/check_snmp.c
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-08-27 16:43:11 +0200
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-08-27 16:43:11 +0200
commitfaf794b40139f02854b0737b2d62c5a039968762 (patch)
tree71741433e586b02f11604c30f164d9bed451faa3 /plugins/check_snmp.c
parent015e4c098693e6234de0994879a173dd2463fefd (diff)
downloadmonitoring-plugins-faf794b40139f02854b0737b2d62c5a039968762.tar.gz
check_snmp: remove leftover multiply function
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r--plugins/check_snmp.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index badf9260..3ac949a5 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -88,7 +88,6 @@ char *trim_whitespaces_and_check_quoting(char *str);
88char *get_next_argument(char *str); 88char *get_next_argument(char *str);
89void print_usage(void); 89void print_usage(void);
90void print_help(void); 90void print_help(void);
91char *multiply(char *str, double multiplier, char *fmt_str);
92 91
93static int verbose = 0; 92static int verbose = 0;
94 93
@@ -954,53 +953,6 @@ char *get_next_argument(char *str) {
954 return NULL; 953 return NULL;
955} 954}
956 955
957/* multiply result (values 0 < n < 1 work as divider) */
958char *multiply(char *str, double multiplier, char *fmt_str) {
959
960 if (multiplier == 1) {
961 return (str);
962 }
963
964 if (verbose > 2) {
965 printf(" multiply input: %s\n", str);
966 }
967
968 char *endptr;
969 double val = strtod(str, &endptr);
970 if ((val == 0.0) && (endptr == str)) {
971 die(STATE_UNKNOWN, _("multiplier set (%.1f), but input is not a number: %s"), multiplier,
972 str);
973 }
974
975 if (verbose > 2) {
976 printf(" multiply extracted double: %f\n", val);
977 }
978
979 val *= multiplier;
980 char *conv = "%f";
981 if (fmt_str != NULL) {
982 conv = fmt_str;
983 }
984
985 char *buffer = calloc(1, DEFAULT_BUFFER_SIZE);
986 if (buffer == NULL) {
987 die(STATE_UNKNOWN, "calloc failed");
988 }
989
990 if (val == (int)val) {
991 snprintf(buffer, DEFAULT_BUFFER_SIZE, "%.0f", val);
992 } else {
993 if (verbose > 2) {
994 printf(" multiply using format: %s\n", conv);
995 }
996 snprintf(buffer, DEFAULT_BUFFER_SIZE, conv, val);
997 }
998 if (verbose > 2) {
999 printf(" multiply result: %s\n", buffer);
1000 }
1001 return buffer;
1002}
1003
1004void print_help(void) { 956void print_help(void) {
1005 print_revision(progname, NP_VERSION); 957 print_revision(progname, NP_VERSION);
1006 958