projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added include stdlib.h a few places to get prototype for atoi/exit/..
[idzebra-moved-to-github.git]
/
recctrl
/
recctrl.c
diff --git
a/recctrl/recctrl.c
b/recctrl/recctrl.c
index
9415233
..
d4f6f2b
100644
(file)
--- a/
recctrl/recctrl.c
+++ b/
recctrl/recctrl.c
@@
-1,6
+1,6
@@
-/* $Id: recctrl.c,v 1.12 2004-09-30 08:30:05 adam Exp $
- Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
- Index Data Aps
+/* $Id: recctrl.c,v 1.17 2005-01-15 19:38:32 adam Exp $
+ Copyright (C) 1995-2005
+ Index Data ApS
This file is part of the Zebra server.
This file is part of the Zebra server.
@@
-24,7
+24,9
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
+#if HAVE_DLFCN_H
#include <dlfcn.h>
#include <dlfcn.h>
+#endif
#include <direntz.h>
#include <zebrautl.h>
#include <direntz.h>
#include <zebrautl.h>
@@
-48,6
+50,9
@@
struct recTypes {
struct recTypeInstance *entries;
};
struct recTypeInstance *entries;
};
+#ifdef IDZEBRA_STATIC_GRS_SGML
+ extern RecType idzebra_filter_grs_sgml[];
+#endif
#ifdef IDZEBRA_STATIC_TEXT
extern RecType idzebra_filter_text[];
#endif
#ifdef IDZEBRA_STATIC_TEXT
extern RecType idzebra_filter_text[];
#endif
@@
-65,6
+70,9
@@
struct recTypes {
#ifdef IDZEBRA_STATIC_GRS_DANBIB
extern RecType idzebra_filter_grs_danbib[];
#endif
#ifdef IDZEBRA_STATIC_GRS_DANBIB
extern RecType idzebra_filter_grs_danbib[];
#endif
+#ifdef IDZEBRA_STATIC_SAFARI
+ extern RecType idzebra_filter_safari[];
+#endif
static void recTypeClass_add (struct recTypeClass **rts, RecType *rt,
NMEM nmem, void *module_handle);
static void recTypeClass_add (struct recTypeClass **rts, RecType *rt,
NMEM nmem, void *module_handle);
@@
-75,8
+83,9
@@
RecTypeClass recTypeClass_create (Res res, NMEM nmem)
const char *module_path = res_get_def(res, "modulePath",
DEFAULT_MODULE_PATH);
const char *module_path = res_get_def(res, "modulePath",
DEFAULT_MODULE_PATH);
- extern RecType idzebra_filter_grs_sgml[];
+#ifdef IDZEBRA_STATIC_GRS_SGML
recTypeClass_add (&rts, idzebra_filter_grs_sgml, nmem, 0);
recTypeClass_add (&rts, idzebra_filter_grs_sgml, nmem, 0);
+#endif
#ifdef IDZEBRA_STATIC_TEXT
recTypeClass_add (&rts, idzebra_filter_text, nmem, 0);
#endif
#ifdef IDZEBRA_STATIC_TEXT
recTypeClass_add (&rts, idzebra_filter_text, nmem, 0);
#endif
@@
-94,11
+103,15
@@
RecTypeClass recTypeClass_create (Res res, NMEM nmem)
#ifdef IDZEBRA_STATIC_GRS_DANBIB
recTypeClass_add (&rts, idzebra_filter_grs_danbib, nmem, 0);
#endif
#ifdef IDZEBRA_STATIC_GRS_DANBIB
recTypeClass_add (&rts, idzebra_filter_grs_danbib, nmem, 0);
#endif
+#ifdef IDZEBRA_STATIC_SAFARI
+ recTypeClass_add (&rts, idzebra_filter_safari, nmem, 0);
+#endif
+#if HAVE_DLFCN_H
if (module_path)
{
DIR *dir = opendir(module_path);
if (module_path)
{
DIR *dir = opendir(module_path);
- yaz_log(LOG_LOG, "searching filters in %s", module_path);
+ yaz_log(YLOG_LOG, "searching filters in %s", module_path);
if (dir)
{
struct dirent *de;
if (dir)
{
struct dirent *de;
@@
-118,20
+131,20
@@
RecTypeClass recTypeClass_create (Res res, NMEM nmem)
mod_p = dlopen(fname, RTLD_NOW|RTLD_GLOBAL);
if (mod_p && (fl = dlsym(mod_p, "idzebra_filter")))
{
mod_p = dlopen(fname, RTLD_NOW|RTLD_GLOBAL);
if (mod_p && (fl = dlsym(mod_p, "idzebra_filter")))
{
- yaz_log(LOG_LOG, "Loaded filter module %s", fname);
+ yaz_log(YLOG_LOG, "Loaded filter module %s", fname);
recTypeClass_add(&rts, fl, nmem, mod_p);
}
else if (mod_p)
{
const char *err = dlerror();
recTypeClass_add(&rts, fl, nmem, mod_p);
}
else if (mod_p)
{
const char *err = dlerror();
- yaz_log(LOG_WARN, "dlsym failed %s %s",
+ yaz_log(YLOG_WARN, "dlsym failed %s %s",
fname, err ? err : "none");
dlclose(mod_p);
}
else
{
const char *err = dlerror();
fname, err ? err : "none");
dlclose(mod_p);
}
else
{
const char *err = dlerror();
- yaz_log(LOG_WARN, "dlopen failed %s %s",
+ yaz_log(YLOG_WARN, "dlopen failed %s %s",
fname, err ? err : "none");
}
fname, err ? err : "none");
}
@@
-140,6
+153,7
@@
RecTypeClass recTypeClass_create (Res res, NMEM nmem)
closedir(dir);
}
}
closedir(dir);
}
}
+#endif
return rts;
}
return rts;
}
@@
-154,7
+168,7
@@
static void recTypeClass_add (struct recTypeClass **rts, RecType *rt,
r->next = *rts;
*rts = r;
r->next = *rts;
*rts = r;
- yaz_log(LOG_LOG, "Adding filter %s", (*rt)->name);
+ yaz_log(YLOG_LOG, "Adding filter %s", (*rt)->name);
r->module_handle = module_handle;
module_handle = 0; /* so that we only store module_handle once */
r->recType = *rt;
r->module_handle = module_handle;
module_handle = 0; /* so that we only store module_handle once */
r->recType = *rt;
@@
-174,8
+188,10
@@
void recTypeClass_destroy(RecTypeClass rtc)
{
for (; rtc; rtc = rtc->next)
{
{
for (; rtc; rtc = rtc->next)
{
+#if HAVE_DLFCN_H
if (rtc->module_handle)
dlclose(rtc->module_handle);
if (rtc->module_handle)
dlclose(rtc->module_handle);
+#endif
}
}
}
}