[nagiosplug] Minor cosmetic changes
Nagios Plugin Development
nagios-plugins at users.sourceforge.net
Thu Sep 12 22:10:16 CEST 2013
Module: nagiosplug
Branch: master
Commit: 7573aa16169e80baec80440463a524e5f4e92911
Author: Holger Weiss <holger at zedat.fu-berlin.de>
Date: Thu Sep 12 21:50:18 2013 +0200
URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=7573aa1
Minor cosmetic changes
---
lib/tests/test_tcp.c | 6 +++---
lib/utils_tcp.c | 11 +++++++----
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/lib/tests/test_tcp.c b/lib/tests/test_tcp.c
index ae6dc1f..114252b 100644
--- a/lib/tests/test_tcp.c
+++ b/lib/tests/test_tcp.c
@@ -21,10 +21,11 @@
#include "tap.h"
int
-main (int argc, char **argv)
+main(void)
{
- char** server_expect;
+ char **server_expect;
int server_expect_count = 3;
+
plan_tests(9);
server_expect = malloc(sizeof(char*) * server_expect_count);
@@ -55,4 +56,3 @@ main (int argc, char **argv)
return exit_status();
}
-
diff --git a/lib/utils_tcp.c b/lib/utils_tcp.c
index 497a170..46ad7f7 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;
More information about the Commits
mailing list