11ab64890Smrg/*
21ab64890SmrgCopyright 1996, 1998  The Open Group
31ab64890Smrg
41ab64890SmrgPermission to use, copy, modify, distribute, and sell this software and its
51ab64890Smrgdocumentation for any purpose is hereby granted without fee, provided that
61ab64890Smrgthe above copyright notice appear in all copies and that both that
71ab64890Smrgcopyright notice and this permission notice appear in supporting
81ab64890Smrgdocumentation.
91ab64890Smrg
101ab64890SmrgThe above copyright notice and this permission notice shall be included
111ab64890Smrgin all copies or substantial portions of the Software.
121ab64890Smrg
131ab64890SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
141ab64890SmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
151ab64890SmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
161ab64890SmrgIN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
171ab64890SmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
181ab64890SmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
191ab64890SmrgOTHER DEALINGS IN THE SOFTWARE.
201ab64890Smrg
211ab64890SmrgExcept as contained in this notice, the name of The Open Group shall
221ab64890Smrgnot be used in advertising or otherwise to promote the sale, use or
231ab64890Smrgother dealings in this Software without prior written authorization
241ab64890Smrgfrom The Open Group.
251ab64890Smrg*/
261ab64890Smrg/*
271ab64890Smrg * Copyright 1995 by FUJITSU LIMITED
281ab64890Smrg * This is source code modified by FUJITSU LIMITED under the Joint
291ab64890Smrg * Development Agreement for the CDE/Motif PST.
301ab64890Smrg *
311ab64890Smrg * Modifier: Takanori Tateno   FUJITSU LIMITED
321ab64890Smrg *
331ab64890Smrg */
341ab64890Smrg
351ab64890Smrg/*
361ab64890Smrg * A dynamically loaded locale.
371ab64890Smrg * Supports: All locale names.
381ab64890Smrg * How: Loads $(XLOCALEDIR)/xi18n.so and forwards the request to that library.
391ab64890Smrg * Platforms: Only those defining USE_DYNAMIC_LOADER (none known).
401ab64890Smrg */
411ab64890Smrg
421ab64890Smrg#ifdef USE_DYNAMIC_LOADER
431ab64890Smrg#ifdef HAVE_CONFIG_H
441ab64890Smrg#include <config.h>
451ab64890Smrg#endif
461ab64890Smrg#include <stdio.h>
471ab64890Smrg#include <string.h>
481ab64890Smrg#include <dlfcn.h>
491ab64890Smrg
501ab64890Smrg#include "Xlibint.h"
511ab64890Smrg#include "Xlcint.h"
521ab64890Smrg
531ab64890Smrg#ifndef XLOCALEDIR
541ab64890Smrg#define XLOCALEDIR "/usr/lib/X11/locale"
551ab64890Smrg#endif
561ab64890Smrg
571ab64890Smrg#define LCLIBNAME    "xi18n.so"
581ab64890Smrg
591ab64890SmrgXLCd
601ab64890Smrg_XlcDynamicLoader(
611ab64890Smrg    const char *name)
621ab64890Smrg{
631ab64890Smrg    char libpath[1024];
641ab64890Smrg    XLCdMethods _XlcGenericMethods;
651ab64890Smrg    XLCd lcd;
661ab64890Smrg    void *nlshandler;
671ab64890Smrg
68818534a1Smrg    snprintf(libpath, sizeof(libpath), "%s/%s/%s",
69818534a1Smrg	     XLOCALEDIR, name, LCLIBNAME);
701ab64890Smrg    nlshandler = dlopen(libpath,LAZY);
711ab64890Smrg    _XlcGenericMethods = (XLCdMethods)dlsym(nlshandler,"genericMethods");
721ab64890Smrg    lcd = _XlcCreateLC(name,_XlcGenericMethods);
731ab64890Smrg
741ab64890Smrg    return lcd;
751ab64890Smrg}
761ab64890Smrg#else
771ab64890Smrgtypedef int dummy;
781ab64890Smrg#endif /* USE_DYNAMIC_LOADER */
79