[BACK]Return to load.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / parse

Diff for /OpenXM_contrib2/asir2000/parse/load.c between version 1.28 and 1.32

version 1.28, 2015/08/06 10:01:53 version 1.32, 2017/02/07 08:30:31
Line 45 
Line 45 
  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,   * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.   * 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 "ca.h"
 #include "parse.h"  #include "parse.h"
   
 #if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__)  #if defined(VISUAL) || defined(__MINGW32__)
 #include <string.h>  #include <string.h>
 #include <fcntl.h>  #include <fcntl.h>
 #include <sys/stat.h>  #include <sys/stat.h>
Line 70 
Line 70 
 #include <unistd.h>  #include <unistd.h>
 #endif  #endif
   
 #if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__)  #if defined(VISUAL) || defined(__MINGW32__)
 #include <io.h>  #include <io.h>
 #endif  #endif
   
Line 82 
Line 82 
 char **ASIRLOADPATH;  char **ASIRLOADPATH;
 int ASIRLOADPATH_LEN;  int ASIRLOADPATH_LEN;
   
 #if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__)  #if defined(VISUAL) || defined(__MINGW32__)
 #define ENVDELIM ';'  #define ENVDELIM ';'
 #define MORE "more < "  #define MORE "more < "
 #else  #else
Line 126  char *search_executable(char *name)
Line 126  char *search_executable(char *name)
                 if ( len+nlen+1 >= BUFSIZ ) continue;                  if ( len+nlen+1 >= BUFSIZ ) continue;
                 sprintf(path,"%s/%s",dir,name);                  sprintf(path,"%s/%s",dir,name);
                 if ( !stat(path,&buf) && !(buf.st_mode & S_IFDIR)                  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)                          && !access(path,X_OK)
 #endif  #endif
                 ) {                  ) {
Line 150  void env_init() {
Line 150  void env_init() {
         if ( oxhome = getenv("OpenXM_HOME") ) {          if ( oxhome = getenv("OpenXM_HOME") ) {
                 len = strlen(oxhome);                  len = strlen(oxhome);
         }else {          }else {
 #if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__)  #if defined(VISUAL) || defined(__MINGW32__)
                 get_rootdir(rootname,sizeof(rootname));                  get_rootdir(rootname,sizeof(rootname));
                 len = strlen(rootname);                  len = strlen(rootname);
                 oxhome = rootname;                  oxhome = rootname;
Line 178  void env_init() {
Line 178  void env_init() {
         }          }
   
     asir_private_dir = NULL;      asir_private_dir = NULL;
 #if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__)  #if defined(VISUAL) || defined(__MINGW32__)
     if ( e = getenv("APPDATA") ) {      if ( e = getenv("APPDATA") ) {
         asir_private_dir = (char *)malloc(strlen(e)+strlen("/OpenXM/lib/asir-contrib")+1);          asir_private_dir = (char *)malloc(strlen(e)+strlen("/OpenXM/lib/asir-contrib")+1);
         sprintf(asir_private_dir,"%s/OpenXM/lib/asir-contrib",e);          sprintf(asir_private_dir,"%s/OpenXM/lib/asir-contrib",e);
Line 186  void env_init() {
Line 186  void env_init() {
 #endif  #endif
   
         if ( !(asir_pager = getenv("PAGER")) ) {          if ( !(asir_pager = getenv("PAGER")) ) {
   #if 0
                 japanese = 0;                  japanese = 0;
                 if ( (e = getenv("LANGUAGE")) &&                  if ( (e = getenv("LANGUAGE")) &&
                         (!strncmp(e,"japan",5) || !strncmp(e,"ja_JP",5)) ) japanese = 1;                          (!strncmp(e,"japan",5) || !strncmp(e,"ja_JP",5)) ) japanese = 1;
Line 197  void env_init() {
Line 198  void env_init() {
                         (!strncmp(e,"japan",5) || !strncmp(e,"ja_JP",5)) ) japanese = 1;                          (!strncmp(e,"japan",5) || !strncmp(e,"ja_JP",5)) ) japanese = 1;
                 if ( japanese )                  if ( japanese )
                         asir_pager = search_executable("jless");                          asir_pager = search_executable("jless");
   #endif
                   asir_pager = search_executable("less");
                 if ( !asir_pager ) {                  if ( !asir_pager ) {
                         /* default: more */                          /* default: more */
                         asir_pager = (char *)malloc(strlen(MORE)+1);                          asir_pager = (char *)malloc(strlen(MORE)+1);
Line 236  void env_init() {
Line 239  void env_init() {
         ASIRLOADPATH[i] = NULL;          ASIRLOADPATH[i] = NULL;
 }  }
   
 #if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__)  #if defined(VISUAL) || defined(__MINGW32__)
 #define R_OK 4  #define R_OK 4
 #endif  #endif
   
Line 281  void loadasirfile(char *name0)
Line 284  void loadasirfile(char *name0)
         FILE *in;          FILE *in;
         INFILE t;          INFILE t;
         extern char cppname[];          extern char cppname[];
 #if defined(VISUAL) || defined(__MINGW32__) || defined(__MINGW64__)  #if defined(VISUAL) || defined(__MINGW32__)
         char ibuf1[BUFSIZ],ibuf2[BUFSIZ];          char ibuf1[BUFSIZ],ibuf2[BUFSIZ];
         int ac;          int ac;
         char *av[BUFSIZ];          char *av[BUFSIZ];
Line 366  void loadasirfile(char *name0)
Line 369  void loadasirfile(char *name0)
 #else  #else
         char com[BUFSIZ];          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 ) {          if ( !in ) {
                 perror("popen");                  perror("popen");
                 error("load : failed");                  error("load : failed");
Line 378  void loadasirfile(char *name0)
Line 381  void loadasirfile(char *name0)
         main_parser = 1; /* XXX */          main_parser = 1; /* XXX */
         Eungetc(afternl(),asir_infile->fp);          Eungetc(afternl(),asir_infile->fp);
         if ( !EPVS->va )          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)  void execasirfile(char *name)

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.32

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>