author | Sebastian Harl <sh@tokkee.org> | |
Tue, 5 Mar 2013 01:11:13 +0000 (02:11 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 5 Mar 2013 01:11:13 +0000 (02:11 +0100) |
index 55a8be8f983d92bb0b6deecde500f8bcadd3fce1..56dde37d9365cbc8ac73939635b6880844140992 100644 (file)
--- a/README
+++ b/README
* A build environment: autotools, libtool, C compiler, ...
+ * When building from Git, you also need the flex lexical analyzer generator
+ and bison parser generator (other lex and yacc compatible tools might work
+ as well if you are lucky).
+
* A POSIX + Single UNIX Specification compatible C library.
- * asciidoc, xsltproc:
+ * asciidoc, xsltproc, xmlto:
The AsciiDoc text document format is used to write the manpages.
Configuring / Compiling / Installing
diff --git a/configure.ac b/configure.ac
index fac681dc116fa66328ae29bf834d25cbf6e23486..dfcb64fad94b97f47c03271adbe277b43fef08c7 100644 (file)
--- a/configure.ac
+++ b/configure.ac
-Wmissing-prototypes \
-Wpointer-arith \
-Wshadow \
- -Wstrict-prototypes \
- -Wunreachable-code; do
+ -Wstrict-prototypes; do
AC_MSG_CHECKING([whether $CC accepts $flag])
if test_cc_flags $flag; then
dnl Feature checks.
build_documentation="yes"
+have_xmlto="yes"
+AC_PATH_PROG([XMLTO], [xmlto])
+if test "x$XMLTO" = "x"; then
+ have_xmlto="no"
+ build_documentation="no (missing xmlto)"
+fi
+
have_xsltproc="yes"
AC_PATH_PROG([XSLTPROC], [xsltproc])
if test "x$XSLTPROC" = "x"; then
AC_SUBST([A2X])
dnl Plugin checks.
-enable_puppet_storeconfigs=$with_libdbi
-if test "x$enable_puppet_storeconfigs" = "xno"; then
- enable_puppet_storeconfigs="no (requires libdbi)"
+puppet_storeconfigs_default=$with_libdbi
+if test "x$puppet_storeconfigs_default" != "xyes"; then
+ puppet_storeconfigs_default="no (requires libdbi)"
fi
m4_divert_once([HELP_ENABLE], [
[backend accessing the system statistics collection daemon])
AC_SDB_PLUGIN([mk-livestatus], [yes],
[backend accessing Nagios/Icinga/Shinken using MK Livestatus])
-AC_SDB_PLUGIN([puppet-storeconfigs], [$enable_puppet_storeconfigs],
+AC_SDB_PLUGIN([puppet-storeconfigs], [$puppet_storeconfigs_default],
[backend accessing the Puppet stored configuration database])
AM_CONDITIONAL([BUILD_DOCUMENTATION], test "x$build_documentation" = "xyes")
AC_MSG_RESULT()
AC_MSG_RESULT([ Tools:])
AC_MSG_RESULT([ AsciiDoc (a2x): . . . . . . $have_a2x])
-AC_MSG_RESULT([ xsltproc: . . . . . . . . . $have_xsltproc])
+AC_MSG_RESULT([ xmlto / xsltproc: . . . . . $have_xmlto / $have_xsltproc])
AC_MSG_RESULT()
AC_MSG_RESULT([ Features:])
AC_MSG_RESULT([ documentation: . . . . . . $build_documentation])
diff --git a/m4/sdb_plugin.m4 b/m4/sdb_plugin.m4
index 1cf916cf4805eb692e7056e49bec78d90f9ed72e..e734e0d0b9bffb14688ae3dfb045ace05b92c09c 100644 (file)
--- a/m4/sdb_plugin.m4
+++ b/m4/sdb_plugin.m4
if test "x$2" = "xyes"; then
enable_plugin="yes"
else
- enable_plugin="no"
+ enable_plugin="$2"
fi
else
enable_plugin="$enable_all_plugins"
diff --git a/src/backend/collectd.c b/src/backend/collectd.c
index f745fc9316d66e9849c219c4ebe2e1d3769a78a9..e0e924e2c959e946f7e645a6879aba0be5ede13c 100644 (file)
--- a/src/backend/collectd.c
+++ b/src/backend/collectd.c
sdb_collectd_config_instance(oconfig_item_t *ci)
{
char *name = NULL;
- char *socket = NULL;
+ char *socket_path = NULL;
char cb_name[1024];
oconfig_item_t *child = ci->children + i;
if (! strcasecmp(child->key, "Socket"))
- oconfig_get_string(child, &socket);
+ oconfig_get_string(child, &socket_path);
else
fprintf(stderr, "collectd backend: Ignoring unknown config "
"option '%s' inside <Instance %s>.\n",
child->key, name);
}
- if (! socket) {
+ if (! socket_path) {
fprintf(stderr, "collectd backend: Instance '%s' missing "
"the 'Socket' option.\n", name);
return -1;
snprintf(cb_name, sizeof(cb_name), "collectd-%s", name);
cb_name[sizeof(cb_name) - 1] = '\0';
- client = sdb_unixsock_client_create(socket);
+ client = sdb_unixsock_client_create(socket_path);
if (! client) {
char errbuf[1024];
fprintf(stderr, "collectd backend: Failed to create unixsock client: "
index 57fda523ddf9c81419bb6b565e0d7b305be834fe..a5126fb037e8c3e9a70412b989692b3bdb1e6c3e 100644 (file)
sdb_livestatus_config_instance(oconfig_item_t *ci)
{
char *name = NULL;
- char *socket = NULL;
+ char *socket_path = NULL;
char cb_name[1024];
oconfig_item_t *child = ci->children + i;
if (! strcasecmp(child->key, "Socket"))
- oconfig_get_string(child, &socket);
+ oconfig_get_string(child, &socket_path);
else
fprintf(stderr, "MK Livestatus backend: Ignoring unknown config "
"option '%s' inside <Instance %s>.\n",
child->key, name);
}
- if (! socket) {
+ if (! socket_path) {
fprintf(stderr, "MK Livestatus backend: Instance '%s' missing "
"the 'Socket' option.\n", name);
return -1;
snprintf(cb_name, sizeof(cb_name), "mk-livestatus-%s", name);
cb_name[sizeof(cb_name) - 1] = '\0';
- client = sdb_unixsock_client_create(socket);
+ client = sdb_unixsock_client_create(socket_path);
if (! client) {
char errbuf[1024];
fprintf(stderr, "MK Livestatus backend: Failed to create unixsock "
diff --git a/src/core/store.c b/src/core/store.c
index e5cd886aae31be9bb1d35be92e9f42b7d729e4b5..cbd5f0c05595ccdca54ce2dba48b02d386fed972 100644 (file)
--- a/src/core/store.c
+++ b/src/core/store.c
sdb_host_t *
sdb_host_clone(const sdb_host_t *host)
{
- sdb_host_t *clone;
+ sdb_host_t *new;
- clone = sdb_host_create(host->host_name);
- if (! clone)
+ new = sdb_host_create(host->host_name);
+ if (! new)
return NULL;
/* make sure these are initialized; else sdb_object_deref() might access
* arbitrary memory in case of an error */
- clone->services = clone->attributes = NULL;
+ new->services = new->attributes = NULL;
if (host->attributes) {
- clone->attributes = sdb_llist_clone(host->attributes);
- if (! clone->attributes) {
- sdb_object_deref(SDB_OBJ(clone));
+ new->attributes = sdb_llist_clone(host->attributes);
+ if (! new->attributes) {
+ sdb_object_deref(SDB_OBJ(new));
return NULL;
}
}
- clone->host_last_update = host->host_last_update;
+ new->host_last_update = host->host_last_update;
if (host->services) {
- clone->services = sdb_llist_clone(host->services);
- if (! clone->services) {
- sdb_object_deref(SDB_OBJ(clone));
+ new->services = sdb_llist_clone(host->services);
+ if (! new->services) {
+ sdb_object_deref(SDB_OBJ(new));
return NULL;
}
}
- return clone;
+ return new;
} /* sdb_host_clone */
int
sdb_attribute_t *
sdb_attribute_clone(const sdb_attribute_t *attr)
{
- sdb_attribute_t *clone;
+ sdb_attribute_t *new;
- clone = sdb_attribute_create(attr->hostname,
+ new = sdb_attribute_create(attr->hostname,
attr->attr_name, attr->attr_value);
- if (! clone)
+ if (! new)
return NULL;
- clone->attr_last_update = attr->attr_last_update;
- return clone;
+ new->attr_last_update = attr->attr_last_update;
+ return new;
} /* sdb_attribute_clone */
int
sdb_service_t *
sdb_service_clone(const sdb_service_t *svc)
{
- sdb_service_t *clone;
+ sdb_service_t *new;
- clone = sdb_service_create(svc->hostname, svc->svc_name);
- if (! clone)
+ new = sdb_service_create(svc->hostname, svc->svc_name);
+ if (! new)
return NULL;
- clone->svc_last_update = svc->svc_last_update;
- return clone;
+ new->svc_last_update = svc->svc_last_update;
+ return new;
} /* sdb_service_clone */
int
diff --git a/src/daemon/sysdbd.c b/src/daemon/sysdbd.c
index 8b7ebd49131262cf8e835a87ab3be9a06b80fba9..ef53a24693a909810108aa113c9c3a8a5843fa08 100644 (file)
--- a/src/daemon/sysdbd.c
+++ b/src/daemon/sysdbd.c
main(int argc, char **argv)
{
char *config_filename = NULL;
- _Bool daemon = 0;
+ _Bool do_daemonize = 0;
struct sigaction sa_intterm;
config_filename = optarg;
break;
case 'd':
- daemon = 1;
+ do_daemonize = 1;
break;
case 'h':
exit(1);
}
- if (daemon)
+ if (do_daemonize)
if (daemonize())
exit(1);
diff --git a/src/utils/llist.c b/src/utils/llist.c
index e853001bc45bf7fd9a02f55961930105f89366cf..7d573cfa7449ca1dba229e18702fbac009d688c5 100644 (file)
--- a/src/utils/llist.c
+++ b/src/utils/llist.c
sdb_llist_t *
sdb_llist_clone(sdb_llist_t *list)
{
- sdb_llist_t *clone;
+ sdb_llist_t *new;
sdb_llist_elem_t *elem;
if (! list)
return NULL;
- clone = sdb_llist_create();
- if (! clone)
+ new = sdb_llist_create();
+ if (! new)
return NULL;
if (! list->length) {
assert((! list->head) && (! list->tail));
- return clone;
+ return new;
}
for (elem = list->head; elem; elem = elem->next) {
- if (sdb_llist_append(clone, elem->obj)) {
- sdb_llist_destroy(clone);
+ if (sdb_llist_append(new, elem->obj)) {
+ sdb_llist_destroy(new);
return NULL;
}
}
- return clone;
+ return new;
} /* sdb_llist_clone */
void