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