Imported Upstream version 1.4.12

This commit is contained in:
Jan Wagner 2013-11-26 23:55:28 +01:00
parent 1d1585cd09
commit 4ab9f0d24c
291 changed files with 27277 additions and 11364 deletions

View file

@ -5,8 +5,12 @@ SUBDIRS = tests
noinst_LIBRARIES = libnagiosplug.a
libnagiosplug_a_SOURCES = utils_base.c utils_disk.c utils_tcp.c utils_cmd.c base64.c
EXTRA_DIST = utils_base.h utils_disk.h utils_tcp.h utils_cmd.h base64.h
libnagiosplug_a_SOURCES = utils_base.c utils_disk.c utils_tcp.c utils_cmd.c
EXTRA_DIST = utils_base.h utils_disk.h utils_tcp.h utils_cmd.h parse_ini.h extra_opts.h
if USE_PARSE_INI
libnagiosplug_a_SOURCES += parse_ini.c extra_opts.c
endif USE_PARSE_INI
INCLUDES = -I$(srcdir) -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins

View file

@ -35,40 +35,45 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@USE_PARSE_INI_TRUE@am__append_1 = parse_ini.c extra_opts.c
subdir = lib
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/np_mysqlclient.m4 \
$(top_srcdir)/gl/m4/absolute-header.m4 \
$(top_srcdir)/gl/m4/alloca.m4 \
$(top_srcdir)/gl/m4/arpa_inet_h.m4 \
$(top_srcdir)/gl/m4/c-strtod.m4 $(top_srcdir)/gl/m4/cloexec.m4 \
$(top_srcdir)/gl/m4/codeset.m4 $(top_srcdir)/gl/m4/dirname.m4 \
$(top_srcdir)/gl/m4/dos.m4 \
$(top_srcdir)/gl/m4/base64.m4 $(top_srcdir)/gl/m4/c-strtod.m4 \
$(top_srcdir)/gl/m4/cloexec.m4 $(top_srcdir)/gl/m4/codeset.m4 \
$(top_srcdir)/gl/m4/dirname.m4 $(top_srcdir)/gl/m4/dos.m4 \
$(top_srcdir)/gl/m4/double-slash-root.m4 \
$(top_srcdir)/gl/m4/eoverflow.m4 $(top_srcdir)/gl/m4/error.m4 \
$(top_srcdir)/gl/m4/exitfail.m4 \
$(top_srcdir)/gl/m4/extensions.m4 \
$(top_srcdir)/gl/m4/fcntl-safer.m4 \
$(top_srcdir)/gl/m4/float_h.m4 $(top_srcdir)/gl/m4/floorf.m4 \
$(top_srcdir)/gl/m4/fstypename.m4 \
$(top_srcdir)/gl/m4/fsusage.m4 \
$(top_srcdir)/gl/m4/getaddrinfo.m4 \
$(top_srcdir)/gl/m4/gethostname.m4 \
$(top_srcdir)/gl/m4/getloadavg.m4 \
$(top_srcdir)/gl/m4/getopt.m4 $(top_srcdir)/gl/m4/gettext.m4 \
$(top_srcdir)/gl/m4/glibc21.m4 \
$(top_srcdir)/gl/m4/gnulib-common.m4 \
$(top_srcdir)/gl/m4/gnulib-comp.m4 \
$(top_srcdir)/gl/m4/iconv.m4 $(top_srcdir)/gl/m4/inet_ntop.m4 \
$(top_srcdir)/gl/m4/inline.m4 $(top_srcdir)/gl/m4/intmax_t.m4 \
$(top_srcdir)/gl/m4/iconv.m4 \
$(top_srcdir)/gl/m4/include_next.m4 \
$(top_srcdir)/gl/m4/inet_ntop.m4 $(top_srcdir)/gl/m4/inline.m4 \
$(top_srcdir)/gl/m4/intlmacosx.m4 \
$(top_srcdir)/gl/m4/intmax_t.m4 \
$(top_srcdir)/gl/m4/inttypes_h.m4 \
$(top_srcdir)/gl/m4/lib-ld.m4 $(top_srcdir)/gl/m4/lib-link.m4 \
$(top_srcdir)/gl/m4/lib-prefix.m4 $(top_srcdir)/gl/m4/lock.m4 \
$(top_srcdir)/gl/m4/longdouble.m4 \
$(top_srcdir)/gl/m4/lib-prefix.m4 \
$(top_srcdir)/gl/m4/localcharset.m4 \
$(top_srcdir)/gl/m4/longlong.m4 \
$(top_srcdir)/gl/m4/ls-mntd-fs.m4 \
$(top_srcdir)/gl/m4/mbchar.m4 $(top_srcdir)/gl/m4/mbiter.m4 \
$(top_srcdir)/gl/m4/mbrtowc.m4 $(top_srcdir)/gl/m4/memchr.m4 \
$(top_srcdir)/gl/m4/minmax.m4 $(top_srcdir)/gl/m4/mountlist.m4 \
$(top_srcdir)/gl/m4/malloc.m4 $(top_srcdir)/gl/m4/math_h.m4 \
$(top_srcdir)/gl/m4/mbstate_t.m4 \
$(top_srcdir)/gl/m4/mountlist.m4 \
$(top_srcdir)/gl/m4/netinet_in_h.m4 $(top_srcdir)/gl/m4/nls.m4 \
$(top_srcdir)/gl/m4/onceonly_2_57.m4 $(top_srcdir)/gl/m4/po.m4 \
$(top_srcdir)/gl/m4/progtest.m4 $(top_srcdir)/gl/m4/regex.m4 \
@ -78,21 +83,21 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/np_mysqlclient.m4 \
$(top_srcdir)/gl/m4/snprintf.m4 $(top_srcdir)/gl/m4/socklen.m4 \
$(top_srcdir)/gl/m4/sockpfaf.m4 $(top_srcdir)/gl/m4/ssize_t.m4 \
$(top_srcdir)/gl/m4/stdbool.m4 $(top_srcdir)/gl/m4/stdint.m4 \
$(top_srcdir)/gl/m4/stdint_h.m4 $(top_srcdir)/gl/m4/strcase.m4 \
$(top_srcdir)/gl/m4/strdup.m4 $(top_srcdir)/gl/m4/strndup.m4 \
$(top_srcdir)/gl/m4/stdint_h.m4 $(top_srcdir)/gl/m4/stdio_h.m4 \
$(top_srcdir)/gl/m4/stdlib_h.m4 $(top_srcdir)/gl/m4/strdup.m4 \
$(top_srcdir)/gl/m4/strerror.m4 \
$(top_srcdir)/gl/m4/string_h.m4 $(top_srcdir)/gl/m4/strndup.m4 \
$(top_srcdir)/gl/m4/strnlen.m4 \
$(top_srcdir)/gl/m4/sys_socket_h.m4 \
$(top_srcdir)/gl/m4/ulonglong.m4 \
$(top_srcdir)/gl/m4/unistd-safer.m4 \
$(top_srcdir)/gl/m4/unistd_h.m4 \
$(top_srcdir)/gl/m4/vasnprintf.m4 \
$(top_srcdir)/gl/m4/vasprintf.m4 \
$(top_srcdir)/gl/m4/vsnprintf.m4 $(top_srcdir)/gl/m4/wchar.m4 \
$(top_srcdir)/gl/m4/wchar_t.m4 $(top_srcdir)/gl/m4/wctype.m4 \
$(top_srcdir)/gl/m4/wcwidth.m4 $(top_srcdir)/gl/m4/wint_t.m4 \
$(top_srcdir)/gl/m4/xalloc.m4 $(top_srcdir)/gl/m4/xsize.m4 \
$(top_srcdir)/gl/m4/xstrndup.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.in
$(top_srcdir)/gl/m4/wint_t.m4 $(top_srcdir)/gl/m4/xalloc.m4 \
$(top_srcdir)/gl/m4/xsize.m4 $(top_srcdir)/gl/m4/xstrndup.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs
@ -102,8 +107,12 @@ LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
libnagiosplug_a_AR = $(AR) $(ARFLAGS)
libnagiosplug_a_LIBADD =
am__libnagiosplug_a_SOURCES_DIST = utils_base.c utils_disk.c \
utils_tcp.c utils_cmd.c parse_ini.c extra_opts.c
@USE_PARSE_INI_TRUE@am__objects_1 = parse_ini.$(OBJEXT) \
@USE_PARSE_INI_TRUE@ extra_opts.$(OBJEXT)
am_libnagiosplug_a_OBJECTS = utils_base.$(OBJEXT) utils_disk.$(OBJEXT) \
utils_tcp.$(OBJEXT) utils_cmd.$(OBJEXT) base64.$(OBJEXT)
utils_tcp.$(OBJEXT) utils_cmd.$(OBJEXT) $(am__objects_1)
libnagiosplug_a_OBJECTS = $(am_libnagiosplug_a_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
@ -117,7 +126,7 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libnagiosplug_a_SOURCES)
DIST_SOURCES = $(libnagiosplug_a_SOURCES)
DIST_SOURCES = $(am__libnagiosplug_a_SOURCES_DIST)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
@ -129,10 +138,6 @@ CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
INSTALL = @INSTALL@
ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@
ABSOLUTE_UNISTD_H = @ABSOLUTE_UNISTD_H@
ABSOLUTE_WCHAR_H = @ABSOLUTE_WCHAR_H@
ABSOLUTE_WCTYPE_H = @ABSOLUTE_WCTYPE_H@
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
ALLOCA_H = @ALLOCA_H@
@ -177,27 +182,177 @@ EXTRA_NETOBJS = @EXTRA_NETOBJS@
EXTRA_TEST = @EXTRA_TEST@
F77 = @F77@
FFLAGS = @FFLAGS@
FLOAT_H = @FLOAT_H@
FLOORF_LIBM = @FLOORF_LIBM@
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
GETOPT_H = @GETOPT_H@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GLIBC21 = @GLIBC21@
GL_COND_LIBTOOL_FALSE = @GL_COND_LIBTOOL_FALSE@
GL_COND_LIBTOOL_TRUE = @GL_COND_LIBTOOL_TRUE@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
GNULIB_CEILF = @GNULIB_CEILF@
GNULIB_CEILL = @GNULIB_CEILL@
GNULIB_CHOWN = @GNULIB_CHOWN@
GNULIB_DUP2 = @GNULIB_DUP2@
GNULIB_FCHDIR = @GNULIB_FCHDIR@
GNULIB_FFLUSH = @GNULIB_FFLUSH@
GNULIB_FLOORF = @GNULIB_FLOORF@
GNULIB_FLOORL = @GNULIB_FLOORL@
GNULIB_FOPEN = @GNULIB_FOPEN@
GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
GNULIB_FREOPEN = @GNULIB_FREOPEN@
GNULIB_FREXP = @GNULIB_FREXP@
GNULIB_FREXPL = @GNULIB_FREXPL@
GNULIB_FSEEK = @GNULIB_FSEEK@
GNULIB_FSEEKO = @GNULIB_FSEEKO@
GNULIB_FTELL = @GNULIB_FTELL@
GNULIB_FTELLO = @GNULIB_FTELLO@
GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@
GNULIB_GETCWD = @GNULIB_GETCWD@
GNULIB_GETDELIM = @GNULIB_GETDELIM@
GNULIB_GETLINE = @GNULIB_GETLINE@
GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
GNULIB_ISFINITE = @GNULIB_ISFINITE@
GNULIB_LCHOWN = @GNULIB_LCHOWN@
GNULIB_LDEXPL = @GNULIB_LDEXPL@
GNULIB_LSEEK = @GNULIB_LSEEK@
GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@
GNULIB_MATHL = @GNULIB_MATHL@
GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@
GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@
GNULIB_MBSCHR = @GNULIB_MBSCHR@
GNULIB_MBSCSPN = @GNULIB_MBSCSPN@
GNULIB_MBSLEN = @GNULIB_MBSLEN@
GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@
GNULIB_MBSNLEN = @GNULIB_MBSNLEN@
GNULIB_MBSPBRK = @GNULIB_MBSPBRK@
GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@
GNULIB_MBSRCHR = @GNULIB_MBSRCHR@
GNULIB_MBSSEP = @GNULIB_MBSSEP@
GNULIB_MBSSPN = @GNULIB_MBSSPN@
GNULIB_MBSSTR = @GNULIB_MBSSTR@
GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@
GNULIB_MEMMEM = @GNULIB_MEMMEM@
GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
GNULIB_PUTENV = @GNULIB_PUTENV@
GNULIB_READLINK = @GNULIB_READLINK@
GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
GNULIB_ROUND = @GNULIB_ROUND@
GNULIB_ROUNDF = @GNULIB_ROUNDF@
GNULIB_ROUNDL = @GNULIB_ROUNDL@
GNULIB_SETENV = @GNULIB_SETENV@
GNULIB_SIGNBIT = @GNULIB_SIGNBIT@
GNULIB_SLEEP = @GNULIB_SLEEP@
GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
GNULIB_STPCPY = @GNULIB_STPCPY@
GNULIB_STPNCPY = @GNULIB_STPNCPY@
GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
GNULIB_STRDUP = @GNULIB_STRDUP@
GNULIB_STRERROR = @GNULIB_STRERROR@
GNULIB_STRNDUP = @GNULIB_STRNDUP@
GNULIB_STRNLEN = @GNULIB_STRNLEN@
GNULIB_STRPBRK = @GNULIB_STRPBRK@
GNULIB_STRSEP = @GNULIB_STRSEP@
GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
GNULIB_STRSTR = @GNULIB_STRSTR@
GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
GNULIB_TRUNC = @GNULIB_TRUNC@
GNULIB_TRUNCF = @GNULIB_TRUNCF@
GNULIB_TRUNCL = @GNULIB_TRUNCL@
GNULIB_UNSETENV = @GNULIB_UNSETENV@
GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@
GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@
GNULIB_WCWIDTH = @GNULIB_WCWIDTH@
GREP = @GREP@
HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@
HAVE_DECL_ASINL = @HAVE_DECL_ASINL@
HAVE_DECL_ATANL = @HAVE_DECL_ATANL@
HAVE_DECL_COSL = @HAVE_DECL_COSL@
HAVE_DECL_EXPL = @HAVE_DECL_EXPL@
HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@
HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@
HAVE_DECL_LOGL = @HAVE_DECL_LOGL@
HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
HAVE_DECL_SINL = @HAVE_DECL_SINL@
HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@
HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
HAVE_DECL_TANL = @HAVE_DECL_TANL@
HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@
HAVE_DECL_TRUNCF = @HAVE_DECL_TRUNCF@
HAVE_DECL_TRUNCL = @HAVE_DECL_TRUNCL@
HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
HAVE_DUP2 = @HAVE_DUP2@
HAVE_FSEEKO = @HAVE_FSEEKO@
HAVE_FTELLO = @HAVE_FTELLO@
HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
HAVE_ISWCNTRL = @HAVE_ISWCNTRL@
HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
HAVE_MEMPCPY = @HAVE_MEMPCPY@
HAVE_MKDTEMP = @HAVE_MKDTEMP@
HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
HAVE_OS_H = @HAVE_OS_H@
HAVE_READLINK = @HAVE_READLINK@
HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
HAVE_SETENV = @HAVE_SETENV@
HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
HAVE_SLEEP = @HAVE_SLEEP@
HAVE_STDINT_H = @HAVE_STDINT_H@
HAVE_STPCPY = @HAVE_STPCPY@
HAVE_STPNCPY = @HAVE_STPNCPY@
HAVE_STRCASESTR = @HAVE_STRCASESTR@
HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
HAVE_STRNDUP = @HAVE_STRNDUP@
HAVE_STRPBRK = @HAVE_STRPBRK@
HAVE_STRSEP = @HAVE_STRSEP@
HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
HAVE_UNISTD_H = @HAVE_UNISTD_H@
HAVE_UNSETENV = @HAVE_UNSETENV@
HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
HAVE_VASPRINTF = @HAVE_VASPRINTF@
HAVE_WCHAR_H = @HAVE_WCHAR_H@
HAVE_WCTYPE_H = @HAVE_WCTYPE_H@
HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@
HAVE_WINT_T = @HAVE_WINT_T@
HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@
HAVE__BOOL = @HAVE__BOOL@
HOSTNAME = @HOSTNAME@
INCLUDE_NEXT = @INCLUDE_NEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -218,6 +373,7 @@ LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
@ -231,6 +387,17 @@ MYSQLINCLUDE = @MYSQLINCLUDE@
MYSQLLIBS = @MYSQLLIBS@
NEED_SETGID = @NEED_SETGID@
NETINET_IN_H = @NETINET_IN_H@
NEXT_FLOAT_H = @NEXT_FLOAT_H@
NEXT_MATH_H = @NEXT_MATH_H@
NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@
NEXT_STDINT_H = @NEXT_STDINT_H@
NEXT_STDIO_H = @NEXT_STDIO_H@
NEXT_STDLIB_H = @NEXT_STDLIB_H@
NEXT_STRING_H = @NEXT_STRING_H@
NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@
NEXT_UNISTD_H = @NEXT_UNISTD_H@
NEXT_WCHAR_H = @NEXT_WCHAR_H@
NEXT_WCTYPE_H = @NEXT_WCTYPE_H@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@ -269,11 +436,56 @@ PKG_ARCH = @PKG_ARCH@
PLUGIN_TEST = @PLUGIN_TEST@
POSUB = @POSUB@
POW_LIB = @POW_LIB@
PST3CFLAGS = @PST3CFLAGS@
PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
PYTHON = @PYTHON@
RADIUSLIBS = @RADIUSLIBS@
RANLIB = @RANLIB@
RELEASE = @RELEASE@
REPLACE_CEILF = @REPLACE_CEILF@
REPLACE_CEILL = @REPLACE_CEILL@
REPLACE_CHOWN = @REPLACE_CHOWN@
REPLACE_FCHDIR = @REPLACE_FCHDIR@
REPLACE_FFLUSH = @REPLACE_FFLUSH@
REPLACE_FLOORF = @REPLACE_FLOORF@
REPLACE_FLOORL = @REPLACE_FLOORL@
REPLACE_FOPEN = @REPLACE_FOPEN@
REPLACE_FPRINTF = @REPLACE_FPRINTF@
REPLACE_FREOPEN = @REPLACE_FREOPEN@
REPLACE_FREXP = @REPLACE_FREXP@
REPLACE_FREXPL = @REPLACE_FREXPL@
REPLACE_FSEEK = @REPLACE_FSEEK@
REPLACE_FSEEKO = @REPLACE_FSEEKO@
REPLACE_FTELL = @REPLACE_FTELL@
REPLACE_FTELLO = @REPLACE_FTELLO@
REPLACE_GETCWD = @REPLACE_GETCWD@
REPLACE_GETLINE = @REPLACE_GETLINE@
REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
REPLACE_ISFINITE = @REPLACE_ISFINITE@
REPLACE_LCHOWN = @REPLACE_LCHOWN@
REPLACE_LDEXPL = @REPLACE_LDEXPL@
REPLACE_LSEEK = @REPLACE_LSEEK@
REPLACE_MEMMEM = @REPLACE_MEMMEM@
REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
REPLACE_PRINTF = @REPLACE_PRINTF@
REPLACE_PUTENV = @REPLACE_PUTENV@
REPLACE_ROUND = @REPLACE_ROUND@
REPLACE_ROUNDF = @REPLACE_ROUNDF@
REPLACE_ROUNDL = @REPLACE_ROUNDL@
REPLACE_SIGNBIT = @REPLACE_SIGNBIT@
REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@
REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
REPLACE_SPRINTF = @REPLACE_SPRINTF@
REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
REPLACE_STRERROR = @REPLACE_STRERROR@
REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
REPLACE_STRSTR = @REPLACE_STRSTR@
REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
REPLACE_VPRINTF = @REPLACE_VPRINTF@
REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
REV_DATESTAMP = @REV_DATESTAMP@
REV_TIMESTAMP = @REV_TIMESTAMP@
SCRIPT_TEST = @SCRIPT_TEST@
@ -290,9 +502,11 @@ STDINT_H = @STDINT_H@
STRIP = @STRIP@
SUPPORT = @SUPPORT@
SYS_SOCKET_H = @SYS_SOCKET_H@
UNISTD_H = @UNISTD_H@
USE_NLS = @USE_NLS@
USE_PARSE_INI_FALSE = @USE_PARSE_INI_FALSE@
USE_PARSE_INI_TRUE = @USE_PARSE_INI_TRUE@
VERSION = @VERSION@
VOID_UNSETENV = @VOID_UNSETENV@
WARRANTY = @WARRANTY@
WCHAR_H = @WCHAR_H@
WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
@ -300,6 +514,7 @@ WCTYPE_H = @WCTYPE_H@
WINT_T_SUFFIX = @WINT_T_SUFFIX@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
@ -326,6 +541,8 @@ dvidir = @dvidir@
exec_prefix = @exec_prefix@
gl_LIBOBJS = @gl_LIBOBJS@
gl_LTLIBOBJS = @gl_LTLIBOBJS@
gltests_LIBOBJS = @gltests_LIBOBJS@
gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@ -354,8 +571,9 @@ target_alias = @target_alias@
with_trusted_path = @with_trusted_path@
SUBDIRS = tests
noinst_LIBRARIES = libnagiosplug.a
libnagiosplug_a_SOURCES = utils_base.c utils_disk.c utils_tcp.c utils_cmd.c base64.c
EXTRA_DIST = utils_base.h utils_disk.h utils_tcp.h utils_cmd.h base64.h
libnagiosplug_a_SOURCES = utils_base.c utils_disk.c utils_tcp.c \
utils_cmd.c $(am__append_1)
EXTRA_DIST = utils_base.h utils_disk.h utils_tcp.h utils_cmd.h parse_ini.h extra_opts.h
INCLUDES = -I$(srcdir) -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins
all: all-recursive
@ -404,7 +622,8 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base64.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extra_opts.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse_ini.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils_base.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils_cmd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils_disk.Po@am__quote@

