=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/parse/load.c,v retrieving revision 1.14 retrieving revision 1.17 diff -u -p -r1.14 -r1.17 --- OpenXM_contrib2/asir2000/parse/load.c 2004/03/18 01:59:41 1.14 +++ OpenXM_contrib2/asir2000/parse/load.c 2005/03/24 23:40:50 1.17 @@ -45,7 +45,7 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/parse/load.c,v 1.13 2004/03/05 08:45:49 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/parse/load.c,v 1.16 2005/03/24 22:54:22 takayama Exp $ */ #include "ca.h" #include "parse.h" @@ -79,7 +79,7 @@ #define MALLOC(x) GC_malloc((x)+4) #endif -char *ASIRLOADPATH[32]; +char **ASIRLOADPATH; #if defined(VISUAL) #define ENVDELIM ';' @@ -90,14 +90,18 @@ char *ASIRLOADPATH[32]; #endif #ifndef ASIR_LIBDIR -#define ASIR_LIBDIR "." +#define ASIR_LIBDIR "/usr/local/lib/asir" #endif +#ifndef ASIR_CONTRIB_DIR +#define ASIR_CONTRIB_DIR "/usr/local/lib/asir-contrib" +#endif char *getenv(); void Pget_rootdir(); char *search_executable(char *name); extern char *asir_libdir; +extern char *asir_contrib_dir; extern char *asir_pager; extern int read_exec_file; extern int main_parser; @@ -149,13 +153,29 @@ void env_init() { #if defined(VISUAL) get_rootdir(rootname,sizeof(rootname)); asir_libdir = (char *)malloc(strlen(rootname)+strlen("/lib")+1); - sprintf(asir_libdir,"%s/lib",rootname); #else asir_libdir = (char *)malloc(strlen(ASIR_LIBDIR)+1); strcpy(asir_libdir,ASIR_LIBDIR); #endif } } + + if ( !(asir_contrib_dir = getenv("ASIR_CONTRIB_DIR")) ) { + if ( oxhome = getenv("OpenXM_HOME") ) { + asir_contrib_dir = (char *)malloc(strlen(oxhome)+strlen("/lib/asir-contrib")+1); + sprintf(asir_contrib_dir,"%s/lib/asir-contrib",oxhome); + } else { +#if defined(VISUAL) + get_rootdir(rootname,sizeof(rootname)); + asir_contrib_dir = (char *)malloc(strlen(rootname)+strlen("/lib-asir-contrib")+1); + sprintf(asir_contrib_dir,"%s/lib-asir-contrib",rootname); +#else + asir_contrib_dir = (char *)malloc(strlen(ASIR_CONTRIB_DIR)+1); + strcpy(asir_contrib_dir,ASIR_CONTRIB_DIR); +#endif + } + } + if ( !(asir_pager = getenv("PAGER")) ) { japanese = 0; if ( (e = getenv("LANGUAGE")) && @@ -174,9 +194,18 @@ void env_init() { strcpy(asir_pager,MORE); } } - if ( e = getenv("ASIRLOADPATH" ) ) + if ( e = getenv("ASIRLOADPATH" ) ) { for ( i = 0; ; i++, e = p+1 ) { p = (char *)index(e,ENVDELIM); + if ( !p ) + break; + } + i += 4; + ASIRLOADPATH=(char **)MALLOC(sizeof(char *)*i); + for ( l = 0; l