示例#1
0
dict_mkmap_func_t dict_mkmap_func(const char *dict_type)
{
    char   *myname="dict_mkmap_func";
    struct stat st;
    LIB_FN fn[2];
    dict_mkmap_func_t mkmap;
    DLINFO *dl;
#ifndef NO_DYNAMIC_MAPS
    if (!dict_dlinfo)
	msg_fatal("dlinfo==NULL");
    dl=dict_open_dlfind(dict_type);
    if (!dl)
	msg_fatal("%s: unsupported dictionary type: %s:  Is the postfix-%s package installed?", myname, dict_type, dict_type);
    if (stat(dl->soname,&st) < 0) {
	msg_fatal("%s: unsupported dictionary type: %s (%s not found.  Is the postfix-%s package installed?)",
	    myname, dict_type, dl->soname, dict_type);
    }
    if (!dl->mkmapfunc)
	msg_fatal("%s: unsupported dictionary type: %s does not allow map creation.", myname, dict_type);

    fn[0].name = dl->mkmapfunc;
    fn[0].ptr  = (void**)&mkmap;
    fn[1].name = NULL;
    load_library_symbols(dl->soname, fn, NULL);
    return mkmap;
#else
    return (void(*)())NULL;
#endif
}
示例#2
0
DICT   *dict_open3(const char *dict_type, const char *dict_name,
		           int open_flags, int dict_flags)
{
    const char *myname = "dict_open";
    DICT_OPEN_INFO *dp;
    DICT   *dict;

    if (*dict_type == 0 || *dict_name == 0)
	msg_fatal("open dictionary: expecting \"type:name\" form instead of \"%s:%s\"",
		  dict_type, dict_name);
    if (dict_open_hash == 0)
	dict_open_init();
    if ((dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type)) == 0) {
#ifdef NO_DYNAMIC_MAPS
	msg_fatal("%s: unsupported dictionary type: %s", myname, dict_type);
#else
	struct stat st;
	LIB_FN fn[2];
	DICT *(*open) (const char *, int, int);
	DLINFO *dl=dict_open_dlfind(dict_type);
	if (!dl)
	    msg_fatal("%s: unsupported dictionary type: %s:  Is the postfix-%s package installed?", myname, dict_type, dict_type);
	if (stat(dl->soname,&st) < 0) {
	    msg_fatal("%s: unsupported dictionary type: %s (%s not found.  Is the postfix-%s package installed?)",
		myname, dict_type, dl->soname, dict_type);
	}
	fn[0].name = dl->openfunc;
	fn[0].ptr  = (void**)&open;
	fn[1].name = NULL;
	load_library_symbols(dl->soname, fn, NULL);
	dict_open_register(dict_type, open);
	dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type);
#endif
    }
    if (msg_verbose>1) {
	msg_info("%s: calling %s open routine",myname,dict_type);
    }
    if ((dict = dp->open(dict_name, open_flags, dict_flags)) == 0)
	msg_fatal("opening %s:%s %m", dict_type, dict_name);
    if (msg_verbose)
	msg_info("%s: %s:%s", myname, dict_type, dict_name);
    return (dict);
}
示例#3
0
static void spyglass_init(void)
{
  /*printf("using gluray\n");*/

    static int done = 0;

    if (!done)
    {
        init_fifos();
        /*printf("load_lib_sym\n");*/
        load_library_symbols();
        /*printf("done load_lib_sym\n");*/
#if defined(LINK_ENUMS_HACK)
        link_enums();
#endif
        done = 1;
    }
    /*printf("done gluray_init\n");*/
}