[Nagiosplug-checkins] nagiosplug/lib utils_tcp.c, NONE, 1.1 utils_tcp.h, NONE, 1.1 Makefile.am, 1.32, 1.33
Matthias Eble
psychotrahe at users.sourceforge.net
Sun Jun 3 16:40:14 CEST 2007
Update of /cvsroot/nagiosplug/nagiosplug/lib
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16468/lib
Modified Files:
Makefile.am
Added Files:
utils_tcp.c utils_tcp.h
Log Message:
Moved check_tcp's expect string testing into utils_tcp for testing purposes.
Added -A/--all flag to test for every expect string passed.
--- NEW FILE: utils_tcp.c ---
/****************************************************************************
* Utils for check_tcp
*
* License: GPL
* Copyright (c) 1999-2007 nagios-plugins team
*
* Last Modified: $Date: 2007/06/03 14:40:10 $
*
* Description:
*
* This file contains utilities for check_tcp. These are tested by libtap
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: utils_tcp.c,v 1.1 2007/06/03 14:40:10 psychotrahe Exp $
*
*****************************************************************************/
#include "common.h"
#include "utils_tcp.h"
int
np_expect_match(char* status, char** server_expect, int expect_count, int all, int exact_match, int verbose)
{
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;
}
--- NEW FILE: utils_tcp.h ---
/* Header file for utils_disk */
int np_expect_match(char* status, char** server_expect, int server_expect_count,
int all, int exact_match, int verbose);
Index: Makefile.am
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/lib/Makefile.am,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- Makefile.am 24 Jan 2007 22:46:56 -0000 1.32
+++ Makefile.am 3 Jun 2007 14:40:11 -0000 1.33
@@ -5,8 +5,8 @@
noinst_LIBRARIES = libnagiosplug.a
-libnagiosplug_a_SOURCES = utils_base.c utils_disk.c
-EXTRA_DIST = utils_base.h utils_disk.h
+libnagiosplug_a_SOURCES = utils_base.c utils_disk.c utils_tcp.c
+EXTRA_DIST = utils_base.h utils_disk.h utils_tcp.h
INCLUDES = -I$(srcdir) -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins
More information about the Commits
mailing list