diff options
| author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-12 21:50:18 +0200 | 
|---|---|---|
| committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-12 21:50:18 +0200 | 
| commit | 7573aa16169e80baec80440463a524e5f4e92911 (patch) | |
| tree | d2f0cd9bdd7e7465d3763c15d69817c71f23c1ea | |
| parent | e8044713d41f5ef1d9ce814df4a079d8f92306b0 (diff) | |
| download | monitoring-plugins-7573aa16169e80baec80440463a524e5f4e92911.tar.gz | |
Minor cosmetic changes
| -rw-r--r-- | lib/tests/test_tcp.c | 6 | ||||
| -rw-r--r-- | 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 ae6dc1f4..114252b4 100644 --- a/lib/tests/test_tcp.c +++ b/lib/tests/test_tcp.c | |||
| @@ -21,10 +21,11 @@ | |||
| 21 | #include "tap.h" | 21 | #include "tap.h" | 
| 22 | 22 | ||
| 23 | int | 23 | int | 
| 24 | main (int argc, char **argv) | 24 | main(void) | 
| 25 | { | 25 | { | 
| 26 | char** server_expect; | 26 | char **server_expect; | 
| 27 | int server_expect_count = 3; | 27 | int server_expect_count = 3; | 
| 28 | |||
| 28 | plan_tests(9); | 29 | plan_tests(9); | 
| 29 | 30 | ||
| 30 | server_expect = malloc(sizeof(char*) * server_expect_count); | 31 | server_expect = malloc(sizeof(char*) * server_expect_count); | 
| @@ -55,4 +56,3 @@ main (int argc, char **argv) | |||
| 55 | 56 | ||
| 56 | return exit_status(); | 57 | return exit_status(); | 
| 57 | } | 58 | } | 
| 58 | |||
| 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 @@ | |||
| 36 | } while (0) | 36 | } while (0) | 
| 37 | 37 | ||
| 38 | enum np_match_result | 38 | enum np_match_result | 
| 39 | np_expect_match(char* status, char** server_expect, int expect_count, int flags) | 39 | np_expect_match(char *status, char **server_expect, int expect_count, int flags) | 
| 40 | { | 40 | { | 
| 41 | int i, match = 0, partial = 0; | 41 | int i, match = 0, partial = 0; | 
| 42 | |||
| 42 | for (i = 0; i < expect_count; i++) { | 43 | for (i = 0; i < expect_count; i++) { | 
| 43 | if (flags & NP_MATCH_VERBOSE) | 44 | if (flags & NP_MATCH_VERBOSE) | 
| 44 | printf ("looking for [%s] %s [%s]\n", server_expect[i], | 45 | printf("looking for [%s] %s [%s]\n", server_expect[i], | 
| 45 | (flags & NP_MATCH_EXACT) ? "in beginning of" : "anywhere in", | 46 | (flags & NP_MATCH_EXACT) ? | 
| 46 | status); | 47 | "in beginning of" : "anywhere in", | 
| 48 | status); | ||
| 47 | 49 | ||
| 48 | if (flags & NP_MATCH_EXACT) { | 50 | if (flags & NP_MATCH_EXACT) { | 
| 49 | if (strncmp(status, server_expect[i], strlen(server_expect[i])) == 0) { | 51 | 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) | |||
| 62 | } | 64 | } | 
| 63 | VERBOSE("couldn't find it"); | 65 | VERBOSE("couldn't find it"); | 
| 64 | } | 66 | } | 
| 67 | |||
| 65 | if ((flags & NP_MATCH_ALL && match == expect_count) || | 68 | if ((flags & NP_MATCH_ALL && match == expect_count) || | 
| 66 | (!(flags & NP_MATCH_ALL) && match >= 1)) | 69 | (!(flags & NP_MATCH_ALL) && match >= 1)) | 
| 67 | return NP_MATCH_SUCCESS; | 70 | return NP_MATCH_SUCCESS; | 