View file

@ -1,50 +0,0 @@
/****************************************************************************
* Function to encode in Base64
*
* Written by Lauri Alanko
*
*****************************************************************************/
#include "common.h"
#include "base64.h"
char *
base64 (const char *bin, size_t len)
{
char *buf = (char *) malloc ((len + 2) / 3 * 4 + 1);
size_t i = 0, j = 0;
char BASE64_END = '=';
char base64_table[64];
strncpy (base64_table, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", 64);
while (j < len - 2) {
buf[i++] = base64_table[bin[j] >> 2];
buf[i++] = base64_table[((bin[j] & 3) << 4) | (bin[j + 1] >> 4)];
buf[i++] = base64_table[((bin[j + 1] & 15) << 2) | (bin[j + 2] >> 6)];
buf[i++] = base64_table[bin[j + 2] & 63];
j += 3;
}
switch (len - j) {
case 1:
buf[i++] = base64_table[bin[j] >> 2];
buf[i++] = base64_table[(bin[j] & 3) << 4];
buf[i++] = BASE64_END;
buf[i++] = BASE64_END;
break;
case 2:
buf[i++] = base64_table[bin[j] >> 2];
buf[i++] = base64_table[((bin[j] & 3) << 4) | (bin[j + 1] >> 4)];
buf[i++] = base64_table[(bin[j + 1] & 15) << 2];
buf[i++] = BASE64_END;
break;
case 0:
break;
}
buf[i] = '\0';
return buf;
}

View file

@ -1,4 +0,0 @@
/* Header file for base64.c */
char *base64 (const char *bin, size_t len);

142
lib/extra_opts.c Normal file
View file

@ -0,0 +1,142 @@
/*****************************************************************************
*
* Nagios-plugins extra_opts library
*
* License: GPL
* Copyright (c) 2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-03-15 18:42:01 -0400 (Sat, 15 Mar 2008) $
*
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* $Id: parse_ini.c 1950 2008-03-15 22:42:01Z dermoth $
*
*****************************************************************************/
#include "common.h"
#include "utils_base.h"
#include "parse_ini.h"
#include "extra_opts.h"
/* FIXME: copied from utils.h; we should move a bunch of libs! */
int
is_option2 (char *str)
{
if (!str)
return FALSE;
else if (strspn (str, "-") == 1 || strspn (str, "-") == 2)
return TRUE;
else
return FALSE;
}
/* this is the externally visible function used by plugins */
char **np_extra_opts(int *argc, char **argv, const char *plugin_name){
np_arg_list *extra_args=NULL, *ea1=NULL, *ea_tmp=NULL;
char **argv_new=NULL;
char *argptr=NULL;
int i, j, optfound, argc_new, ea_num=*argc;
if(*argc<2) {
/* No arguments provided */
return argv;
}
for(i=1; i<*argc; i++){
argptr=NULL;
optfound=0;
/* Do we have an extra-opts parameter? */
if(strncmp(argv[i], "--extra-opts=", 13)==0){
/* It is a single argument with value */
argptr=argv[i]+13;
/* Delete the extra opts argument */
for(j=i;j<*argc;j++) argv[j]=argv[j+1];
i--;
*argc-=1;
}else if(strcmp(argv[i], "--extra-opts")==0){
if((i+1<*argc)&&!is_option2(argv[i+1])){
/* It is a argument with separate value */
argptr=argv[i+1];
/* Delete the extra-opts argument/value */
for(j=i;j<*argc-1;j++) argv[j]=argv[j+2];
i-=2;
*argc-=2;
ea_num--;
}else{
/* It has no value */
optfound=1;
/* Delete the extra opts argument */
for(j=i;j<*argc;j++) argv[j]=argv[j+1];
i--;
*argc-=1;
}
}
/* If we found extra-opts, expand them and store them for later*/
if(argptr||optfound){
/* Process ini section, returning a linked list of arguments */
ea1=np_get_defaults(argptr, plugin_name);
if(ea1==NULL) {
/* no extra args (empty section)? */
ea_num--;
continue;
}
/* append the list to extra_args */
if(extra_args==NULL){
extra_args=ea1;
while(ea1=ea1->next) ea_num++;
}else{
ea_tmp=extra_args;
while(ea_tmp->next) {
ea_tmp=ea_tmp->next;
ea_num++;
}
ea_tmp->next=ea1;
}
ea1=ea_tmp=NULL;
}
/* lather, rince, repeat */
}
if(ea_num==*argc && extra_args==NULL){
/* No extra-opts */
return argv;
}
/* done processing arguments. now create a new argv array... */
argv_new=(char**)malloc((ea_num+1)*sizeof(char**));
if(argv_new==NULL) die(STATE_UNKNOWN, _("malloc() failed!\n"));
/* starting with program name */
argv_new[0]=argv[0];
argc_new=1;
/* then parsed ini opts (frying them up in the same run) */
while(extra_args){
argv_new[argc_new++]=extra_args->arg;
ea1=extra_args;
extra_args=extra_args->next;
free(ea1);
}
/* finally the rest of the argv array */
for (i=1; i<*argc; i++) argv_new[argc_new++]=argv[i];
*argc=argc_new;
/* and terminate. */
argv_new[argc_new]=NULL;
return argv_new;
}

20
lib/extra_opts.h Normal file
View file

@ -0,0 +1,20 @@
#ifndef _EXTRA_OPTS_H_
#define _EXTRA_OPTS_H_
/*
* extra_opts.h: routines for loading nagios-plugin defaults from ini
* configuration files.
*/
/* np_extra_opts: Process the --extra-opts arguments and create a new argument
* array with ini-processed and argument-passed arguments together. The
* ini-procesed arguments always come first (in the ord of --extra-opts
* arguments). If no --extra-opts arguments are provided or returned nothing
* it returns **argv otherwise the new array is returned. --extra-opts are
* always removed from **argv. The original pointers from **argv are kept in
* the new array to preserve ability to overwrite arguments in processlist.
*/
char **np_extra_opts(int *argc, char **argv, const char *plugin_name);
#endif /* _EXTRA_OPTS_H_ */

368
lib/parse_ini.c Normal file
View file

@ -0,0 +1,368 @@
/*****************************************************************************
*
* Nagios-plugins parse_ini library
*
* License: GPL
* Copyright (c) 2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-04-04 11:11:22 +0100 (Fri, 04 Apr 2008) $
*
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* $Id: parse_ini.c 1976 2008-04-04 10:11:22Z dermoth $
*
*****************************************************************************/
#include "common.h"
#include "utils_base.h"
#include "parse_ini.h"
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
/* TODO: die like N::P if config file is not found */
/* np_ini_info contains the result of parsing a "locator" in the format
* [stanza_name][@config_filename] (check_foo@/etc/foo.ini, for example)
*/
typedef struct {
char *file;
char *stanza;
} np_ini_info;
/* eat all characters from a FILE pointer until n is encountered */
#define GOBBLE_TO(f, c, n) do { (c)=fgetc((f)); } while((c)!=EOF && (c)!=(n))
/* internal function that returns the constructed defaults options */
static int read_defaults(FILE *f, const char *stanza, np_arg_list **opts);
/* internal function that converts a single line into options format */
static int add_option(FILE *f, np_arg_list **optlst);
/* internal function to find default file */
static char* default_file(void);
/* internal function to stat() files */
static int test_file(const char* env, int len, const char* file, char* temp_file);
/* parse_locator decomposes a string of the form
* [stanza][@filename]
* into its seperate parts
*/
static void parse_locator(const char *locator, const char *def_stanza, np_ini_info *i){
size_t locator_len=0, stanza_len=0;
/* if locator is NULL we'll use default values */
if(locator){
locator_len=strlen(locator);
stanza_len=strcspn(locator, "@");
}
/* if a non-default stanza is provided */
if(stanza_len>0){
i->stanza=(char*)malloc(sizeof(char)*(stanza_len+1));
strncpy(i->stanza, locator, stanza_len);
i->stanza[stanza_len]='\0';
} else { /* otherwise we use the default stanza */
i->stanza=strdup(def_stanza);
}
/* if there is no @file part */
if(stanza_len==locator_len){
i->file=default_file();
} else {
i->file=strdup(&(locator[stanza_len+1]));
}
if(i->file==NULL || i->stanza==NULL){
die(STATE_UNKNOWN, _("malloc() failed!\n"));
}
}
/* this is the externally visible function used by extra_opts */
np_arg_list* np_get_defaults(const char *locator, const char *default_section){
FILE *inifile=NULL;
np_arg_list *defaults=NULL;
np_ini_info i;
parse_locator(locator, default_section, &i);
/* if a file was specified or if we're using the default file */
if(i.file != NULL && strlen(i.file) > 0){
if(strcmp(i.file, "-")==0){
inifile=stdin;
} else {
inifile=fopen(i.file, "r");
}
if(inifile==NULL) die(STATE_UNKNOWN, _("Can't read config file"));
if(read_defaults(inifile, i.stanza, &defaults)==FALSE)
die(STATE_UNKNOWN, _("Invalid section '%s' in config file '%s'\n"), i.stanza, i.file);
free(i.file);
if(inifile!=stdin) fclose(inifile);
}
free(i.stanza);
return defaults;
}
/* read_defaults is where the meat of the parsing takes place.
*
* note that this may be called by a setuid binary, so we need to
* be extra careful about user-supplied input (i.e. avoiding possible
* format string vulnerabilities, etc)
*/
static int read_defaults(FILE *f, const char *stanza, np_arg_list **opts){
int c, status=FALSE;
size_t i, stanza_len;
enum { NOSTANZA, WRONGSTANZA, RIGHTSTANZA } stanzastate=NOSTANZA;
stanza_len=strlen(stanza);
/* our little stanza-parsing state machine. */
while((c=fgetc(f))!=EOF){
/* gobble up leading whitespace */
if(isspace(c)) continue;
switch(c){
/* globble up coment lines */
case '#':
GOBBLE_TO(f, c, '\n');
break;
/* start of a stanza. check to see if it matches */
case '[':
stanzastate=WRONGSTANZA;
for(i=0; i<stanza_len; i++){
c=fgetc(f);
/* Strip leading whitespace */
if(i==0) for(c; isspace(c); c=fgetc(f));
/* nope, read to the end of the line */
if(c!=stanza[i]) {
GOBBLE_TO(f, c, '\n');
break;
}
}
/* if it matched up to here and the next char is ']'... */
if(i==stanza_len){
c=fgetc(f);
/* Strip trailing whitespace */
for(c; isspace(c); c=fgetc(f));
if(c==']') stanzastate=RIGHTSTANZA;
}
break;
/* otherwise, we're in the body of a stanza or a parse error */
default:
switch(stanzastate){
/* we never found the start of the first stanza, so
* we're dealing with a config error
*/
case NOSTANZA:
die(STATE_UNKNOWN, _("Config file error"));
break;
/* we're in a stanza, but for a different plugin */
case WRONGSTANZA:
GOBBLE_TO(f, c, '\n');
break;
/* okay, this is where we start taking the config */
case RIGHTSTANZA:
ungetc(c, f);
if(add_option(f, opts)){
die(STATE_UNKNOWN, _("Config file error"));
}
status=TRUE;
break;
}
break;
}
}
return status;
}
/*
* read one line of input in the format
* ^option[[:space:]]*(=[[:space:]]*value)?
* and creates it as a cmdline argument
* --option[=value]
* appending it to the linked list optbuf.
*/
static int add_option(FILE *f, np_arg_list **optlst){
np_arg_list *opttmp=*optlst, *optnew;
char *linebuf=NULL, *lineend=NULL, *optptr=NULL, *optend=NULL;
char *eqptr=NULL, *valptr=NULL, *spaceptr=NULL, *valend=NULL;
short done_reading=0, equals=0, value=0;
size_t cfg_len=0, read_sz=8, linebuf_sz=0, read_pos=0;
size_t opt_len=0, val_len=0;
/* read one line from the file */
while(!done_reading){
/* grow if necessary */
if(linebuf==NULL || read_pos+read_sz >= linebuf_sz){
linebuf_sz=(linebuf_sz>0)?linebuf_sz<<1:read_sz;
linebuf=realloc(linebuf, linebuf_sz);
if(linebuf==NULL) die(STATE_UNKNOWN, _("malloc() failed!\n"));
}
if(fgets(&linebuf[read_pos], read_sz, f)==NULL) done_reading=1;
else {
read_pos=strlen(linebuf);
if(linebuf[read_pos-1]=='\n') {
linebuf[--read_pos]='\0';
done_reading=1;
}
}
}
lineend=&linebuf[read_pos];
/* all that to read one line. isn't C fun? :) now comes the parsing :/ */
/* skip leading whitespace */
for(optptr=linebuf; optptr<lineend && isspace(*optptr); optptr++);
/* continue to '=' or EOL, watching for spaces that might precede it */
for(eqptr=optptr; eqptr<lineend && *eqptr!='='; eqptr++){
if(isspace(*eqptr) && optend==NULL) optend=eqptr;
else optend=NULL;
}
if(optend==NULL) optend=eqptr;
--optend;
/* ^[[:space:]]*=foo is a syntax error */
if(optptr==eqptr) die(STATE_UNKNOWN, _("Config file error\n"));
/* continue from '=' to start of value or EOL */
for(valptr=eqptr+1; valptr<lineend && isspace(*valptr); valptr++);
/* continue to the end of value (FIXME: watching for trailing comments) */
for(valend=valptr; valend<lineend; valend++)
/* FIXME: N::P doesn't allow comments here. Remove next line and parse_ini won't either */
if(*valend=='#') break;
--valend;
/* Finally trim off trailing spaces */
for(valend; isspace(*valend); valend--);
/* calculate the length of "--foo" */
opt_len=1+optend-optptr;
/* 1-character params needs only one dash */
if(opt_len==1)
cfg_len=1+(opt_len);
else
cfg_len=2+(opt_len);
/* if valptr<lineend then we have to also allocate space for "=bar" */
if(valptr<lineend) {
equals=value=1;
val_len=1+valend-valptr;
cfg_len+=1+val_len;
}
/* if valptr==valend then we have "=" but no "bar" */
else if(valptr==lineend) {
equals=1;
cfg_len+=1;
}
/* A line with no equal sign isn't valid */
if(equals==0) die(STATE_UNKNOWN, _("Config file error\n"));
/* okay, now we have all the info we need, so we create a new np_arg_list
* element and set the argument...
*/
optnew=(np_arg_list *)malloc(sizeof(np_arg_list));
optnew->next=NULL;
read_pos=0;
optnew->arg=(char *)malloc(cfg_len+1);
/* 1-character params needs only one dash */
if(opt_len==1) {
strncpy(&optnew->arg[read_pos], "-", 1);
read_pos+=1;
} else {
strncpy(&optnew->arg[read_pos], "--", 2);
read_pos+=2;
}
strncpy(&optnew->arg[read_pos], optptr, opt_len); read_pos+=opt_len;
if(value) {
optnew->arg[read_pos++]='=';
strncpy(&optnew->arg[read_pos], valptr, val_len); read_pos+=val_len;
}
optnew->arg[read_pos]='\0';
/* ...and put that to the end of the list */
if(*optlst==NULL) {
*optlst=optnew;
} else {
while(opttmp->next!=NULL) {
opttmp=opttmp->next;
}
opttmp->next = optnew;
}
free(linebuf);
return 0;
}
static char* default_file(void){
struct stat sb;
char *np_env=NULL, *default_file=NULL;
char temp_file[MAX_INPUT_BUFFER];
size_t len;
if((np_env=getenv("NAGIOS_CONFIG_PATH"))!=NULL) {
/* skip ant starting colon... */
while(*np_env==':') np_env++;
/* Look for NP_DEFAULT_INI_FILENAME1 and NP_DEFAULT_INI_FILENAME2 in
* every PATHs defined (colon-separated).
*/
while((len=strcspn(np_env,":"))>0){
/* Test NP_DEFAULT_INI_FILENAME[1-2] in current np_env token */
if(test_file(np_env,len,NP_DEFAULT_INI_FILENAME1,temp_file)==1 ||
test_file(np_env,len,NP_DEFAULT_INI_FILENAME2,temp_file)==1){
default_file=strdup(temp_file);
break;
}
/* Move on to the next token */
np_env+=len;
while(*np_env==':') np_env++;
} /* while(...) */
} /* if(getenv("NAGIOS_CONFIG_PATH")) */
/* Look for NP_DEFAULT_INI_FILENAME1 in NP_DEFAULT_INI_NAGIOS_PATH[1-4] */
if(!default_file){
if(test_file(NP_DEFAULT_INI_NAGIOS_PATH1,strlen(NP_DEFAULT_INI_NAGIOS_PATH1),NP_DEFAULT_INI_FILENAME1,temp_file)==1 ||
test_file(NP_DEFAULT_INI_NAGIOS_PATH2,strlen(NP_DEFAULT_INI_NAGIOS_PATH2),NP_DEFAULT_INI_FILENAME1,temp_file)==1 ||
test_file(NP_DEFAULT_INI_NAGIOS_PATH3,strlen(NP_DEFAULT_INI_NAGIOS_PATH3),NP_DEFAULT_INI_FILENAME1,temp_file)==1 ||
test_file(NP_DEFAULT_INI_NAGIOS_PATH4,strlen(NP_DEFAULT_INI_NAGIOS_PATH4),NP_DEFAULT_INI_FILENAME1,temp_file)==1)
default_file=strdup(temp_file);
}
/* Look for NP_DEFAULT_INI_FILENAME2 in NP_DEFAULT_INI_PATH[1-3] */
if(!default_file){
if(test_file(NP_DEFAULT_INI_PATH1,strlen(NP_DEFAULT_INI_PATH1),NP_DEFAULT_INI_FILENAME2,temp_file)==1 ||
test_file(NP_DEFAULT_INI_PATH2,strlen(NP_DEFAULT_INI_PATH2),NP_DEFAULT_INI_FILENAME2,temp_file)==1 ||
test_file(NP_DEFAULT_INI_PATH3,strlen(NP_DEFAULT_INI_PATH3),NP_DEFAULT_INI_FILENAME2,temp_file)==1)
default_file=strdup(temp_file);
}
/* Return default_file or empty string (should return NULL if we want to
* die there...
*/
if(default_file)
return default_file;
return "";
}
/* put together len bytes from env and the filename and test for its
* existence. Returns 1 if found, 0 if not and -1 if test wasn't performed.
*/
static int test_file(const char* env, int len, const char* file, char* temp_file){
struct stat sb;
/* test for len + filelen + '/' + '\0' */
if((len+strlen(file)+2)>MAX_INPUT_BUFFER) return -1;
strncpy(temp_file,env,len);
temp_file[len]='\0';
strncat(temp_file,"/",len+1);
strncat(temp_file,file,len+strlen(file)+1);
if(stat(temp_file, &sb) != -1) return 1;
return 0;
}

62
lib/parse_ini.h Normal file
View file

@ -0,0 +1,62 @@
#ifndef _PARSE_INI_H_
#define _PARSE_INI_H_
/*
* parse_ini.h: routines for loading nagios-plugin defaults from ini
* configuration files.
*/
/* np_arg_list is a linked list of arguments passed between the ini
* parser and the argument parser to construct the final array */
typedef struct np_arg_el {
char *arg;
struct np_arg_el *next;
} np_arg_list;
/* FIXME: This is in plugins/common.c. Should be eventually moved to lib/
* (although for this particular one a configure settings should be ideal)
*/
#ifndef MAX_INPUT_BUFFER
# define MAX_INPUT_BUFFER 8192
#endif /* MAX_INPUT_BUFFER */
/* Filenames (see below) */
#ifndef NP_DEFAULT_INI_FILENAME1
# define NP_DEFAULT_INI_FILENAME1 "plugins.ini"
#endif /* NP_DEFAULT_INI_FILENAME1 */
#ifndef NP_DEFAULT_INI_FILENAME2
# define NP_DEFAULT_INI_FILENAME2 "nagios-plugins.ini"
#endif /* NP_DEFAULT_INI_FILENAME2 */
/* Config paths ending in nagios (search for NP_DEFAULT_INI_FILENAME1) */
#ifndef NP_DEFAULT_INI_NAGIOS_PATH1
# define NP_DEFAULT_INI_NAGIOS_PATH1 "/etc/nagios"
#endif /* NP_DEFAULT_INI_NAGIOS_PATH1 */
#ifndef NP_DEFAULT_INI_NAGIOS_PATH2
# define NP_DEFAULT_INI_NAGIOS_PATH2 "/usr/local/nagios/etc"
#endif /* NP_DEFAULT_INI_NAGIOS_PATH2 */
#ifndef NP_DEFAULT_INI_NAGIOS_PATH3
# define NP_DEFAULT_INI_NAGIOS_PATH3 "/usr/local/etc/nagios"
#endif /* NP_DEFAULT_INI_NAGIOS_PATH3 */
#ifndef NP_DEFAULT_INI_NAGIOS_PATH4
# define NP_DEFAULT_INI_NAGIOS_PATH4 "/etc/opt/nagios"
#endif /* NP_DEFAULT_INI_NAGIOS_PATH4 */
/* Config paths not ending in nagios (search for NP_DEFAULT_INI_FILENAME2) */
#ifndef NP_DEFAULT_INI_PATH1
# define NP_DEFAULT_INI_PATH1 "/etc"
#endif /* NP_DEFAULT_INI_PATH1 */
#ifndef NP_DEFAULT_INI_PATH2
# define NP_DEFAULT_INI_PATH2 "/usr/local/etc"
#endif /* NP_DEFAULT_INI_PATH2 */
#ifndef NP_DEFAULT_INI_PATH3
# define NP_DEFAULT_INI_PATH3 "/etc/opt"
#endif /* NP_DEFAULT_INI_PATH3 */
/* np_load_defaults: load the default configuration (if present) for
* a plugin from the ini file
*/
np_arg_list* np_get_defaults(const char *locator, const char *default_section);
#endif /* _PARSE_INI_H_ */

View file

@ -7,9 +7,11 @@ check_PROGRAMS = @EXTRA_TEST@
INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins
EXTRA_PROGRAMS = test_utils test_disk test_tcp test_cmd test_base64
EXTRA_PROGRAMS = test_utils test_disk test_tcp test_cmd test_base64 test_ini test_opts
EXTRA_DIST = test_utils.t test_disk.t test_tcp.t test_cmd.t test_base64.t
np_test_scripts = test_base64.t test_cmd.t test_disk.t test_ini.t test_opts.t test_tcp.t test_utils.t
np_test_files = config-dos.ini config-opts.ini config-tiny.ini plugin.ini plugins.ini
EXTRA_DIST = $(np_test_scripts) $(np_test_files)
LIBS = @LIBINTL@
@ -36,7 +38,17 @@ test_cmd_LDADD = ../utils_cmd.o ../utils_base.o
test_base64_SOURCES = test_base64.c
test_base64_CFLAGS = -g -I..
test_base64_LDFLAGS = -L/usr/local/lib -ltap
test_base64_LDADD = ../base64.o
test_base64_LDADD = $(top_srcdir)/gl/base64.o
test_ini_SOURCES = test_ini.c
test_ini_CFLAGS = -g -I..
test_ini_LDFLAGS = -L/usr/local/lib -ltap
test_ini_LDADD = ../utils_base.o ../parse_ini.o
test_opts_SOURCES = test_opts.c
test_opts_CFLAGS = -g -I..
test_opts_LDFLAGS = -L/usr/local/lib -ltap
test_opts_LDADD = ../utils_base.o ../parse_ini.o ../extra_opts.o
test: ${noinst_PROGRAMS}
perl -MTest::Harness -e '$$Test::Harness::switches=""; runtests(map {$$_ .= ".t"} @ARGV)' $(EXTRA_PROGRAMS)

View file

@ -38,41 +38,46 @@ host_triplet = @host@
noinst_PROGRAMS = @EXTRA_TEST@
check_PROGRAMS = @EXTRA_TEST@
EXTRA_PROGRAMS = test_utils$(EXEEXT) test_disk$(EXEEXT) \
test_tcp$(EXEEXT) test_cmd$(EXEEXT) test_base64$(EXEEXT)
test_tcp$(EXEEXT) test_cmd$(EXEEXT) test_base64$(EXEEXT) \
test_ini$(EXEEXT) test_opts$(EXEEXT)
subdir = lib/tests
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/np_mysqlclient.m4 \
$(top_srcdir)/gl/m4/absolute-header.m4 \
$(top_srcdir)/gl/m4/alloca.m4 \
$(top_srcdir)/gl/m4/arpa_inet_h.m4 \
$(top_srcdir)/gl/m4/c-strtod.m4 $(top_srcdir)/gl/m4/cloexec.m4 \
$(top_srcdir)/gl/m4/codeset.m4 $(top_srcdir)/gl/m4/dirname.m4 \
$(top_srcdir)/gl/m4/dos.m4 \
$(top_srcdir)/gl/m4/base64.m4 $(top_srcdir)/gl/m4/c-strtod.m4 \
$(top_srcdir)/gl/m4/cloexec.m4 $(top_srcdir)/gl/m4/codeset.m4 \
$(top_srcdir)/gl/m4/dirname.m4 $(top_srcdir)/gl/m4/dos.m4 \
$(top_srcdir)/gl/m4/double-slash-root.m4 \
$(top_srcdir)/gl/m4/eoverflow.m4 $(top_srcdir)/gl/m4/error.m4 \
$(top_srcdir)/gl/m4/exitfail.m4 \
$(top_srcdir)/gl/m4/extensions.m4 \
$(top_srcdir)/gl/m4/fcntl-safer.m4 \
$(top_srcdir)/gl/m4/float_h.m4 $(top_srcdir)/gl/m4/floorf.m4 \
$(top_srcdir)/gl/m4/fstypename.m4 \
$(top_srcdir)/gl/m4/fsusage.m4 \
$(top_srcdir)/gl/m4/getaddrinfo.m4 \
$(top_srcdir)/gl/m4/gethostname.m4 \
$(top_srcdir)/gl/m4/getloadavg.m4 \
$(top_srcdir)/gl/m4/getopt.m4 $(top_srcdir)/gl/m4/gettext.m4 \
$(top_srcdir)/gl/m4/glibc21.m4 \
$(top_srcdir)/gl/m4/gnulib-common.m4 \
$(top_srcdir)/gl/m4/gnulib-comp.m4 \
$(top_srcdir)/gl/m4/iconv.m4 $(top_srcdir)/gl/m4/inet_ntop.m4 \
$(top_srcdir)/gl/m4/inline.m4 $(top_srcdir)/gl/m4/intmax_t.m4 \
$(top_srcdir)/gl/m4/iconv.m4 \
$(top_srcdir)/gl/m4/include_next.m4 \
$(top_srcdir)/gl/m4/inet_ntop.m4 $(top_srcdir)/gl/m4/inline.m4 \
$(top_srcdir)/gl/m4/intlmacosx.m4 \
$(top_srcdir)/gl/m4/intmax_t.m4 \
$(top_srcdir)/gl/m4/inttypes_h.m4 \
$(top_srcdir)/gl/m4/lib-ld.m4 $(top_srcdir)/gl/m4/lib-link.m4 \
$(top_srcdir)/gl/m4/lib-prefix.m4 $(top_srcdir)/gl/m4/lock.m4 \
$(top_srcdir)/gl/m4/longdouble.m4 \
$(top_srcdir)/gl/m4/lib-prefix.m4 \
$(top_srcdir)/gl/m4/localcharset.m4 \
$(top_srcdir)/gl/m4/longlong.m4 \
$(top_srcdir)/gl/m4/ls-mntd-fs.m4 \
$(top_srcdir)/gl/m4/mbchar.m4 $(top_srcdir)/gl/m4/mbiter.m4 \
$(top_srcdir)/gl/m4/mbrtowc.m4 $(top_srcdir)/gl/m4/memchr.m4 \
$(top_srcdir)/gl/m4/minmax.m4 $(top_srcdir)/gl/m4/mountlist.m4 \
$(top_srcdir)/gl/m4/malloc.m4 $(top_srcdir)/gl/m4/math_h.m4 \
$(top_srcdir)/gl/m4/mbstate_t.m4 \
$(top_srcdir)/gl/m4/mountlist.m4 \
$(top_srcdir)/gl/m4/netinet_in_h.m4 $(top_srcdir)/gl/m4/nls.m4 \
$(top_srcdir)/gl/m4/onceonly_2_57.m4 $(top_srcdir)/gl/m4/po.m4 \
$(top_srcdir)/gl/m4/progtest.m4 $(top_srcdir)/gl/m4/regex.m4 \
@ -82,21 +87,21 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/np_mysqlclient.m4 \
$(top_srcdir)/gl/m4/snprintf.m4 $(top_srcdir)/gl/m4/socklen.m4 \
$(top_srcdir)/gl/m4/sockpfaf.m4 $(top_srcdir)/gl/m4/ssize_t.m4 \
$(top_srcdir)/gl/m4/stdbool.m4 $(top_srcdir)/gl/m4/stdint.m4 \
$(top_srcdir)/gl/m4/stdint_h.m4 $(top_srcdir)/gl/m4/strcase.m4 \
$(top_srcdir)/gl/m4/strdup.m4 $(top_srcdir)/gl/m4/strndup.m4 \
$(top_srcdir)/gl/m4/stdint_h.m4 $(top_srcdir)/gl/m4/stdio_h.m4 \
$(top_srcdir)/gl/m4/stdlib_h.m4 $(top_srcdir)/gl/m4/strdup.m4 \
$(top_srcdir)/gl/m4/strerror.m4 \
$(top_srcdir)/gl/m4/string_h.m4 $(top_srcdir)/gl/m4/strndup.m4 \
$(top_srcdir)/gl/m4/strnlen.m4 \
$(top_srcdir)/gl/m4/sys_socket_h.m4 \
$(top_srcdir)/gl/m4/ulonglong.m4 \
$(top_srcdir)/gl/m4/unistd-safer.m4 \
$(top_srcdir)/gl/m4/unistd_h.m4 \
$(top_srcdir)/gl/m4/vasnprintf.m4 \
$(top_srcdir)/gl/m4/vasprintf.m4 \
$(top_srcdir)/gl/m4/vsnprintf.m4 $(top_srcdir)/gl/m4/wchar.m4 \
$(top_srcdir)/gl/m4/wchar_t.m4 $(top_srcdir)/gl/m4/wctype.m4 \
$(top_srcdir)/gl/m4/wcwidth.m4 $(top_srcdir)/gl/m4/wint_t.m4 \
$(top_srcdir)/gl/m4/xalloc.m4 $(top_srcdir)/gl/m4/xsize.m4 \
$(top_srcdir)/gl/m4/xstrndup.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.in
$(top_srcdir)/gl/m4/wint_t.m4 $(top_srcdir)/gl/m4/xalloc.m4 \
$(top_srcdir)/gl/m4/xsize.m4 $(top_srcdir)/gl/m4/xstrndup.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs
@ -105,13 +110,20 @@ CONFIG_CLEAN_FILES =
PROGRAMS = $(noinst_PROGRAMS)
am_test_base64_OBJECTS = test_base64-test_base64.$(OBJEXT)
test_base64_OBJECTS = $(am_test_base64_OBJECTS)
test_base64_DEPENDENCIES = ../base64.o
test_base64_DEPENDENCIES = $(top_srcdir)/gl/base64.o
am_test_cmd_OBJECTS = test_cmd-test_cmd.$(OBJEXT)
test_cmd_OBJECTS = $(am_test_cmd_OBJECTS)
test_cmd_DEPENDENCIES = ../utils_cmd.o ../utils_base.o
am_test_disk_OBJECTS = test_disk-test_disk.$(OBJEXT)
test_disk_OBJECTS = $(am_test_disk_OBJECTS)
test_disk_DEPENDENCIES = ../utils_disk.o $(top_srcdir)/gl/libgnu.a
am_test_ini_OBJECTS = test_ini-test_ini.$(OBJEXT)
test_ini_OBJECTS = $(am_test_ini_OBJECTS)
test_ini_DEPENDENCIES = ../utils_base.o ../parse_ini.o
am_test_opts_OBJECTS = test_opts-test_opts.$(OBJEXT)
test_opts_OBJECTS = $(am_test_opts_OBJECTS)
test_opts_DEPENDENCIES = ../utils_base.o ../parse_ini.o \
../extra_opts.o
am_test_tcp_OBJECTS = test_tcp-test_tcp.$(OBJEXT)
test_tcp_OBJECTS = $(am_test_tcp_OBJECTS)
test_tcp_DEPENDENCIES = ../utils_tcp.o
@ -130,17 +142,15 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(test_base64_SOURCES) $(test_cmd_SOURCES) \
$(test_disk_SOURCES) $(test_tcp_SOURCES) $(test_utils_SOURCES)
$(test_disk_SOURCES) $(test_ini_SOURCES) $(test_opts_SOURCES) \
$(test_tcp_SOURCES) $(test_utils_SOURCES)
DIST_SOURCES = $(test_base64_SOURCES) $(test_cmd_SOURCES) \
$(test_disk_SOURCES) $(test_tcp_SOURCES) $(test_utils_SOURCES)
$(test_disk_SOURCES) $(test_ini_SOURCES) $(test_opts_SOURCES) \
$(test_tcp_SOURCES) $(test_utils_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
INSTALL = @INSTALL@
ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@
ABSOLUTE_UNISTD_H = @ABSOLUTE_UNISTD_H@
ABSOLUTE_WCHAR_H = @ABSOLUTE_WCHAR_H@
ABSOLUTE_WCTYPE_H = @ABSOLUTE_WCTYPE_H@
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
ALLOCA_H = @ALLOCA_H@
@ -185,27 +195,177 @@ EXTRA_NETOBJS = @EXTRA_NETOBJS@
EXTRA_TEST = @EXTRA_TEST@
F77 = @F77@
FFLAGS = @FFLAGS@
FLOAT_H = @FLOAT_H@
FLOORF_LIBM = @FLOORF_LIBM@
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
GETOPT_H = @GETOPT_H@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GLIBC21 = @GLIBC21@
GL_COND_LIBTOOL_FALSE = @GL_COND_LIBTOOL_FALSE@
GL_COND_LIBTOOL_TRUE = @GL_COND_LIBTOOL_TRUE@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
GNULIB_CEILF = @GNULIB_CEILF@
GNULIB_CEILL = @GNULIB_CEILL@
GNULIB_CHOWN = @GNULIB_CHOWN@
GNULIB_DUP2 = @GNULIB_DUP2@
GNULIB_FCHDIR = @GNULIB_FCHDIR@
GNULIB_FFLUSH = @GNULIB_FFLUSH@
GNULIB_FLOORF = @GNULIB_FLOORF@
GNULIB_FLOORL = @GNULIB_FLOORL@
GNULIB_FOPEN = @GNULIB_FOPEN@
GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
GNULIB_FREOPEN = @GNULIB_FREOPEN@
GNULIB_FREXP = @GNULIB_FREXP@
GNULIB_FREXPL = @GNULIB_FREXPL@
GNULIB_FSEEK = @GNULIB_FSEEK@
GNULIB_FSEEKO = @GNULIB_FSEEKO@
GNULIB_FTELL = @GNULIB_FTELL@
GNULIB_FTELLO = @GNULIB_FTELLO@
GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@
GNULIB_GETCWD = @GNULIB_GETCWD@
GNULIB_GETDELIM = @GNULIB_GETDELIM@
GNULIB_GETLINE = @GNULIB_GETLINE@
GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
GNULIB_ISFINITE = @GNULIB_ISFINITE@
GNULIB_LCHOWN = @GNULIB_LCHOWN@
GNULIB_LDEXPL = @GNULIB_LDEXPL@
GNULIB_LSEEK = @GNULIB_LSEEK@
GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@
GNULIB_MATHL = @GNULIB_MATHL@
GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@
GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@
GNULIB_MBSCHR = @GNULIB_MBSCHR@
GNULIB_MBSCSPN = @GNULIB_MBSCSPN@
GNULIB_MBSLEN = @GNULIB_MBSLEN@
GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@
GNULIB_MBSNLEN = @GNULIB_MBSNLEN@
GNULIB_MBSPBRK = @GNULIB_MBSPBRK@
GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@
GNULIB_MBSRCHR = @GNULIB_MBSRCHR@
GNULIB_MBSSEP = @GNULIB_MBSSEP@
GNULIB_MBSSPN = @GNULIB_MBSSPN@
GNULIB_MBSSTR = @GNULIB_MBSSTR@
GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@
GNULIB_MEMMEM = @GNULIB_MEMMEM@
GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
GNULIB_PUTENV = @GNULIB_PUTENV@
GNULIB_READLINK = @GNULIB_READLINK@
GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
GNULIB_ROUND = @GNULIB_ROUND@
GNULIB_ROUNDF = @GNULIB_ROUNDF@
GNULIB_ROUNDL = @GNULIB_ROUNDL@
GNULIB_SETENV = @GNULIB_SETENV@
GNULIB_SIGNBIT = @GNULIB_SIGNBIT@
GNULIB_SLEEP = @GNULIB_SLEEP@
GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
GNULIB_STPCPY = @GNULIB_STPCPY@
GNULIB_STPNCPY = @GNULIB_STPNCPY@
GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
GNULIB_STRDUP = @GNULIB_STRDUP@
GNULIB_STRERROR = @GNULIB_STRERROR@
GNULIB_STRNDUP = @GNULIB_STRNDUP@
GNULIB_STRNLEN = @GNULIB_STRNLEN@
GNULIB_STRPBRK = @GNULIB_STRPBRK@
GNULIB_STRSEP = @GNULIB_STRSEP@
GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
GNULIB_STRSTR = @GNULIB_STRSTR@
GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
GNULIB_TRUNC = @GNULIB_TRUNC@
GNULIB_TRUNCF = @GNULIB_TRUNCF@
GNULIB_TRUNCL = @GNULIB_TRUNCL@
GNULIB_UNSETENV = @GNULIB_UNSETENV@
GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@
GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@
GNULIB_WCWIDTH = @GNULIB_WCWIDTH@
GREP = @GREP@
HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@
HAVE_DECL_ASINL = @HAVE_DECL_ASINL@
HAVE_DECL_ATANL = @HAVE_DECL_ATANL@
HAVE_DECL_COSL = @HAVE_DECL_COSL@
HAVE_DECL_EXPL = @HAVE_DECL_EXPL@
HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@
HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@
HAVE_DECL_LOGL = @HAVE_DECL_LOGL@
HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
HAVE_DECL_SINL = @HAVE_DECL_SINL@
HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@
HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
HAVE_DECL_TANL = @HAVE_DECL_TANL@
HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@
HAVE_DECL_TRUNCF = @HAVE_DECL_TRUNCF@
HAVE_DECL_TRUNCL = @HAVE_DECL_TRUNCL@
HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
HAVE_DUP2 = @HAVE_DUP2@
HAVE_FSEEKO = @HAVE_FSEEKO@
HAVE_FTELLO = @HAVE_FTELLO@
HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
HAVE_ISWCNTRL = @HAVE_ISWCNTRL@
HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
HAVE_MEMPCPY = @HAVE_MEMPCPY@
HAVE_MKDTEMP = @HAVE_MKDTEMP@
HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
HAVE_OS_H = @HAVE_OS_H@
HAVE_READLINK = @HAVE_READLINK@
HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
HAVE_SETENV = @HAVE_SETENV@
HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
HAVE_SLEEP = @HAVE_SLEEP@
HAVE_STDINT_H = @HAVE_STDINT_H@
HAVE_STPCPY = @HAVE_STPCPY@
HAVE_STPNCPY = @HAVE_STPNCPY@
HAVE_STRCASESTR = @HAVE_STRCASESTR@
HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
HAVE_STRNDUP = @HAVE_STRNDUP@
HAVE_STRPBRK = @HAVE_STRPBRK@
HAVE_STRSEP = @HAVE_STRSEP@
HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
HAVE_UNISTD_H = @HAVE_UNISTD_H@
HAVE_UNSETENV = @HAVE_UNSETENV@
HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
HAVE_VASPRINTF = @HAVE_VASPRINTF@
HAVE_WCHAR_H = @HAVE_WCHAR_H@
HAVE_WCTYPE_H = @HAVE_WCTYPE_H@
HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@
HAVE_WINT_T = @HAVE_WINT_T@
HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@
HAVE__BOOL = @HAVE__BOOL@
HOSTNAME = @HOSTNAME@
INCLUDE_NEXT = @INCLUDE_NEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -226,6 +386,7 @@ LIBOBJS = @LIBOBJS@
LIBS = @LIBINTL@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
@ -239,6 +400,17 @@ MYSQLINCLUDE = @MYSQLINCLUDE@
MYSQLLIBS = @MYSQLLIBS@
NEED_SETGID = @NEED_SETGID@
NETINET_IN_H = @NETINET_IN_H@
NEXT_FLOAT_H = @NEXT_FLOAT_H@
NEXT_MATH_H = @NEXT_MATH_H@
NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@
NEXT_STDINT_H = @NEXT_STDINT_H@
NEXT_STDIO_H = @NEXT_STDIO_H@
NEXT_STDLIB_H = @NEXT_STDLIB_H@
NEXT_STRING_H = @NEXT_STRING_H@
NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@
NEXT_UNISTD_H = @NEXT_UNISTD_H@
NEXT_WCHAR_H = @NEXT_WCHAR_H@
NEXT_WCTYPE_H = @NEXT_WCTYPE_H@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@ -277,11 +449,56 @@ PKG_ARCH = @PKG_ARCH@
PLUGIN_TEST = @PLUGIN_TEST@
POSUB = @POSUB@
POW_LIB = @POW_LIB@
PST3CFLAGS = @PST3CFLAGS@
PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
PYTHON = @PYTHON@
RADIUSLIBS = @RADIUSLIBS@
RANLIB = @RANLIB@
RELEASE = @RELEASE@
REPLACE_CEILF = @REPLACE_CEILF@
REPLACE_CEILL = @REPLACE_CEILL@
REPLACE_CHOWN = @REPLACE_CHOWN@
REPLACE_FCHDIR = @REPLACE_FCHDIR@
REPLACE_FFLUSH = @REPLACE_FFLUSH@
REPLACE_FLOORF = @REPLACE_FLOORF@
REPLACE_FLOORL = @REPLACE_FLOORL@
REPLACE_FOPEN = @REPLACE_FOPEN@
REPLACE_FPRINTF = @REPLACE_FPRINTF@
REPLACE_FREOPEN = @REPLACE_FREOPEN@
REPLACE_FREXP = @REPLACE_FREXP@
REPLACE_FREXPL = @REPLACE_FREXPL@
REPLACE_FSEEK = @REPLACE_FSEEK@
REPLACE_FSEEKO = @REPLACE_FSEEKO@
REPLACE_FTELL = @REPLACE_FTELL@
REPLACE_FTELLO = @REPLACE_FTELLO@
REPLACE_GETCWD = @REPLACE_GETCWD@
REPLACE_GETLINE = @REPLACE_GETLINE@
REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
REPLACE_ISFINITE = @REPLACE_ISFINITE@
REPLACE_LCHOWN = @REPLACE_LCHOWN@
REPLACE_LDEXPL = @REPLACE_LDEXPL@
REPLACE_LSEEK = @REPLACE_LSEEK@
REPLACE_MEMMEM = @REPLACE_MEMMEM@
REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
REPLACE_PRINTF = @REPLACE_PRINTF@
REPLACE_PUTENV = @REPLACE_PUTENV@
REPLACE_ROUND = @REPLACE_ROUND@
REPLACE_ROUNDF = @REPLACE_ROUNDF@
REPLACE_ROUNDL = @REPLACE_ROUNDL@
REPLACE_SIGNBIT = @REPLACE_SIGNBIT@
REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@
REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
REPLACE_SPRINTF = @REPLACE_SPRINTF@
REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
REPLACE_STRERROR = @REPLACE_STRERROR@
REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
REPLACE_STRSTR = @REPLACE_STRSTR@
REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
REPLACE_VPRINTF = @REPLACE_VPRINTF@
REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
REV_DATESTAMP = @REV_DATESTAMP@
REV_TIMESTAMP = @REV_TIMESTAMP@
SCRIPT_TEST = @SCRIPT_TEST@
@ -298,9 +515,11 @@ STDINT_H = @STDINT_H@
STRIP = @STRIP@
SUPPORT = @SUPPORT@
SYS_SOCKET_H = @SYS_SOCKET_H@
UNISTD_H = @UNISTD_H@
USE_NLS = @USE_NLS@
USE_PARSE_INI_FALSE = @USE_PARSE_INI_FALSE@
USE_PARSE_INI_TRUE = @USE_PARSE_INI_TRUE@
VERSION = @VERSION@
VOID_UNSETENV = @VOID_UNSETENV@
WARRANTY = @WARRANTY@
WCHAR_H = @WCHAR_H@
WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
@ -308,6 +527,7 @@ WCTYPE_H = @WCTYPE_H@
WINT_T_SUFFIX = @WINT_T_SUFFIX@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
@ -334,6 +554,8 @@ dvidir = @dvidir@
exec_prefix = @exec_prefix@
gl_LIBOBJS = @gl_LIBOBJS@
gl_LTLIBOBJS = @gl_LTLIBOBJS@
gltests_LIBOBJS = @gltests_LIBOBJS@
gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@ -364,7 +586,9 @@ with_trusted_path = @with_trusted_path@
# These two lines support "make check", but we use "make test"
TESTS = @EXTRA_TEST@
INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins
EXTRA_DIST = test_utils.t test_disk.t test_tcp.t test_cmd.t test_base64.t
np_test_scripts = test_base64.t test_cmd.t test_disk.t test_ini.t test_opts.t test_tcp.t test_utils.t
np_test_files = config-dos.ini config-opts.ini config-tiny.ini plugin.ini plugins.ini
EXTRA_DIST = $(np_test_scripts) $(np_test_files)
test_utils_SOURCES = test_utils.c
test_utils_CFLAGS = -g -I..
test_utils_LDFLAGS = -L/usr/local/lib -ltap
@ -384,7 +608,15 @@ test_cmd_LDADD = ../utils_cmd.o ../utils_base.o
test_base64_SOURCES = test_base64.c
test_base64_CFLAGS = -g -I..
test_base64_LDFLAGS = -L/usr/local/lib -ltap
test_base64_LDADD = ../base64.o
test_base64_LDADD = $(top_srcdir)/gl/base64.o
test_ini_SOURCES = test_ini.c
test_ini_CFLAGS = -g -I..
test_ini_LDFLAGS = -L/usr/local/lib -ltap
test_ini_LDADD = ../utils_base.o ../parse_ini.o
test_opts_SOURCES = test_opts.c
test_opts_CFLAGS = -g -I..
test_opts_LDFLAGS = -L/usr/local/lib -ltap
test_opts_LDADD = ../utils_base.o ../parse_ini.o ../extra_opts.o
all: all-am
.SUFFIXES:
@ -441,6 +673,12 @@ test_cmd$(EXEEXT): $(test_cmd_OBJECTS) $(test_cmd_DEPENDENCIES)
test_disk$(EXEEXT): $(test_disk_OBJECTS) $(test_disk_DEPENDENCIES)
@rm -f test_disk$(EXEEXT)
$(LINK) $(test_disk_LDFLAGS) $(test_disk_OBJECTS) $(test_disk_LDADD) $(LIBS)
test_ini$(EXEEXT): $(test_ini_OBJECTS) $(test_ini_DEPENDENCIES)
@rm -f test_ini$(EXEEXT)
$(LINK) $(test_ini_LDFLAGS) $(test_ini_OBJECTS) $(test_ini_LDADD) $(LIBS)
test_opts$(EXEEXT): $(test_opts_OBJECTS) $(test_opts_DEPENDENCIES)
@rm -f test_opts$(EXEEXT)
$(LINK) $(test_opts_LDFLAGS) $(test_opts_OBJECTS) $(test_opts_LDADD) $(LIBS)
test_tcp$(EXEEXT): $(test_tcp_OBJECTS) $(test_tcp_DEPENDENCIES)
@rm -f test_tcp$(EXEEXT)
$(LINK) $(test_tcp_LDFLAGS) $(test_tcp_OBJECTS) $(test_tcp_LDADD) $(LIBS)
@ -457,6 +695,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_base64-test_base64.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_cmd-test_cmd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_disk-test_disk.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_ini-test_ini.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_opts-test_opts.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_tcp-test_tcp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_utils-test_utils.Po@am__quote@
@ -523,6 +763,34 @@ test_disk-test_disk.obj: test_disk.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_disk_CFLAGS) $(CFLAGS) -c -o test_disk-test_disk.obj `if test -f 'test_disk.c'; then $(CYGPATH_W) 'test_disk.c'; else $(CYGPATH_W) '$(srcdir)/test_disk.c'; fi`
test_ini-test_ini.o: test_ini.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_ini_CFLAGS) $(CFLAGS) -MT test_ini-test_ini.o -MD -MP -MF "$(DEPDIR)/test_ini-test_ini.Tpo" -c -o test_ini-test_ini.o `test -f 'test_ini.c' || echo '$(srcdir)/'`test_ini.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_ini-test_ini.Tpo" "$(DEPDIR)/test_ini-test_ini.Po"; else rm -f "$(DEPDIR)/test_ini-test_ini.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_ini.c' object='test_ini-test_ini.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_ini_CFLAGS) $(CFLAGS) -c -o test_ini-test_ini.o `test -f 'test_ini.c' || echo '$(srcdir)/'`test_ini.c
test_ini-test_ini.obj: test_ini.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_ini_CFLAGS) $(CFLAGS) -MT test_ini-test_ini.obj -MD -MP -MF "$(DEPDIR)/test_ini-test_ini.Tpo" -c -o test_ini-test_ini.obj `if test -f 'test_ini.c'; then $(CYGPATH_W) 'test_ini.c'; else $(CYGPATH_W) '$(srcdir)/test_ini.c'; fi`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_ini-test_ini.Tpo" "$(DEPDIR)/test_ini-test_ini.Po"; else rm -f "$(DEPDIR)/test_ini-test_ini.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_ini.c' object='test_ini-test_ini.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_ini_CFLAGS) $(CFLAGS) -c -o test_ini-test_ini.obj `if test -f 'test_ini.c'; then $(CYGPATH_W) 'test_ini.c'; else $(CYGPATH_W) '$(srcdir)/test_ini.c'; fi`
test_opts-test_opts.o: test_opts.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_opts_CFLAGS) $(CFLAGS) -MT test_opts-test_opts.o -MD -MP -MF "$(DEPDIR)/test_opts-test_opts.Tpo" -c -o test_opts-test_opts.o `test -f 'test_opts.c' || echo '$(srcdir)/'`test_opts.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_opts-test_opts.Tpo" "$(DEPDIR)/test_opts-test_opts.Po"; else rm -f "$(DEPDIR)/test_opts-test_opts.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_opts.c' object='test_opts-test_opts.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_opts_CFLAGS) $(CFLAGS) -c -o test_opts-test_opts.o `test -f 'test_opts.c' || echo '$(srcdir)/'`test_opts.c
test_opts-test_opts.obj: test_opts.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_opts_CFLAGS) $(CFLAGS) -MT test_opts-test_opts.obj -MD -MP -MF "$(DEPDIR)/test_opts-test_opts.Tpo" -c -o test_opts-test_opts.obj `if test -f 'test_opts.c'; then $(CYGPATH_W) 'test_opts.c'; else $(CYGPATH_W) '$(srcdir)/test_opts.c'; fi`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_opts-test_opts.Tpo" "$(DEPDIR)/test_opts-test_opts.Po"; else rm -f "$(DEPDIR)/test_opts-test_opts.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_opts.c' object='test_opts-test_opts.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_opts_CFLAGS) $(CFLAGS) -c -o test_opts-test_opts.obj `if test -f 'test_opts.c'; then $(CYGPATH_W) 'test_opts.c'; else $(CYGPATH_W) '$(srcdir)/test_opts.c'; fi`
test_tcp-test_tcp.o: test_tcp.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_tcp_CFLAGS) $(CFLAGS) -MT test_tcp-test_tcp.o -MD -MP -MF "$(DEPDIR)/test_tcp-test_tcp.Tpo" -c -o test_tcp-test_tcp.o `test -f 'test_tcp.c' || echo '$(srcdir)/'`test_tcp.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_tcp-test_tcp.Tpo" "$(DEPDIR)/test_tcp-test_tcp.Po"; else rm -f "$(DEPDIR)/test_tcp-test_tcp.Tpo"; exit 1; fi

