[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.9 and 1.10

version 1.9, 2001/12/25 02:39:06 version 1.10, 2004/03/02 07:44:02
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.8 2001/10/09 01:36:24 noro Exp $   * $OpenXM: OpenXM_contrib2/asir2000/parse/load.c,v 1.9 2001/12/25 02:39:06 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
Line 95  char *ASIRLOADPATH[32];
Line 95  char *ASIRLOADPATH[32];
   
 char *getenv();  char *getenv();
 void Pget_rootdir();  void Pget_rootdir();
   char *search_executable(char *name);
   
 extern char *asir_libdir;  extern char *asir_libdir;
 extern char *asir_pager;  extern char *asir_pager;
Line 102  extern int read_exec_file;
Line 103  extern int read_exec_file;
 extern int main_parser;  extern int main_parser;
 extern JMP_BUF exec_env;  extern JMP_BUF exec_env;
   
   char *search_executable(char *name)
   {
           char *c,*s,*ret;
           int len;
           char dir[BUFSIZ],path[BUFSIZ];
           struct stat buf;
   
           for ( s = (char *)getenv("PATH"); s; ) {
                   c = (char *)index(s,':');
                   if ( c ) {
                           len = c-s;
                           strncpy(dir,s,len); s = c+1; dir[len] = 0;
                   } else {
                           strcpy(dir,s); s = 0;
                   }
                   sprintf(path,"%s/%s",dir,name);
                   if ( !stat(path,&buf) && !(buf.st_mode & S_IFDIR)
                           && !access(path,X_OK) ) {
                           len = strlen(path)+1;
                           ret = (char *)MALLOC(len);
                           strcpy(ret,path);
                           return ret;
                   }
           }
           return 0;
   }
   
 void env_init() {  void env_init() {
         char *e,*p,*q;          char *e,*p,*q;
         int i,l;          int i,l,japanese;
         char *getenv();          char *getenv();
         char *oxhome;          char *oxhome;
         char rootname[BUFSIZ];          char rootname[BUFSIZ];
Line 125  void env_init() {
Line 153  void env_init() {
                 }                  }
         }          }
         if ( !(asir_pager = getenv("PAGER")) ) {          if ( !(asir_pager = getenv("PAGER")) ) {
                 asir_pager = (char *)malloc(strlen(MORE)+1);                  japanese = 0;
                 strcpy(asir_pager,MORE);                  if ( (e = getenv("LANGUAGE")) && strstr(e,"ja") ) japanese = 1;
                   else if ( (e = getenv("LC_ALL")) && strstr(e,"ja") ) japanese = 1;
                   else if ( (e = getenv("LC_CTYPE")) && strstr(e,"ja") ) japanese = 1;
                   else if ( (e = getenv("LANG")) && strstr(e,"ja") ) japanese = 1;
                   if ( japanese )
                           asir_pager = search_executable("jless");
                   if ( !asir_pager ) {
                           /* default: more */
                           asir_pager = (char *)malloc(strlen(MORE)+1);
                           strcpy(asir_pager,MORE);
                   }
         }          }
         if ( e = getenv("ASIRLOADPATH" ) )          if ( e = getenv("ASIRLOADPATH" ) )
                 for ( i = 0; ; i++, e = p+1 ) {                  for ( i = 0; ; i++, e = p+1 ) {

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

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