58 static bool mod_ok =
FALSE;
61 static void close_all_modules(
void);
67 #define MOD_INFO(mod, minfo) \ 69 ZE_MessageInfo(9, " * Register info"); \ 70 ZE_MessageInfo(9, " NAME : %s\n", mod->name); \ 71 ZE_MessageInfo(9, " NAME : %s\n", mod->fname); \ 72 ZE_MessageInfo(9, " ARGS : %s\n", STRNULL(mod->args, "NO ARGS")); \ 73 ZE_MessageInfo(9, " ENABLE : %s\n", STRBOOL(mod->enable, "YES", "NO")); \ 74 ZE_MessageInfo(9, " CALLBACKS : %08X\n", mod->callbacks); \ 75 ZE_MessageInfo(9, " * Module info"); \ 76 ZE_MessageInfo(9, " NAME : %s\n", minfo->name); \ 77 ZE_MessageInfo(9, " AUTHOR : %s\n", minfo->author); \ 78 ZE_MessageInfo(9, " VERSION : %s\n", minfo->version); \ 87 load_module(modp, fname, modsys)
101 handle = dlopen(path, RTLD_LAZY);
102 if (handle == NULL) {
113 fp = dlsym(handle, fn);
114 if ((error = dlerror()) == NULL)
121 fp = dlsym(handle, fn);
122 if ((error = dlerror()) == NULL)
129 fp = dlsym(handle, fn);
130 if ((error = dlerror()) == NULL)
137 fp = dlsym(handle, fn);
138 if ((error = dlerror()) == NULL)
145 fp = dlsym(handle, fn);
146 if ((error = dlerror()) == NULL)
152 if (modp->finit != NULL)
155 modp->handle = handle;
163 read_mod_cf_line(line, arg)
182 memset(argv, 0,
sizeof (argv));
184 for (i = 0; i < argc; i++) {
207 strlcpy(buf, argv[i],
sizeof (buf));
208 memset(cargv, 0,
sizeof (cargv));
210 for (j = 0; j < cargc; j++) {
275 if (fname != NULL && name != NULL) {
279 for (i = 0; i <
NMOD; i++) {
280 if (modules[i].fname == NULL)
286 if (i < NMOD && modules[i].name == NULL) {
290 if (load_module(&modules[i], fname, modsys)) {
292 modules[i].
name = strdup(name);
293 modules[i].
fname = strdup(fname);
295 modules[i].
args = strdup(args);
302 modules[i].
enable = enable && (callbacks != 0);
330 memset(&modsys, 0,
sizeof (modsys));
333 atexit(close_all_modules);
349 close_all_modules(
void)
354 for (i = 0; i <
NMOD; i++) {
385 for (i = 0; i <
NMOD; i++) {
394 if (m->
finfo == NULL)
397 memset(&info, 0,
sizeof (info));
400 if ((*m->
finfo) (&info)) {
431 for (i = 0; i <
NMOD; i++) {
453 if (m->
fcall == NULL)
457 if ((*m->
fcall) (callback, step, mctx)) {
494 for (i = 0; i <
NMOD; i++) {
bool(* MOD_SERVICE_F)(int)
int zm_RdFile(char *fname, char *tag, RDFILE_F f, void *arg)
bool(* MOD_INFO_F)(mod_info_T *)
bool module_service(int why)
bool load_all_modules(char *cfdir, char *modcf, char *moddir)
bool module_call(int callback, int step, mod_ctx_T *mctx)
#define ADJUST_FILENAME(path, fname, cfdir, defval)
bool zeStrRegex(char *, char *, long *, long *, bool)
int zeStr2Tokens(char *, int, char **, char *)
int(* RDFILE_F)(void *, void *)
Error dont have limits h nor values h typedef int bool
#define ZE_MessageInfo(level,...)
#define ZE_LogSysError(...)
#define CALLBACK_LABEL(i)
#define STRCASEEQUAL(a, b)
bool(* MOD_INIT_F)(int, mod_open_T *)
bool(* MOD_CALL_F)(int, int, mod_ctx_T *)