24
lib/tests/config-dos.ini Normal file
View file

@ -0,0 +1,24 @@
# This config file is amended from perl's Config::Tiny's testcases
# Line below is allowed in perl's Config::Tiny, but not in our parse_ini.c
#root=something
[section]
one=two
Foo=Bar
this=Your Mother!
blank=
[Section Two]
something else=blah
remove = whitespace
[ /path/to/file.txt ]
this=that
[ section2]
this=that
[section3 ]
this=that

14
lib/tests/config-opts.ini Normal file
View file

@ -0,0 +1,14 @@
# This config file is for testing test_opts
[sect1]
one=two
[check_disk]
foo=Bar
this=Your Mother!
blank=
[sect2]
something else=oops
this=that

24
lib/tests/config-tiny.ini Normal file
View file

@ -0,0 +1,24 @@
# This config file is amended from perl's Config::Tiny's testcases
# Line below is allowed in perl's Config::Tiny, but not in our parse_ini.c
#root=something
[section]
one=two
Foo=Bar
this=Your Mother!
blank=
[Section Two]
something else=blah
remove = whitespace
[ /path/to/file.txt ]
this=that
[ section2]
this=that
[section3 ]
this=that

21
lib/tests/plugin.ini Normal file
View file

@ -0,0 +1,21 @@
[check_mysql]
username=operator
password=secret # Remember to change later
[section_twice]
foo=bar
[check_mysql2]
u=admin
p=secret
[section_twice]
bar=foo
[check space_and_flags]
foo=bar
a=
b=
bar=

