=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/parse/load.c,v retrieving revision 1.28 retrieving revision 1.32 diff -u -p -r1.28 -r1.32 --- OpenXM_contrib2/asir2000/parse/load.c 2015/08/06 10:01:53 1.28 +++ OpenXM_contrib2/asir2000/parse/load.c 2017/02/07 08:30:31 1.32 @@ -45,12 +45,12 @@ * 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.27 2014/05/12 02:35:36 ohara Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/parse/load.c,v 1.31 2016/08/30 02:29:11 noro Exp $ */ #include "ca.h" #include "parse.h" -#if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__) +#if defined(VISUAL) || defined(__MINGW32__) #include #include #include @@ -70,7 +70,7 @@ #include #endif -#if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__) +#if defined(VISUAL) || defined(__MINGW32__) #include #endif @@ -82,7 +82,7 @@ char **ASIRLOADPATH; int ASIRLOADPATH_LEN; -#if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__) +#if defined(VISUAL) || defined(__MINGW32__) #define ENVDELIM ';' #define MORE "more < " #else @@ -126,7 +126,7 @@ char *search_executable(char *name) if ( len+nlen+1 >= BUFSIZ ) continue; sprintf(path,"%s/%s",dir,name); if ( !stat(path,&buf) && !(buf.st_mode & S_IFDIR) -#if !defined(VISUAL) && !defined(__MINGW32__) && !defined(__MINGW64__) +#if !defined(VISUAL) && !defined(__MINGW32__) && !access(path,X_OK) #endif ) { @@ -150,7 +150,7 @@ void env_init() { if ( oxhome = getenv("OpenXM_HOME") ) { len = strlen(oxhome); }else { -#if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__) +#if defined(VISUAL) || defined(__MINGW32__) get_rootdir(rootname,sizeof(rootname)); len = strlen(rootname); oxhome = rootname; @@ -178,7 +178,7 @@ void env_init() { } asir_private_dir = NULL; -#if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__) +#if defined(VISUAL) || defined(__MINGW32__) if ( e = getenv("APPDATA") ) { asir_private_dir = (char *)malloc(strlen(e)+strlen("/OpenXM/lib/asir-contrib")+1); sprintf(asir_private_dir,"%s/OpenXM/lib/asir-contrib",e); @@ -186,6 +186,7 @@ void env_init() { #endif if ( !(asir_pager = getenv("PAGER")) ) { +#if 0 japanese = 0; if ( (e = getenv("LANGUAGE")) && (!strncmp(e,"japan",5) || !strncmp(e,"ja_JP",5)) ) japanese = 1; @@ -197,6 +198,8 @@ void env_init() { (!strncmp(e,"japan",5) || !strncmp(e,"ja_JP",5)) ) japanese = 1; if ( japanese ) asir_pager = search_executable("jless"); +#endif + asir_pager = search_executable("less"); if ( !asir_pager ) { /* default: more */ asir_pager = (char *)malloc(strlen(MORE)+1); @@ -236,7 +239,7 @@ void env_init() { ASIRLOADPATH[i] = NULL; } -#if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__) +#if defined(VISUAL) || defined(__MINGW32__) #define R_OK 4 #endif @@ -281,7 +284,7 @@ void loadasirfile(char *name0) FILE *in; INFILE t; extern char cppname[]; -#if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__) +#if defined(VISUAL) || defined(__MINGW32__) char ibuf1[BUFSIZ],ibuf2[BUFSIZ]; int ac; char *av[BUFSIZ]; @@ -366,7 +369,7 @@ void loadasirfile(char *name0) #else char com[BUFSIZ]; - sprintf(com,"%s -I%s %s",cppname,asir_libdir,name0); in = popen(com,"r"); + sprintf(com,"%s -I%s -D__FILE__=%s %s",cppname,asir_libdir,name0,name0); in = popen(com,"r"); if ( !in ) { perror("popen"); error("load : failed"); @@ -378,7 +381,7 @@ void loadasirfile(char *name0) main_parser = 1; /* XXX */ Eungetc(afternl(),asir_infile->fp); if ( !EPVS->va ) - reallocarray((char **)&EPVS->va,(int *)&EPVS->asize,(int *)&EPVS->n,(int)sizeof(struct oPV)); + asir_reallocarray((char **)&EPVS->va,(int *)&EPVS->asize,(int *)&EPVS->n,(int)sizeof(struct oPV)); } void execasirfile(char *name)