src/riemann-client.c: Only print metrics if they're available

Similar to the JSON output, only print metrics when they're available in
the Event. This fixes #1.

Reported-by: Fabien Wernli
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
client: Add a riemann_client_get_fd() function

This function can be used to get thet file descriptor behind a Riemann
client connection. The intended use is for setting various TCP or socket
optionss (such as TCP_CORK) on it from the application.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
docs: Add a short paragraph about riemann_client_get_fd()

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Move config.h to lib/riemann/platform.h

Use "riemann/platform.h" instead of config.h, to avoid potential
filename conflicts.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
src/riemann-client: Add a --version command-line option

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
src/riemann-client: Add --version to the subcommands too

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
src/riemann-client: Code cleanup

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
src/riemann-client: Split into smaller files

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
src/riemann-client: Refactor the main() function

Use a function map to call the functions, instead of if/else pairs.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
message: Code cleanup

Removed an unreachable branch from riemann_message_set_events().

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
message: Removed an unneeded empty line

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
tests: Don't use ck_assert_int_gt()

Use ck_assert() instead of ck_assert_int_gt(), to work around a Travis
CI failure.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
event: Fix the error branch of riemann_event_create()

In riemann_event_create(), cache the result of riemann_event_set_va(),
and use that for the errno value in the error branch, instead of trying
to save errno, which the called function does not set.

Adjust the test case accordingly.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
tests: Use 127.0.0.1 instead of localhost

Switched the test suite to connect to 127.0.0.1 instead of localhost, as
the latter can resolve to ::1, while Riemann will - by default - listen
on 127.0.0.1 only.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
.travis.yml: Add coveralls support

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
README.md: Add Coveralls badge

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
.travis.yml: Fix the arguments of coveralls

We need --exclude-pattern to exclude the header files, plain --exclude
does not work.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
.travis.yml: Patch up the excludes

Really exclude all headers (and shorten the command-line, while there).

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
README.md: Fix the Coveralls badge URLs

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
query: Simplify riemann_query_new()

When creating a new query object, setting the string cannot fail: we
either died before that point, or bailed out when no query string needs
to be set, or we will succeed (or, again, die without recovery).
Therefore, we can skip an error branch there.

Added comments to clarify the situation, however.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>