7
lib/tests/plugins.ini Normal file
View file

@ -0,0 +1,7 @@
[check_disk]
foo=bar
[section1]
foobar=baz

View file

@ -1,25 +1,24 @@
/******************************************************************************
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: test_base64.c 1819 2007-11-09 23:24:45Z dermoth $
******************************************************************************/
/*****************************************************************************
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* $Id: test_base64.c 1927 2008-02-13 04:07:39Z dermoth $
*
*****************************************************************************/
#include "common.h"
#include "base64.h"
#include "gl/base64.h"
#include "tap.h"
int
@ -249,7 +248,7 @@ main (int argc, char **argv)
0x2b,0x00,0x1f,0x0c,0x28,0x59,0x0a,0x16,0x49,0x5a,0x5c,0x64,0x65,0x4b,0x11,0x29,
0x15,0x36,0x5a,0x65,0x19,0x4f,0x60,0x23,0x3a,0x3a,0x13,0x25,0x02,0x78,0x4c,0x54
};
char b64_known[1368] = {
char b64_known[1369] = {
0x43,0x7a,0x42,0x45,0x59,0x6e,0x77,0x69,0x48,0x77,0x30,0x46,0x5a,0x79,0x77,0x71,
0x4f,0x53,0x46,0x47,0x43,0x46,0x42,0x6d,0x4e,0x44,0x63,0x4c,0x52,0x55,0x73,0x34,
0x4d,0x67,0x5a,0x36,0x50,0x6e,0x38,0x4d,0x51,0x42,0x68,0x72,0x4c,0x57,0x42,0x4d,
@ -335,13 +334,13 @@ main (int argc, char **argv)
0x48,0x33,0x41,0x41,0x4c,0x6d,0x59,0x55,0x50,0x48,0x38,0x72,0x41,0x42,0x38,0x4d,
0x4b,0x46,0x6b,0x4b,0x46,0x6b,0x6c,0x61,0x58,0x47,0x52,0x6c,0x53,0x78,0x45,0x70,
0x46,0x54,0x5a,0x61,0x5a,0x52,0x6c,0x50,0x59,0x43,0x4d,0x36,0x4f,0x68,0x4d,0x6c,
0x41,0x6e,0x68,0x4d,0x56,0x41,0x3d,0x3d
0x41,0x6e,0x68,0x4d,0x56,0x41,0x3d,0x3d,0x00
};
char *b64_test;
plan_tests(1);
b64_test = base64 (random, 1024);
base64_encode_alloc (random, 1024, &b64_test);
ok(strcmp(b64_known, b64_test) == 0,
"Test matching a base64 encoded 1024 bytes random string");

View file

@ -1,22 +1,21 @@
/******************************************************************************
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: test_cmd.c 1732 2007-06-03 15:58:22Z psychotrahe $
******************************************************************************/
/*****************************************************************************
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* $Id$
*
*****************************************************************************/
#include "common.h"
#include "utils_cmd.h"
@ -51,7 +50,7 @@ main (int argc, char **argv)
int c;
int result = UNSET;
plan_tests(50);
plan_tests(51);
diag ("Running plain echo command, set one");
@ -202,7 +201,17 @@ main (int argc, char **argv)
ok (chld_err.lines == 1,
"...but does give an error line");
ok (strstr(chld_err.line[0],"non-existant-file") != NULL, "And missing filename is in error message");
ok (result == 127, "Get return code 127 from /bin/sh");
ok (result != 0, "Get non-zero return code from /bin/sh");
/* ensure everything is empty again */
result = UNSET;
command = (char *)malloc(COMMAND_LINE);
strcpy(command, "/bin/sh -c 'exit 7'");
result = cmd_run (command, NULL, NULL, 0);
ok (result == 7, "Get return code 7 from /bin/sh");
/* ensure everything is empty again */

View file

@ -1,22 +1,21 @@
/******************************************************************************
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: test_disk.c 1786 2007-09-22 17:40:35Z psychotrahe $
******************************************************************************/
/*****************************************************************************
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* $Id: test_disk.c 1914 2008-01-30 09:38:37Z dermoth $
*
*****************************************************************************/
#include "common.h"
#include "utils_disk.h"

114
lib/tests/test_ini.c Normal file
View file

@ -0,0 +1,114 @@
/*****************************************************************************
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* $Id: test_ini.c 1976 2008-04-04 10:11:22Z dermoth $
*
*****************************************************************************/
#include "common.h"
#include "utils_base.h"
#include "parse_ini.h"
#include "tap.h"
void my_free(char *string) {
if (string != NULL) {
printf("string:\n\t|%s|\n", string);
free(string);
}
}
char*
list2str(np_arg_list *optlst)
{
char *optstr=NULL;
np_arg_list *optltmp;
/* Put everything as a space-separated string */
asprintf(&optstr, "");
while (optlst) {
asprintf(&optstr, "%s%s ", optstr, optlst->arg);
optltmp=optlst;
optlst=optlst->next;
free(optltmp);
}
/* Strip last whitespace */
if (strlen(optstr)>1) optstr[strlen(optstr)-1]='\0';
return optstr;
}
int
main (int argc, char **argv)
{
char *optstr=NULL;
plan_tests(11);
optstr=list2str(np_get_defaults("section@./config-tiny.ini", "check_disk"));
ok( !strcmp(optstr, "--one=two --Foo=Bar --this=Your Mother! --blank"), "config-tiny.ini's section as expected");
my_free(optstr);
optstr=list2str(np_get_defaults("@./config-tiny.ini", "section"));
ok( !strcmp(optstr, "--one=two --Foo=Bar --this=Your Mother! --blank"), "Used default section name, without specific");
my_free(optstr);
/*
* This check is expected to die - It's commented so we can eventually put
* it in a separate file for testing the return value
*/
/* optstr=list2str(np_get_defaults("section_unknown@./config-tiny.ini", "section"));
ok( 0, "die if section isn't found");
my_free(optstr); */
optstr=list2str(np_get_defaults("Section Two@./config-tiny.ini", "check_disk"));
ok( !strcmp(optstr, "--something else=blah --remove=whitespace"), "config-tiny.ini's Section Two as expected");
my_free(optstr);
optstr=list2str(np_get_defaults("/path/to/file.txt@./config-tiny.ini", "check_disk"));
ok( !strcmp(optstr, "--this=that"), "config-tiny.ini's filename as section name");
my_free(optstr);
optstr=list2str(np_get_defaults("section2@./config-tiny.ini", "check_disk"));
ok( !strcmp(optstr, "--this=that"), "config-tiny.ini's section2 with whitespace before section name");
my_free(optstr);
optstr=list2str(np_get_defaults("section3@./config-tiny.ini", "check_disk"));
ok( !strcmp(optstr, "--this=that"), "config-tiny.ini's section3 with whitespace after section name");
my_free(optstr);
optstr=list2str(np_get_defaults("check_mysql@./plugin.ini", "check_disk"));
ok( !strcmp(optstr, "--username=operator --password=secret"), "plugin.ini's check_mysql as expected");
my_free(optstr);
optstr=list2str(np_get_defaults("check_mysql2@./plugin.ini", "check_disk"));
ok( !strcmp(optstr, "-u=admin -p=secret"), "plugin.ini's check_mysql2 as expected");
my_free(optstr);
optstr=list2str(np_get_defaults("check space_and_flags@./plugin.ini", "check_disk"));
ok( !strcmp(optstr, "--foo=bar -a -b --bar"), "plugin.ini space in stanza and flag arguments");
my_free(optstr);
optstr=list2str(np_get_defaults("Section Two@./config-dos.ini", "check_disk"));
ok( !strcmp(optstr, "--something else=blah --remove=whitespace"), "config-dos.ini's Section Two as expected");
my_free(optstr);
optstr=list2str(np_get_defaults("section_twice@./plugin.ini", "check_disk"));
ok( !strcmp(optstr, "--foo=bar --bar=foo"), "plugin.ini's section_twice defined twice in the file");
my_free(optstr);
return exit_status();
}

6
lib/tests/test_ini.t Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/perl
use Test::More;
if (! -e "./test_ini") {
plan skip_all => "./test_ini not compiled - please install tap library and/or enable parse-ini to test";
}
exec "./test_ini";

278
lib/tests/test_opts.c Normal file
View file

@ -0,0 +1,278 @@
/*****************************************************************************
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* $Id: test_ini.c 1951 2008-03-16 18:10:47Z dermoth $
*
*****************************************************************************/
#include "common.h"
#include "utils_base.h"
#include "extra_opts.h"
#include "tap.h"
void my_free(int *argc, char **argv) {
int i;
printf (" Arg(%i): ", *argc);
for (i=1; i<*argc; i++) printf ("'%s' ", argv[i]);
printf ("\n");
free(argv);
*argc=0;
}
int array_diff(int i1, char **a1, int i2, char **a2) {
int i;
if (i1 != i2) {
printf(" Argument count doesn't match!\n");
return 0;
}
for (i=0; i<=i1; i++) {
if (a1[i]==NULL && a2[i]==NULL) continue;
if (a1[i]==NULL || a2[i]==NULL) {
printf(" Argument # %i null in one array!\n", i);
return 0;
}
if (strcmp(a1[i], a2[i])) {
printf(" Argument # %i doesn't match!\n", i);
return 0;
}
}
return 1;
}
int
main (int argc, char **argv)
{
char **argv_test=NULL, **argv_known=NULL;
int i, argc_test;
plan_tests(9);
argv_test=(char **)malloc(2*sizeof(char **));
argv_test[0] = "prog_name";
argv_test[1] = NULL;
argc_test=1;
argv_known=(char **)realloc(argv_known, 2*sizeof(char **));
argv_known[0] = "prog_name";
argv_known[1] = NULL;
argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
ok(array_diff(argc_test, argv_test, 1, argv_known), "No opts, returns correct argv/argc");
my_free(&argc_test, argv_test);
argv_test=(char **)malloc(6*sizeof(char **));
argv_test[0] = "prog_name";
argv_test[1] = "arg1";
argv_test[2] = "--arg2=val1";
argv_test[3] = "--arg3";
argv_test[4] = "val2";
argv_test[5] = NULL;
argc_test=5;
argv_known=(char **)realloc(argv_known, 6*sizeof(char **));
argv_known[0] = "prog_name";
argv_known[1] = "arg1";
argv_known[2] = "--arg2=val1";
argv_known[3] = "--arg3";
argv_known[4] = "val2";
argv_known[5] = NULL;
argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
ok(array_diff(argc_test, argv_test, 5, argv_known), "No extra opts, verbatim copy of argv");
my_free(&argc_test,argv_test);
argv_test=(char **)malloc(3*sizeof(char **));
argv_test[0] = "prog_name";
argv_test[1] = "--extra-opts=@./config-opts.ini";
argv_test[2] = NULL;
argc_test=2;
argv_known=(char **)realloc(argv_known, 5*sizeof(char **));
argv_known[0] = "prog_name";
argv_known[1] = "--foo=Bar";
argv_known[2] = "--this=Your Mother!";
argv_known[3] = "--blank";
argv_known[4] = NULL;
argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
ok(array_diff(argc_test, argv_test, 4, argv_known), "Only extra opts using default section");
my_free(&argc_test,argv_test);
argv_test=(char **)malloc(5*sizeof(char **));
argv_test[0] = "prog_name";
argv_test[1] = "--extra-opts=sect1@./config-opts.ini";
argv_test[2] = "--extra-opts";
argv_test[3] = "sect2@./config-opts.ini";
argv_test[4] = NULL;
argc_test=4;
argv_known=(char **)realloc(argv_known, 5*sizeof(char **));
argv_known[0] = "prog_name";
argv_known[1] = "--one=two";
argv_known[2] = "--something else=oops";
argv_known[3] = "--this=that";
argv_known[4] = NULL;
argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
ok(array_diff(argc_test, argv_test, 4, argv_known), "Only extra opts specified twice");
my_free(&argc_test,argv_test);
argv_test=(char **)malloc(7*sizeof(char **));
argv_test[0] = "prog_name";
argv_test[1] = "--arg1=val1";
argv_test[2] = "--extra-opts=@./config-opts.ini";
argv_test[3] = "--extra-opts";
argv_test[4] = "sect1@./config-opts.ini";
argv_test[5] = "--arg2";
argv_test[6] = NULL;
argc_test=6;
argv_known=(char **)realloc(argv_known, 8*sizeof(char **));
argv_known[0] = "prog_name";
argv_known[1] = "--foo=Bar";
argv_known[2] = "--this=Your Mother!";
argv_known[3] = "--blank";
argv_known[4] = "--one=two";
argv_known[5] = "--arg1=val1";
argv_known[6] = "--arg2";
argv_known[7] = NULL;
argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
ok(array_diff(argc_test, argv_test, 7, argv_known), "twice extra opts using two sections");
my_free(&argc_test,argv_test);
/* Next three checks dre expected to die. They are commented out as they
* could possibly go in a sepatare test checked for return value.
*/
/* argv_test=(char **)malloc(6*sizeof(char **));
argv_test[0] = "prog_name";
argv_test[1] = "arg1";
argv_test[2] = "--extra-opts=missing@./config-opts.ini";
argv_test[3] = "--arg3";
argv_test[4] = "val2";
argv_test[5] = NULL;
argc_test=5;
argv_known=(char **)realloc(argv_known, 5*sizeof(char **));
argv_known[0] = "prog_name";
argv_known[1] = "arg1";
argv_known[2] = "--arg3";
argv_known[3] = "val2";
argv_known[4] = NULL;
argv_test=np_extra_opts(&argc_test, argv_test, "check_missing");
ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 1");
my_free(&argc_test,argv_test); */
/* argv_test=(char **)malloc(7*sizeof(char **));
argv_test[0] = "prog_name";
argv_test[1] = "arg1";
argv_test[2] = "--extra-opts";
argv_test[3] = "missing@./config-opts.ini";
argv_test[4] = "--arg3";
argv_test[5] = "val2";
argv_test[6] = NULL;
argc_test=6;
argv_known=(char **)realloc(argv_known, 5*sizeof(char **));
argv_known[0] = "prog_name";
argv_known[1] = "arg1";
argv_known[2] = "--arg3";
argv_known[3] = "val2";
argv_known[4] = NULL;
argv_test=np_extra_opts(&argc_test, argv_test, "check_missing");
ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 2");
my_free(&argc_test,argv_test); */
/* argv_test=(char **)malloc(6*sizeof(char **));
argv_test[0] = "prog_name";
argv_test[1] = "arg1";
argv_test[2] = "--extra-opts";
argv_test[3] = "--arg3";
argv_test[4] = "val2";
argv_test[5] = NULL;
argc_test=5;
argv_known=(char **)realloc(argv_known, 5*sizeof(char **));
argv_known[0] = "prog_name";
argv_known[1] = "arg1";
argv_known[2] = "--arg3";
argv_known[3] = "val2";
argv_known[4] = NULL;
argv_test=np_extra_opts(&argc_test, argv_test, "check_missing");
ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 3");
my_free(&argc_test,argv_test); */
setenv("NAGIOS_CONFIG_PATH", ".", 1);
argv_test=(char **)malloc(6*sizeof(char **));
argv_test[0] = "prog_name";
argv_test[1] = "arg1";
argv_test[2] = "--extra-opts";
argv_test[3] = "--arg3";
argv_test[4] = "val2";
argv_test[5] = NULL;
argc_test=5;
argv_known=(char **)realloc(argv_known, 6*sizeof(char **));
argv_known[0] = "prog_name";
argv_known[1] = "--foo=bar";
argv_known[2] = "arg1";
argv_known[3] = "--arg3";
argv_known[4] = "val2";
argv_known[5] = NULL;
argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
ok(array_diff(argc_test, argv_test, 5, argv_known), "Default section 1");
argv_test=(char **)malloc(3*sizeof(char **));
argv_test[0] = "prog_name";
argv_test[1] = "--extra-opts";
argv_test[2] = NULL;
argc_test=2;
argv_known=(char **)realloc(argv_known, 3*sizeof(char **));
argv_known[0] = "prog_name";
argv_known[1] = "--foo=bar";
argv_known[2] = NULL;
argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
ok(array_diff(argc_test, argv_test, 2, argv_known), "Default section 2");
my_free(&argc_test,argv_test);
argv_test=(char **)malloc(6*sizeof(char **));
argv_test[0] = "prog_name";
argv_test[1] = "arg1";
argv_test[2] = "--extra-opts=section1";
argv_test[3] = "--arg3";
argv_test[4] = "val2";
argv_test[5] = NULL;
argc_test=5;
argv_known=(char **)realloc(argv_known, 6*sizeof(char **));
argv_known[0] = "prog_name";
argv_known[1] = "--foobar=baz";
argv_known[2] = "arg1";
argv_known[3] = "--arg3";
argv_known[4] = "val2";
argv_known[5] = NULL;
argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
ok(array_diff(argc_test, argv_test, 5, argv_known), "Default section 3");
my_free(&argc_test,argv_test);
argv_test=(char **)malloc(6*sizeof(char **));
argv_test[0] = "prog_name";
argv_test[1] = "arg1";
argv_test[2] = "--extra-opts";
argv_test[3] = "-arg3";
argv_test[4] = "val2";
argv_test[5] = NULL;
argc_test=5;
argv_known=(char **)realloc(argv_known, 6*sizeof(char **));
argv_known[0] = "prog_name";
argv_known[1] = "--foo=bar";
argv_known[2] = "arg1";
argv_known[3] = "-arg3";
argv_known[4] = "val2";
argv_known[5] = NULL;
argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
ok(array_diff(argc_test, argv_test, 5, argv_known), "Default section 4");
my_free(&argc_test,argv_test);
return exit_status();
}

6
lib/tests/test_opts.t Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/perl
use Test::More;
if (! -e "./test_opts") {
plan skip_all => "./test_opts not compiled - please install tap library and/or enable parse-ini to test";
}
exec "./test_opts";

View file

@ -1,22 +1,21 @@
/******************************************************************************
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: test_tcp.c 1732 2007-06-03 15:58:22Z psychotrahe $
******************************************************************************/
/*****************************************************************************
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* $Id: test_tcp.c 1914 2008-01-30 09:38:37Z dermoth $
*
*****************************************************************************/
#include "common.h"
#include "utils_tcp.h"

View file

@ -1,22 +1,21 @@
/******************************************************************************
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: test_utils.c 1452 2006-07-13 23:58:00Z tonvoon $
******************************************************************************/
/*****************************************************************************
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* $Id: test_utils.c 1914 2008-01-30 09:38:37Z dermoth $
*
*****************************************************************************/
#include "common.h"
#include "utils_base.h"

View file

@ -1,19 +1,34 @@
/*****************************************************************************
*
* utils_base.c
*
* Library of useful functions for plugins
* These functions are tested with libtap. See tests/ directory
*
* Copyright (c) 2006 Nagios Plugin Development Team
* License: GPL
*
* $Revision: 1768 $
* $Date: 2007-07-29 13:42:05 +0100 (Sun, 29 Jul 2007) $
****************************************************************************/
*
* utils_base.c
*
* License: GPL
* Copyright (c) 2006 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-03-11 00:10:23 +0000 (Tue, 11 Mar 2008) $
*
* Library of useful functions for plugins
*
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* $Id: utils_base.c 1938 2008-03-11 00:10:23Z tonvoon $
*
*****************************************************************************/
#include <stdarg.h>
#include "common.h"
#include <stdarg.h>
#include "utils_base.h"
void
@ -105,10 +120,6 @@ _set_thresholds(thresholds **my_thresholds, char *warn_string, char *critical_st
}
}
if (*my_thresholds > 0) { /* Not sure why, but sometimes could be -1 */
/* printf("Freeing here: %d\n", *my_thresholds); */
free(*my_thresholds);
}
*my_thresholds = temp_thresholds;
return 0;

