summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 14a5ffc)
raw | patch | inline | side by side (parent: 14a5ffc)
author | niki <niki> | |
Sat, 17 Dec 2005 03:27:30 +0000 (03:27 +0000) | ||
committer | niki <niki> | |
Sat, 17 Dec 2005 03:27:30 +0000 (03:27 +0000) |
src/Makefile.am | patch | blob | history | |
src/collectd.c | patch | blob | history | |
src/collectd.h | patch | blob | history |
diff --git a/src/Makefile.am b/src/Makefile.am
index 6b85c0358689e2acf4765896a949bd620477602b..bd2d25f4ecbf61c91139df44ceb7cc2e8092c185 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
#collectd_CFLAGS = -DPLUGINDIR='"$(pkglibdir)"'
collectd_CPPFLAGS = $(LTDLINCL)
collectd_CPPFLAGS += -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"'
+collectd_CPPFLAGS += -DCONFIGDIR='"${sysconfdir}/${PACKAGE_NAME}.d"'
collectd_CPPFLAGS += -DPKGLOCALSTATEDIR='"${localstatedir}/lib/${PACKAGE_NAME}"'
if BUILD_FEATURE_DAEMON
collectd_CPPFLAGS += -DPIDFILE='"${localstatedir}/run/${PACKAGE_NAME}.pid"'
diff --git a/src/collectd.c b/src/collectd.c
index 5458a2caa2a4881be174ce7cb7bae66e014098e6..c7ea35b6886b58e5189419dcd9b2efc26e927455 100644 (file)
--- a/src/collectd.c
+++ b/src/collectd.c
int operating_mode;
#endif
-static void sigIntHandler (int signal)
+static void
+sigIntHandler (int signal)
{
loop++;
}
-static int change_basedir (char *dir)
+static int
+change_basedir (char *dir)
{
int dirlen = strlen (dir);
} /* static int change_basedir (char *dir) */
#ifdef HAVE_LIBKSTAT
-static void update_kstat (void)
+static void
+update_kstat (void)
{
if (kc == NULL)
{
} /* static void update_kstat (void) */
#endif /* HAVE_LIBKSTAT */
-static void exit_usage (char *name)
+static void
+exit_usage (char *name)
{
printf ("Usage: "PACKAGE" [OPTIONS]\n\n"
"Available options:\n"
" General:\n"
- /*
" -C <file> Configuration file.\n"
" Default: "CONFIGFILE"\n"
+ /* sure you want a configFILE?
+ what about a configDIR? - niki */
+ /*
+ " -C <dir> Configuration directory.\n"
+ " Default: "CONFIGDIR"\n"
*/
#if COLLECT_DAEMON
" -P <file> PID file.\n"
exit (0);
} /* static void exit_usage (char *name) */
-static int start_client (void)
+static int
+start_client (void)
{
int sleepingtime;
} /* static int start_client (void) */
#ifdef HAVE_LIBRRD
-static int start_server (void)
+static int
+start_server (void)
{
char *host;
char *type;
#endif /* HAVE_LIBRRD */
#if COLLECT_DAEMON
-static int pidfile_create (char *file)
+static int
+pidfile_create (const char *file)
{
FILE *fh;
fclose(fh);
return (0);
-} /* static int pidfile_create (char *file) */
+} /* static int pidfile_create (const char *file) */
#endif /* COLLECT_DAEMON */
#if COLLECT_DAEMON
-static int pidfile_remove (void)
+static int
+pidfile_remove (const char *file)
{
- return (unlink (PIDFILE));
-} /* static int pidfile_remove (void) */
+ if (file == NULL) {
+ file = PIDFILE;
+ }
+ return (unlink (file));
+} /* static int pidfile_remove (const char *file) */
#endif /* COLLECT_DAEMON */
-int main (int argc, char **argv)
+int
+main (int argc, char **argv)
{
struct sigaction sigIntAction, sigChldAction;
char *configfile = CONFIGFILE;
+/* or char *configdir = CONFIGDIR; */
char *plugindir = PLUGINDIR;
char *datadir = PKGLOCALSTATEDIR;
#if COLLECT_DAEMON
#endif /* HAVE_LIBRRD */
case 'C':
configfile = optarg;
+ /* configdir = optarg; */
break;
#if COLLECT_DAEMON
case 'P':
#if COLLECT_DAEMON
if (daemonize)
- pidfile_remove();
+ pidfile_remove(pidfile);
#endif /* COLLECT_DAEMON */
return (0);
-}
+} /* int main (int argc, char **argv) */
diff --git a/src/collectd.h b/src/collectd.h
index 922aebf12ed25ca8405fcc97e7bb94d8cf15acec..a469bd4d8778d356d5a44f633fa1008b861411f7 100644 (file)
--- a/src/collectd.h
+++ b/src/collectd.h
extern time_t curtime;
extern int operating_mode;
+int main (int argc, char **argv);
+
#endif /* COLLECTD_H */