small updates to make keeper play nice with getDir

This commit is contained in:
fishwaldo 2003-04-30 13:10:51 +00:00
parent 2a72b39eb2
commit f67b351851
4 changed files with 32 additions and 14 deletions

9
conf.h
View file

@ -20,7 +20,7 @@
** USA
**
** NeoStats CVS Identification
** $Id: conf.h,v 1.3 2003/04/18 06:41:34 fishwaldo Exp $
** $Id: conf.h,v 1.4 2003/04/30 13:10:48 fishwaldo Exp $
*/
@ -54,13 +54,8 @@ struct config {
unsigned int foreground : 1;
} config;
#define GetDir(x, y) kp_get_dir(x,y,NULL);
int GetConf(void **data, int type, const char *item);
int SetConf(void *data, int type, char *item);
/* need this to stop modules complaining */
int kp_get_dir (const char *keypath, char ***keysp, unsigned int *nump);
int GetDir(char *item, char ***data);
#endif

9
dl.c
View file

@ -20,7 +20,7 @@
** USA
**
** NeoStats CVS Identification
** $Id: dl.c,v 1.53 2003/04/18 06:41:34 fishwaldo Exp $
** $Id: dl.c,v 1.54 2003/04/30 13:10:49 fishwaldo Exp $
*/
#include <dlfcn.h>
@ -161,22 +161,21 @@ int add_socket(char *readfunc, char *writefunc, char *errfunc, char *sock_name,
Sock_List *Sockets_mod_list;
strcpy(segv_location, "add_Socket");
if (readfunc) {
if (dlsym((int *)get_dl_handle(mod_name), readfunc) == NULL) {
nlog(LOG_WARNING, LOG_CORE, "oh oh, the socket function doesn't exist");
nlog(LOG_WARNING, LOG_CORE, "oh oh, the Read socket function doesn't exist = %s (%s)", readfunc, mod_name);
return -1;
}
}
if (writefunc) {
if (dlsym((int *)get_dl_handle(mod_name), writefunc) == NULL) {
nlog(LOG_WARNING, LOG_CORE, "oh oh, the socket function doesn't exist");
nlog(LOG_WARNING, LOG_CORE, "oh oh, the Write socket function doesn't exist = %s (%s)", writefunc, mod_name);
return -1;
}
}
if (errfunc) {
if (dlsym((int *)get_dl_handle(mod_name), errfunc) == NULL) {
nlog(LOG_WARNING, LOG_CORE, "oh oh, the socket function doesn't exist");
nlog(LOG_WARNING, LOG_CORE, "oh oh, the Error socket function doesn't exist = %s (%s)", errfunc, mod_name);
return -1;
}
}

View file

@ -20,7 +20,7 @@
** USA
**
** NeoStats CVS Identification
** $Id: keeper.c,v 1.7 2003/04/18 06:41:34 fishwaldo Exp $
** $Id: keeper.c,v 1.8 2003/04/30 13:10:50 fishwaldo Exp $
*/
#include "stats.h"
@ -69,6 +69,30 @@ int GetConf(void **data, int type, const char *item) {
return 1;
}
/* @brief return a array of strings containing all subkeys in a directory */
int GetDir(char *item, char ***data) {
int i;
char keypath[255];
char **data1;
/* determine if its a module setting */
if (strlen(segvinmodule) > 0) {
snprintf(keypath, 255, "g/%s:/%s", segvinmodule, item);
} else {
snprintf(keypath, 255, "g/core:/%s", item);
}
i = kp_get_dir(keypath, &data1, NULL);
if (i == 0) {
*data = data1;
return 1;
}
*data = NULL;
nlog(LOG_DEBUG1, LOG_CORE, "GetDir: %s - Path: %s", kp_strerror(i), keypath);
return -1;
}
/** @brief Sets Config Data of Type

View file

@ -1,6 +1,6 @@
include ../Makefile.inc
INCLUDES = -I.. -I../keeper/ -I../adns/ -DHAVE_CONFIG_H
INCLUDES = -I.. -I../keeper/ -I../adns/ -DHAVE_CONFIG_H -DDST_DIR=@prefix@
KP_SOURCES= kp_exp.c kp_imp.c kptool.c
KP_OBJECTS= kp_exp.o kp_imp.o kptool.o