lcDynamic.c revision 1ab64890
1/* $Xorg: lcDynamic.c,v 1.4 2001/02/09 02:03:39 xorgcvs Exp $ */
2/*
3Copyright 1996, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included
12in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the name of The Open Group shall
23not be used in advertising or otherwise to promote the sale, use or
24other dealings in this Software without prior written authorization
25from The Open Group.
26*/
27/*
28 * Copyright 1995 by FUJITSU LIMITED
29 * This is source code modified by FUJITSU LIMITED under the Joint
30 * Development Agreement for the CDE/Motif PST.
31 *
32 * Modifier: Takanori Tateno   FUJITSU LIMITED
33 *
34 */
35/* $XFree86: xc/lib/X11/lcDynamic.c,v 1.4 2001/01/17 19:41:53 dawes Exp $ */
36
37/*
38 * A dynamically loaded locale.
39 * Supports: All locale names.
40 * How: Loads $(XLOCALEDIR)/xi18n.so and forwards the request to that library.
41 * Platforms: Only those defining USE_DYNAMIC_LOADER (none known).
42 */
43
44#ifdef USE_DYNAMIC_LOADER
45#ifdef HAVE_CONFIG_H
46#include <config.h>
47#endif
48#include <stdio.h>
49#include <string.h>
50#include <dlfcn.h>
51
52#include "Xlibint.h"
53#include "Xlcint.h"
54
55#ifndef XLOCALEDIR
56#define XLOCALEDIR "/usr/lib/X11/locale"
57#endif
58
59#define LCLIBNAME    "xi18n.so"
60
61XLCd
62_XlcDynamicLoader(
63    const char *name)
64{
65    char libpath[1024];
66    XLCdMethods _XlcGenericMethods;
67    XLCd lcd;
68    void *nlshandler;
69
70    sprintf(libpath,"%s/%s/%s",
71		XLOCALEDIR,name,LCLIBNAME);
72    nlshandler = dlopen(libpath,LAZY);
73    _XlcGenericMethods = (XLCdMethods)dlsym(nlshandler,"genericMethods");
74    lcd = _XlcCreateLC(name,_XlcGenericMethods);
75
76    return lcd;
77}
78#else
79typedef int dummy;
80#endif /* USE_DYNAMIC_LOADER */
81