nagiostats: Make the -s flag useful once more

It used to be used for reading some format that no longer exists,
but the helptext indicated it was supposed to be used to read a
normal status.log file (and thus just bypass the nagios.cfg).
Since there are no tools to generate the now-dead format, we
simply re-use the -s flag to mean "status.log format".

As a nice side-effect, we can remove quite a lot of dead code.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@1976 5f96b256-904b-4d8d-8c98-d829582c6739
core: Revert "Revert "Janitor patch: Fix -Wset-but-unused warnings""

This reverts commit 67cd2417b7bf7b7fe11c2d458e272158796b878e, which
reverted a previous commit where a logical error had snuck in,
causing macro resolution to fail horribly. This fixes all warnings
the original commit was supposed to fix, but without the bug, which
I blame the weird indentation for in order to avoid responsibility
for not testing my own patches ;)

Spotted-by: Ricardo Maraschini <ricardo.maraschini@opservices.com.br>
Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@1977 5f96b256-904b-4d8d-8c98-d829582c6739
core: Fix checking of return-value for schedule_new_event()

Since we changed it to return a pointer to a timed_event, we've been
getting compiler warnings from cmd_signal_process().

This patch silences the warning by properly checking the return value
of schedule_new_event() and returning properly based on its result.

We still ignore the result at the original callsite, but at least now
we get rid of the "pointer-to-int conversion" warning gcc used to
throw at us.

Patched-by: Ricardo Maraschini <ricardo.maraschini@opservices.com.br>
Message-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@1978 5f96b256-904b-4d8d-8c98-d829582c6739
core: Fix compiler warning about implicit asprintf() declaration

Accordingly to feature_test_macros(7):
  "NOTE: In order to be effective, a feature test macro must be
  defined before including any header files."

As we already define _GNU_SOURCE on config.h, pushing its include up
top will suppress the "implicit declaration of function ‘asprintf’"
warning message during compilation.

Patched-by: Ricardo Maraschini <ricardo.maraschini@opservices.com.br>
Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@1979 5f96b256-904b-4d8d-8c98-d829582c6739
core: Avoid 'set-but-unused variable' warning

The temp_buffer in my_system_r() is only ever (really) used when
embedded is compiled in, so we move the declaration to inside the
conditional code from its previous location outside it.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@1980 5f96b256-904b-4d8d-8c98-d829582c6739
lib/squeue: Remove unused function squeue_foreach()

It's only used in testing, so remove it for now.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@1981 5f96b256-904b-4d8d-8c98-d829582c6739
Prep for installing nagios headers in system include files

This quite simple patch allows us to put Nagios' header files
from include/ in /usr/include/nagios (for example) and the
headers from lib/ in /usr/include/nagios/lib and everything
will keep on working just fine without any special build-flags
for projects that want to use either the headers or some of
the library parts.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@1982 5f96b256-904b-4d8d-8c98-d829582c6739
Add lib/test-squeue

And also add the infrastructure needed for adding more tests
following the same pattern later.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@1983 5f96b256-904b-4d8d-8c98-d829582c6739
libnagios: Add key/value vector API

This is a (very) simple and straightforward api used to gather and
managed arrays of key/value pairs in a CPU-efficient manner, which
includes array-to-buffer conversion and buffer-to-array conversion,
making it highly useful for IPC.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@1984 5f96b256-904b-4d8d-8c98-d829582c6739
libnagios: Add io cache api

It's actually slightly misnamed, as it basically only contains
helpers to read large chunks of data and then partition that data
into the desired bits and pieces. It currently supports getting
either fixed-size chunks or chunks by end-of-message sentinel
byte sequences.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@1985 5f96b256-904b-4d8d-8c98-d829582c6739
.gitignore library test programs

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@1986 5f96b256-904b-4d8d-8c98-d829582c6739
lib/Makefile: Remove test programs when cleaning

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@1987 5f96b256-904b-4d8d-8c98-d829582c6739
libnagios: Add I/O broker library

Severely nifty for watching filedescriptors for input, and a lot
lighter on memory usage and cpu than both libev and libevent,
although only for relatively small sets of watched filedescriptors
and without support for timers, signal watchers and other jazz
that lib{ev,event} bring along and we don't need.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@1988 5f96b256-904b-4d8d-8c98-d829582c6739
lib/Makefile: Avoid using test-coverage flags by default

They're nifty when writing tests, but pretty counterproductive for
production code.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@1989 5f96b256-904b-4d8d-8c98-d829582c6739
libnagios: Add test coverage support to libnagios' Makefile

'make coverage' in the lib directory will now print candidates
for testing. iocache seems to be the primary candidate for
more tests.

Signed-off-by: Andreas Ericsson <ae@op5.se>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@1990 5f96b256-904b-4d8d-8c98-d829582c6739