View file

@ -1,42 +1,43 @@
/****************************************************************************
* Nagios run command utilities
*
* License: GPL
* Copyright (c) 2005 nagios-plugins team
*
* $Id: utils_cmd.c 1434 2006-06-18 19:36:48Z opensides $
*
* Description :
*
* A simple interface to executing programs from other programs, using an
* optimized and safe popen()-like implementation. It is considered safe
* in that no shell needs to be spawned and the environment passed to the
* execve()'d program is essentially empty.
*
*
* The code in this file is a derivative of popen.c which in turn was taken
* from "Advanced Programming for the Unix Environment" by W. Richard Stevens.
*
* Care has been taken to make sure the functions are async-safe. The one
* function which isn't is cmd_init() which it doesn't make sense to
* call twice anyway, so the api as a whole should be considered async-safe.
*
* 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.
*/
/*****************************************************************************
*
* Nagios run command utilities
*
* License: GPL
* Copyright (c) 2005-2006 Nagios Plugins Development Team
*
* Last Modified: $Date$
*
* Description :
*
* A simple interface to executing programs from other programs, using an
* optimized and safe popen()-like implementation. It is considered safe
* in that no shell needs to be spawned and the environment passed to the
* execve()'d program is essentially empty.
*
* The code in this file is a derivative of popen.c which in turn was taken
* from "Advanced Programming for the Unix Environment" by W. Richard Stevens.
*
* Care has been taken to make sure the functions are async-safe. The one
* function which isn't is cmd_init() which it doesn't make sense to
* call twice anyway, so the api as a whole should be considered async-safe.
*
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* $Id$
*
*****************************************************************************/
#define NAGIOSPLUG_API_C 1

