Back to index

nagios-plugins  1.4.16
Functions
utils_tcp.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int np_expect_match (char *status, char **server_expect, int server_expect_count, int all, int exact_match, int verbose)

Function Documentation

int np_expect_match ( char *  status,
char **  server_expect,
int  server_expect_count,
int  all,
int  exact_match,
int  verbose 
)

Definition at line 33 of file utils_tcp.c.

{
       int match = 0;
       int i;
       for (i = 0; i < expect_count; i++) {
              if (verbose)
                     printf ("looking for [%s] %s [%s]\n", server_expect[i],
                                   (exact_match) ? "in beginning of" : "anywhere in",
                                   status);

              if ((exact_match && !strncmp(status, server_expect[i], strlen(server_expect[i]))) ||
                     (! exact_match && strstr(status, server_expect[i])))
              {
                     if(verbose) puts("found it");
                     match += 1;
              } else
                     if(verbose) puts("couldn't find it");
       }
       if ((all == TRUE && match == expect_count) ||
              (! all && match >= 1)) {
              return TRUE;
       } else
              return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function: