From 89693973e78ca3d1230a5c42e12c9488a1d2b99e Mon Sep 17 00:00:00 2001 From: octo Date: Fri, 16 Dec 2005 10:33:59 +0000 Subject: [PATCH] Merged changes from trunk@315 to branches/collectd-quota --- src/Makefile.am | 4 ++-- src/collectd.c | 14 +++++++------- src/collectd.h | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 9 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 11a08629..879214a2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,8 +12,8 @@ collectd_SOURCES = collectd.c collectd.h \ plugin.c plugin.h #collectd_CFLAGS = -DPLUGINDIR='"$(pkglibdir)"' collectd_CPPFLAGS = -collectd_CPPFLAGS += -DSYSCONFDIR='"${sysconfdir}"' -collectd_CPPFLAGS += -DPKGLOCALSTATEDIR='"${localstatedir}/${PACKAGE_NAME}"' +collectd_CPPFLAGS += -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"' +collectd_CPPFLAGS += -DPKGLOCALSTATEDIR='"${localstatedir}/lib/${PACKAGE_NAME}"' collectd_CPPFLAGS += -DPIDFILE='"${localstatedir}/run/${PACKAGE_NAME}.pid"' collectd_CPPFLAGS += -DPLUGINDIR='"${pkglibdir}"' collectd_LDFLAGS = -export-dynamic diff --git a/src/collectd.c b/src/collectd.c index 9932fd90..5e28918e 100644 --- a/src/collectd.c +++ b/src/collectd.c @@ -120,7 +120,7 @@ void exit_usage (char *name) "Available options:\n" " General:\n" - " -C Configuration directory.\n" + " -C Configuration file.\n" " Default: %s\n" " -P PID File.\n" " Default: %s\n" @@ -142,7 +142,7 @@ void exit_usage (char *name) "\n%s %s, http://verplant.org/collectd/\n" "by Florian octo Forster \n" "for contributions see `AUTHORS'\n", - PACKAGE, SYSCONFDIR, PIDFILE, PLUGINDIR, PKGLOCALSTATEDIR, PACKAGE, VERSION); + PACKAGE, CONFIGFILE, PIDFILE, PLUGINDIR, PKGLOCALSTATEDIR, PACKAGE, VERSION); exit (0); } @@ -242,10 +242,10 @@ int main (int argc, char **argv) pid_t pid; #endif - char *confdir = SYSCONFDIR; - char *pidfile = PIDFILE; - char *plugindir = PLUGINDIR; - char *datadir = PKGLOCALSTATEDIR; + char *configfile = CONFIGFILE + char *pidfile = PIDFILE; + char *plugindir = PLUGINDIR; + char *datadir = PKGLOCALSTATEDIR; int daemonize = 1; @@ -289,7 +289,7 @@ int main (int argc, char **argv) break; #endif /* HAVE_LIBRRD */ case 'C': - confdir = optarg; + configfile = optarg; break; case 'P': pidfile = optarg; diff --git a/src/collectd.h b/src/collectd.h index 0b63aa1a..7f163bd5 100644 --- a/src/collectd.h +++ b/src/collectd.h @@ -1,3 +1,25 @@ +/** + * collectd - src/collectd.h + * Copyright (C) 2005 Florian octo Forster + * + * 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., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Florian octo Forster + **/ + #ifndef COLLECTD_H #define COLLECTD_H @@ -142,6 +164,34 @@ #include #endif +#ifndef PACKAGE_NAME +#define PACKAGE_NAME "collectd" +#endif + +#ifndef PREFIX +#define PREFIX "/opt/" PACKAGE_NAME +#endif + +#ifndef SYSCONFDIR +#define SYSCONFDIR PREFIX "/etc" +#endif + +#ifndef CONFIGFILE +#define CONFIGFILE SYSCONFDIR"/collectd.conf" +#endif + +#ifndef PKGLOCALSTATEDIR +#define PKGLOCALSTATEDIR PREFIX "/var/lib/" PACKAGE_NAME +#endif + +#ifndef PIDFILE +#define PIDFILE PREFIX "/var/run/" PACKAGE_NAME ".pid" +#endif + +#ifndef PLUGINDIR +#define PLUGINDIR PREFIX "/lib/" PACKAGE_NAME +#endif + #define MODE_SERVER 0x01 #define MODE_CLIENT 0x02 #define MODE_LOCAL 0x03 -- 2.30.2