summaryrefslogtreecommitdiffstats
path: root/plugins/utils.c
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-09-15 13:18:17 +0200
committerGitHub <noreply@github.com>2025-09-15 13:18:17 +0200
commit8ef825d85fb4d09c32ca44c545d6eb8d995ddea4 (patch)
tree5ab7b18797dfd5849dec7827c87ca3bb5fcb0993 /plugins/utils.c
parenta3cf9041af810770daf5d9b83f1906fa9bb0dd11 (diff)
parent204cf956f0b3db90d079321ee957b3860da7e33f (diff)
downloadmonitoring-plugins-8ef825d85fb4d09c32ca44c545d6eb8d995ddea4.tar.gz
Merge pull request #2149 from RincewindsHat/clang-format
Clang format
Diffstat (limited to 'plugins/utils.c')
-rw-r--r--plugins/utils.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/plugins/utils.c b/plugins/utils.c
index 34335c89..41fe5fcf 100644
--- a/plugins/utils.c
+++ b/plugins/utils.c
@@ -285,7 +285,8 @@ double delta_time(struct timeval tv) {
285 struct timeval now; 285 struct timeval now;
286 286
287 gettimeofday(&now, NULL); 287 gettimeofday(&now, NULL);
288 return ((double)(now.tv_sec - tv.tv_sec) + (double)(now.tv_usec - tv.tv_usec) / (double)1000000); 288 return ((double)(now.tv_sec - tv.tv_sec) +
289 (double)(now.tv_usec - tv.tv_usec) / (double)1000000);
289} 290}
290 291
291long deltime(struct timeval tv) { 292long deltime(struct timeval tv) {
@@ -507,8 +508,8 @@ int xasprintf(char **strp, const char *fmt, ...) {
507 * 508 *
508 ******************************************************************************/ 509 ******************************************************************************/
509 510
510char *perfdata(const char *label, long int val, const char *uom, bool warnp, long int warn, bool critp, long int crit, bool minp, 511char *perfdata(const char *label, long int val, const char *uom, bool warnp, long int warn,
511 long int minv, bool maxp, long int maxv) { 512 bool critp, long int crit, bool minp, long int minv, bool maxp, long int maxv) {
512 char *data = NULL; 513 char *data = NULL;
513 514
514 if (strpbrk(label, "'= ")) { 515 if (strpbrk(label, "'= ")) {
@@ -542,10 +543,11 @@ char *perfdata(const char *label, long int val, const char *uom, bool warnp, lon
542 return data; 543 return data;
543} 544}
544 545
545char *perfdata_uint64(const char *label, uint64_t val, const char *uom, bool warnp, /* Warning present */ 546char *perfdata_uint64(const char *label, uint64_t val, const char *uom,
546 uint64_t warn, bool critp, /* Critical present */ 547 bool warnp, /* Warning present */
547 uint64_t crit, bool minp, /* Minimum present */ 548 uint64_t warn, bool critp, /* Critical present */
548 uint64_t minv, bool maxp, /* Maximum present */ 549 uint64_t crit, bool minp, /* Minimum present */
550 uint64_t minv, bool maxp, /* Maximum present */
549 uint64_t maxv) { 551 uint64_t maxv) {
550 char *data = NULL; 552 char *data = NULL;
551 553
@@ -580,10 +582,11 @@ char *perfdata_uint64(const char *label, uint64_t val, const char *uom, bool war
580 return data; 582 return data;
581} 583}
582 584
583char *perfdata_int64(const char *label, int64_t val, const char *uom, bool warnp, /* Warning present */ 585char *perfdata_int64(const char *label, int64_t val, const char *uom,
584 int64_t warn, bool critp, /* Critical present */ 586 bool warnp, /* Warning present */
585 int64_t crit, bool minp, /* Minimum present */ 587 int64_t warn, bool critp, /* Critical present */
586 int64_t minv, bool maxp, /* Maximum present */ 588 int64_t crit, bool minp, /* Minimum present */
589 int64_t minv, bool maxp, /* Maximum present */
587 int64_t maxv) { 590 int64_t maxv) {
588 char *data = NULL; 591 char *data = NULL;
589 592
@@ -618,8 +621,8 @@ char *perfdata_int64(const char *label, int64_t val, const char *uom, bool warnp
618 return data; 621 return data;
619} 622}
620 623
621char *fperfdata(const char *label, double val, const char *uom, bool warnp, double warn, bool critp, double crit, bool minp, double minv, 624char *fperfdata(const char *label, double val, const char *uom, bool warnp, double warn, bool critp,
622 bool maxp, double maxv) { 625 double crit, bool minp, double minv, bool maxp, double maxv) {
623 char *data = NULL; 626 char *data = NULL;
624 627
625 if (strpbrk(label, "'= ")) { 628 if (strpbrk(label, "'= ")) {
@@ -655,7 +658,8 @@ char *fperfdata(const char *label, double val, const char *uom, bool warnp, doub
655 return data; 658 return data;
656} 659}
657 660
658char *sperfdata(const char *label, double val, const char *uom, char *warn, char *crit, bool minp, double minv, bool maxp, double maxv) { 661char *sperfdata(const char *label, double val, const char *uom, char *warn, char *crit, bool minp,
662 double minv, bool maxp, double maxv) {
659 char *data = NULL; 663 char *data = NULL;
660 if (strpbrk(label, "'= ")) { 664 if (strpbrk(label, "'= ")) {
661 xasprintf(&data, "'%s'=", label); 665 xasprintf(&data, "'%s'=", label);
@@ -690,7 +694,8 @@ char *sperfdata(const char *label, double val, const char *uom, char *warn, char
690 return data; 694 return data;
691} 695}
692 696
693char *sperfdata_int(const char *label, int val, const char *uom, char *warn, char *crit, bool minp, int minv, bool maxp, int maxv) { 697char *sperfdata_int(const char *label, int val, const char *uom, char *warn, char *crit, bool minp,
698 int minv, bool maxp, int maxv) {
694 char *data = NULL; 699 char *data = NULL;
695 if (strpbrk(label, "'= ")) { 700 if (strpbrk(label, "'= ")) {
696 xasprintf(&data, "'%s'=", label); 701 xasprintf(&data, "'%s'=", label);