[BACK]Return to oxf_old.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / ox_toolkit

Diff for /OpenXM/src/ox_toolkit/oxf_old.c between version 1.4 and 1.9

version 1.4, 2002/04/10 08:55:45 version 1.9, 2015/08/27 03:03:34
Line 1 
Line 1 
 /* -*- mode: C; coding: euc-japan -*- */  /* -*- mode: C; coding: euc-japan -*- */
 /* $OpenXM: OpenXM/src/ox_toolkit/oxf_old.c,v 1.3 2002/04/09 09:40:37 ohara Exp $ */  /* $OpenXM: OpenXM/src/ox_toolkit/oxf_old.c,v 1.8 2009/03/20 18:41:16 iwane Exp $ */
   
 /* このモジュールは互換性のためのものです。*/  /* このモジュールは互換性のためのものです。*/
   
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
 #include <unistd.h>  
 #include <fcntl.h>  #include <fcntl.h>
   #include <time.h>
   
   #if defined(_MSC_VER) || defined(__MINGW32__)
   #include <io.h>
   #define MAXHOSTNAMELEN 256
   #else
   #include <unistd.h>
 #include <sys/file.h>  #include <sys/file.h>
 #include <sys/param.h>  #include <sys/param.h>
 #include <time.h>  #endif
   
 #if defined(__sun__)  #if defined(__sun__)
 #include <netdb.h>  #include <netdb.h>
Line 27  OXFILE *oxf_control_set(OXFILE *oxfp, OXFILE *ctl)
Line 33  OXFILE *oxf_control_set(OXFILE *oxfp, OXFILE *ctl)
         return oxfp;          return oxfp;
 }  }
   
   static char *OpenXM_HOME = "/usr/local/OpenXM";
 static char *concat_openxm_home_bin(char *s);  static char *concat_openxm_home_bin(char *s);
   
 OXFILE *         ox_start(char* host, char* prog1, char* prog2);  OXFILE *         ox_start(char* host, char* prog1, char* prog2);
Line 82  static OXFILE *mysocketAccept2(int listened, char *pas
Line 89  static OXFILE *mysocketAccept2(int listened, char *pas
 static char *concat_openxm_home_bin(char *s)  static char *concat_openxm_home_bin(char *s)
 {  {
     char *path;      char *path;
     char *base;  
   
     /* if s includes '/' then it is not concaticated. */      /* if s includes '/' then it is not concaticated. */
     if (strchr(s, '/') != NULL) {      if (strchr(s, '/') != NULL) {
         return s;          return s;
     }      }
   
     base = getenv("OpenXM_HOME");      path = MALLOC(strlen(OpenXM_HOME)+6+strlen(s));
     path = malloc(strlen(base)+6+strlen(s));      sprintf(path, "%s/bin/%s", OpenXM_HOME, s);
     sprintf(path, "%s/bin/%s", base, s);  
     return path;      return path;
 }  }
   
 void set_OpenXM_HOME()  void set_OpenXM_HOME()
 {  {
     /* Solaris does not have the setenv(). */          char *e;
     if (getenv("OpenXM_HOME") == NULL) {          if ((e = getenv("OpenXM_HOME")) != NULL
         putenv("OpenXM_HOME=/usr/local/OpenXM");  #if defined(__CYGWIN__)
                   || (e = getenv("OPENXM_HOME")) != NULL
   #endif
                   ) {
                   OpenXM_HOME = e;
     }      }
 }  }
   
Line 108  void ox_exec_local(char* ctl_prog, char* dat_prog, int
Line 117  void ox_exec_local(char* ctl_prog, char* dat_prog, int
     char  ctl[128], dat[128];      char  ctl[128], dat[128];
     char localhost[MAXHOSTNAMELEN];      char localhost[MAXHOSTNAMELEN];
   
   
     sprintf(ctl, "%d", portControl);      sprintf(ctl, "%d", portControl);
     sprintf(dat, "%d", portStream);      sprintf(dat, "%d", portStream);
   
Line 141  OXFILE *ox_start(char* host, char* ctl_prog, char* dat
Line 149  OXFILE *ox_start(char* host, char* ctl_prog, char* dat
     OXFILE *st, *ct;      OXFILE *st, *ct;
     char *passwd = generate_otp();      char *passwd = generate_otp();
     int   listen[2];      int   listen[2];
     int   ports[2] = {0};  /* short! */      int   ports[2] = {0};
   
         /* host を無視 */          /* host を無視 */
     listen[0] = oxf_listen(&ports[0]);      listen[0] = oxf_listen(&ports[0]);
Line 184  OXFILE *ox_start_insecure(char* host, short portContro
Line 192  OXFILE *ox_start_insecure(char* host, short portContro
 /* ssh -f host oxlog xterm -e ox -ox ox_asir ... */  /* ssh -f host oxlog xterm -e ox -ox ox_asir ... */
 void ssh_ox_server(char *remote_host, char *ctl_prog, char *dat_prog, short portControl, short portStream)  void ssh_ox_server(char *remote_host, char *ctl_prog, char *dat_prog, short portControl, short portStream)
 {  {
       char buf[2][10];
   /*
     ctl_prog = concat_openxm_home_bin(ctl_prog);      ctl_prog = concat_openxm_home_bin(ctl_prog);
     dat_prog = concat_openxm_home_bin(dat_prog);      dat_prog = concat_openxm_home_bin(dat_prog);
   */
   
     if (fork() == 0) {      if (fork() == 0) {
   
           sprintf(buf[0], "%hd", portStream);
           sprintf(buf[1], "%hd", portControl);
   
         execlp("ssh", "ssh", "-f", remote_host, "oxlog", "xterm", "-icon",          execlp("ssh", "ssh", "-f", remote_host, "oxlog", "xterm", "-icon",
               "-e", ctl_prog, "-insecure", "-ox", dat_prog,                "-e", ctl_prog, "-insecure", "-ox", dat_prog,
               "-data", portStream, "-control", portControl,                "-data", buf[0], "-control", buf[1],
               "-host", remote_host, NULL);                "-host", remote_host, NULL);
         exit(1);          exit(1);
     }      }
   
       sleep(1); /* wait ssh */
 }  }
   
 OXFILE *ox_start_remote_with_ssh(char *dat_prog, char* remote_host)  OXFILE *ox_start_remote_with_ssh(char *dat_prog, char* remote_host)
Line 201  OXFILE *ox_start_remote_with_ssh(char *dat_prog, char*
Line 218  OXFILE *ox_start_remote_with_ssh(char *dat_prog, char*
     ssh_ox_server(remote_host, "ox", dat_prog, 1200, 1300);      ssh_ox_server(remote_host, "ox", dat_prog, 1200, 1300);
     return ox_start_insecure(remote_host, 1200, 1300);      return ox_start_insecure(remote_host, 1200, 1300);
 }  }
   

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

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