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

Diff for /OpenXM/src/ox_toolkit/ox.c between version 1.9 and 1.12

version 1.9, 2000/01/20 08:46:44 version 1.12, 2000/03/10 12:24:38
Line 1 
Line 1 
 /* -*- mode: C; coding: euc-japan -*- */  /* -*- mode: C; coding: euc-japan -*- */
 /* $OpenXM: OpenXM/src/ox_toolkit/ox.c,v 1.8 2000/01/19 19:46:42 ohara Exp $ */  /* $OpenXM: OpenXM/src/ox_toolkit/ox.c,v 1.11 2000/02/04 08:01:30 ohara Exp $ */
   
 /*  /*
    This module includes functions for sending/receiveng CMO's.     This module includes functions for sending/receiveng CMO's.
Line 15 
Line 15 
 #include <errno.h>  #include <errno.h>
 #include <fcntl.h>  #include <fcntl.h>
 #include <sys/file.h>  #include <sys/file.h>
 #include <gmp.h>  
   
 #include "mysocket.h"  #include "mysocket.h"
 #include "ox.h"  #include "ox_toolkit.h"
 #include "parse.h"  #include "parse.h"
   
 static int          cmolen_cmo_int32(cmo_int32* c);  static int          cmolen_cmo_int32(cmo_int32* c);
Line 82  static char*        new_string_set_cmo_int32(int integ
Line 81  static char*        new_string_set_cmo_int32(int integ
 static char*        new_string_set_cmo_list(cmo_list *c);  static char*        new_string_set_cmo_list(cmo_list *c);
 static char*        new_string_set_cmo_zz(cmo_zz *c);  static char*        new_string_set_cmo_zz(cmo_zz *c);
   
   int ssh_ox_server(char *, char *, char *, short, short);
   
 int current_fd = 0;  int current_fd = 0;
 int set_current_fd(int fd)  int set_current_fd(int fd)
 {  {
Line 560  int print_cmo(cmo* c)
Line 561  int print_cmo(cmo* c)
 {  {
     int tag = c->tag;      int tag = c->tag;
   
     symbol* symp = lookup_by_tag(tag);      symbol_t symp = lookup_by_tag(tag);
     if (symp != NULL) {      if (symp != NULL) {
         fprintf(stderr, "(%s", symp->key);          fprintf(stderr, "(%s", symp->key);
     }else {      }else {
Line 742  static char *concat_openxm_home_bin(char *s)
Line 743  static char *concat_openxm_home_bin(char *s)
         }          }
   
         base = getenv("OpenXM_HOME");          base = getenv("OpenXM_HOME");
         path = malloc(strlen(base)+5+strlen(s));          path = malloc(strlen(base)+6+strlen(s));
         sprintf(path, "%s/bin/%s", base, s);          sprintf(path, "%s/bin/%s", base, s);
         return path;          return path;
 }  }
Line 801  ox_file_t ox_start(char* host, char* ctl_prog, char* d
Line 802  ox_file_t ox_start(char* host, char* ctl_prog, char* d
         char *oxlog;          char *oxlog;
   
         /* not overwrite */          /* not overwrite */
   #if 0
         setenv("OpenXM_HOME", "/usr/local/OpenXM", 0);          setenv("OpenXM_HOME", "/usr/local/OpenXM", 0);
   #endif
           if (getenv("OpenXM_HOME") == NULL) {
                   putenv("OpenXM_HOME=/usr/local/OpenXM");
           }
   
         oxlog    = concat_openxm_home_bin("oxlog");          oxlog    = concat_openxm_home_bin("oxlog");
         ctl_prog = concat_openxm_home_bin(ctl_prog);          ctl_prog = concat_openxm_home_bin(ctl_prog);
Line 843  ox_file_t ox_start(char* host, char* ctl_prog, char* d
Line 849  ox_file_t ox_start(char* host, char* ctl_prog, char* d
     return sv;      return sv;
 }  }
   
   ox_file_t ox_start_remote_with_ssh(char *dat_prog, char* host)
   {
           ssh_ox_server(host, "ox", dat_prog, 1200, 1300);
           return ox_start_insecure_nonreverse(host, 1200, 1300);
   }
   
 /* ssh -f host oxlog xterm -e ox -ox ox_asir ... */  /* ssh -f host oxlog xterm -e ox -ox ox_asir ... */
 int ssh_ox_server(char *host, char *ctl_prog, char *dat_prog, short portControl, short portStream)  int ssh_ox_server(char *host, char *ctl_prog, char *dat_prog, short portControl, short portStream)
 {  {
         char *oxlog;          char *oxlog;
         char *ssh;          char *ssh;
   
         oxlog    = concat_openxm_home_bin("oxlog");          oxlog    = concat_openxm_home_bin("oxlog");
         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);
Line 857  int ssh_ox_server(char *host, char *ctl_prog, char *da
Line 870  int ssh_ox_server(char *host, char *ctl_prog, char *da
         if (fork() == 0) {          if (fork() == 0) {
                 execl(ssh, ssh, "-f", host, oxlog, "xterm", "-icon",                  execl(ssh, ssh, "-f", host, oxlog, "xterm", "-icon",
                           "-e", ctl_prog, "-insecure", "-ox", dat_prog,                            "-e", ctl_prog, "-insecure", "-ox", dat_prog,
                           "-data", portStream, "-control", portControl, "-host", host, NULL);                            "-data", portStream, "-control", portControl,
                             "-host", host, NULL);
                 exit(1);                  exit(1);
         }          }
 }  }
Line 887  ox_file_t ox_start_insecure_nonreverse(char* host, sho
Line 901  ox_file_t ox_start_insecure_nonreverse(char* host, sho
     return sv;      return sv;
 }  }
   
 ox_file_t ox_start_insecure_nonreverse2(char* host, char *ctl_prog, char *dat_prog)  
 {  
         short portControl= 1200;  /* 自動生成させよう... */  
         short portStream = 1300;  
   
         ssh_ox_server(host, ctl_prog, dat_prog, portControl, portStream);  
         return ox_start_insecure_nonreverse(host, portControl, portStream);  
 }  
   
 void ox_reset(ox_file_t sv)  void ox_reset(ox_file_t sv)
 {  {
     send_ox_command(sv->control, SM_control_reset_connection);      send_ox_command(sv->control, SM_control_reset_connection);
Line 1349  static cmo_list* make_list_of_id(int ver, char* ver_s,
Line 1354  static cmo_list* make_list_of_id(int ver, char* ver_s,
 static cmo_list *make_list_of_tag(int type)  static cmo_list *make_list_of_tag(int type)
 {  {
     cmo_list *li = new_cmo_list();      cmo_list *li = new_cmo_list();
     symbol *symp;      symbol_t symp;
     int i = 0;      int i = 0;
     while((symp = lookup(i++))->key != NULL) {      while((symp = lookup(i++))->key != NULL) {
         if (symp->type == type) {          if (symp->type == type) {
Line 1454  static char *new_string_set_cmo_list(cmo_list *m)
Line 1459  static char *new_string_set_cmo_list(cmo_list *m)
   
 char *new_string_set_cmo(cmo *m)  char *new_string_set_cmo(cmo *m)
 {  {
     symbol *symp;      symbol_t symp;
     switch(m->tag) {      switch(m->tag) {
     case CMO_ZZ:      case CMO_ZZ:
         return new_string_set_cmo_zz((cmo_zz *)m);          return new_string_set_cmo_zz((cmo_zz *)m);

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

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