From ee1ba3209993b72e90f5fe30a16ad951f1e2402d Mon Sep 17 00:00:00 2001 From: Lorenz Kästle Date: Thu, 17 Oct 2024 17:57:50 +0200 Subject: lib: clang-format --- lib/utils_tcp.c | 78 ++++++++++++++++++++++++++------------------------------- 1 file changed, 36 insertions(+), 42 deletions(-) (limited to 'lib/utils_tcp.c') diff --git a/lib/utils_tcp.c b/lib/utils_tcp.c index 23ee4a95..ffb351e6 100644 --- a/lib/utils_tcp.c +++ b/lib/utils_tcp.c @@ -1,51 +1,46 @@ /***************************************************************************** -* -* Library for check_tcp -* -* License: GPL -* Copyright (c) 1999-2013 Monitoring Plugins Development Team -* -* Description: -* -* This file contains utilities for check_tcp. These are tested by libtap -* -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* -*****************************************************************************/ + * + * Library for check_tcp + * + * License: GPL + * Copyright (c) 1999-2013 Monitoring Plugins Development Team + * + * Description: + * + * This file contains utilities for check_tcp. These are tested by libtap + * + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + *****************************************************************************/ #include "common.h" #include "utils_tcp.h" -#define VERBOSE(message) \ - do { \ - if (flags & NP_MATCH_VERBOSE) \ - puts(message); \ +#define VERBOSE(message) \ + do { \ + if (flags & NP_MATCH_VERBOSE) \ + puts(message); \ } while (0) -enum np_match_result -np_expect_match(char *status, char **server_expect, int expect_count, int flags) -{ +enum np_match_result np_expect_match(char *status, char **server_expect, int expect_count, int flags) { int i, match = 0, partial = 0; for (i = 0; i < expect_count; i++) { if (flags & NP_MATCH_VERBOSE) - printf("looking for [%s] %s [%s]\n", server_expect[i], - (flags & NP_MATCH_EXACT) ? - "in beginning of" : "anywhere in", - status); + printf("looking for [%s] %s [%s]\n", server_expect[i], (flags & NP_MATCH_EXACT) ? "in beginning of" : "anywhere in", status); if (flags & NP_MATCH_EXACT) { if (strncmp(status, server_expect[i], strlen(server_expect[i])) == 0) { @@ -58,15 +53,14 @@ np_expect_match(char *status, char **server_expect, int expect_count, int flags) continue; } } else if (strstr(status, server_expect[i]) != NULL) { - VERBOSE("found it"); - match++; - continue; + VERBOSE("found it"); + match++; + continue; } VERBOSE("couldn't find it"); } - if ((flags & NP_MATCH_ALL && match == expect_count) || - (!(flags & NP_MATCH_ALL) && match >= 1)) + if ((flags & NP_MATCH_ALL && match == expect_count) || (!(flags & NP_MATCH_ALL) && match >= 1)) return NP_MATCH_SUCCESS; else if (partial > 0 || !(flags & NP_MATCH_EXACT)) return NP_MATCH_RETRY; -- cgit v1.2.3-74-g34f1