View file

@ -1,32 +1,31 @@
/****************************************************************************
* Utils for check_disk
*
/*****************************************************************************
*
* Library for check_disk
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-09-22 18:48:33 +0100 (Sat, 22 Sep 2007) $
*
* Copyright (c) 1999-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-01-30 09:46:21 +0000 (Wed, 30 Jan 2008) $
*
* Description:
*
*
* This file contains utilities for check_disk. These are tested by libtap
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
*
* 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
* the Free Software Foundation, either version 3 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_disk.c 1787 2007-09-22 17:48:33Z psychotrahe $
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: utils_disk.c 1915 2008-01-30 09:46:21Z dermoth $
*
*****************************************************************************/

View file

@ -1,33 +1,32 @@
/****************************************************************************
* Utils for check_tcp
*
/*****************************************************************************
*
* Library for check_tcp
*
* License: GPL
* Copyright (c) 1999-2007 nagios-plugins team
*
* Last Modified: $Date: 2007-09-22 18:48:33 +0100 (Sat, 22 Sep 2007) $
*
* Copyright (c) 1999-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-01-30 09:46:21 +0000 (Wed, 30 Jan 2008) $
*
* 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
*
*
* 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
* the Free Software Foundation, either version 3 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 1787 2007-09-22 17:48:33Z psychotrahe $
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: utils_tcp.c 1915 2008-01-30 09:46:21Z dermoth $
*
*****************************************************************************/
#include "common.h"