summaryrefslogtreecommitdiffstats
path: root/lib/utils_tcp.c
diff options
context:
space:
mode:
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 @@
36 } while (0) 36 } while (0)
37 37
38enum np_match_result 38enum np_match_result
39np_expect_match(char* status, char** server_expect, int expect_count, int flags) 39np_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;