summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ef363a0)
raw | patch | inline | side by side (parent: ef363a0)
author | octo <octo> | |
Wed, 31 May 2006 07:04:40 +0000 (07:04 +0000) | ||
committer | octo <octo> | |
Wed, 31 May 2006 07:04:40 +0000 (07:04 +0000) |
src/ntpd.c | patch | blob | history |
diff --git a/src/ntpd.c b/src/ntpd.c
index 0fa3b34964c7b7f203c8f318b9a81be39dc4cc20..b9e7344552d3802cacdf0a9b663615f25927ed9e 100644 (file)
--- a/src/ntpd.c
+++ b/src/ntpd.c
# include <sys/poll.h>
#endif
+static char *config_keys[] =
+{
+ "Host",
+ "Port",
+ NULL
+};
+static int config_keys_num = 2;
+
/* drift */
static char *time_offset_file = "ntpd/time_offset-%s.rrd";
static char *time_offset_ds_def[] =
* End of the copied stuff.. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+static int ntpd_config (char *key, char *value)
+{
+ if (strcasecmp (key, "host") == 0)
+ {
+ if (ntpd_host != NULL)
+ free (ntpd_host);
+ if ((ntpd_host = strdup (value)) == NULL)
+ return (1);
+ }
+ else if (strcasecmp (key, "port") == 0)
+ {
+ if (ntpd_port != NULL)
+ free (ntpd_port);
+ if ((ntpd_port = strdup (value)) == NULL)
+ return (1);
+ }
+ else
+ {
+ return (-1);
+ }
+
+ return (0);
+}
+
static void ntpd_init (void)
{
return;
plugin_register (MODULE_NAME, ntpd_init, ntpd_read, NULL);
plugin_register ("ntpd_time_offset", NULL, NULL, ntpd_write_time_offset);
plugin_register ("ntpd_frequency_offset", NULL, NULL, ntpd_write_frequency_offset);
+ cf_register (MODULE_NAME, ntpd_config, config_keys, config_keys_num);
}
#undef MODULE_NAME