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 /lib/utils_tcp.c | |
| parent | e8044713d41f5ef1d9ce814df4a079d8f92306b0 (diff) | |
| download | monitoring-plugins-7573aa16169e80baec80440463a524e5f4e92911.tar.gz | |
Minor cosmetic changes
Diffstat (limited to 'lib/utils_tcp.c')
| -rw-r--r-- | lib/utils_tcp.c | 11 |
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 @@ | |||
| 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; |
