aboutsummaryrefslogtreecommitdiff
path: root/lib/utils_tcp.c
diff options
context:
space:
mode:
authorGravatar Holger Weiss <holger@zedat.fu-berlin.de> 2013-09-12 21:50:18 +0200
committerGravatar Holger Weiss <holger@zedat.fu-berlin.de> 2013-09-12 21:50:18 +0200
commit7573aa16169e80baec80440463a524e5f4e92911 (patch)
treed2f0cd9bdd7e7465d3763c15d69817c71f23c1ea /lib/utils_tcp.c
parente8044713d41f5ef1d9ce814df4a079d8f92306b0 (diff)
downloadmonitoring-plugins-7573aa16169e80baec80440463a524e5f4e92911.tar.gz
Minor cosmetic changes
Diffstat (limited to 'lib/utils_tcp.c')
-rw-r--r--lib/utils_tcp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/utils_tcp.c b/lib/utils_tcp.c
index 497a1701..46ad7f72 100644
--- a/lib/utils_tcp.c
+++ b/lib/utils_tcp.c
@@ -36,14 +36,16 @@
} while (0)
enum np_match_result
-np_expect_match(char* status, char** server_expect, int expect_count, int flags)
+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) {
@@ -62,6 +64,7 @@ np_expect_match(char* status, char** server_expect, int expect_count, int flags)
}
VERBOSE("couldn't find it");
}
+
if ((flags & NP_MATCH_ALL && match == expect_count) ||
(!(flags & NP_MATCH_ALL) && match >= 1))
return NP_MATCH_SUCCESS;