version 1.1, 2000/10/10 05:23:21 |
version 1.3, 2002/04/09 09:40:37 |
|
|
/* -*- mode: C; coding: euc-japan -*- */ |
/* -*- mode: C; coding: euc-japan -*- */ |
/* $OpenXM$ */ |
/* $OpenXM: OpenXM/src/ox_toolkit/oxf_old.c,v 1.2 2000/10/12 15:53:25 ohara Exp $ */ |
|
|
/* このモジュールは互換性のためのものです。*/ |
/* このモジュールは互換性のためのものです。*/ |
|
|
|
|
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
#include <unistd.h> |
#include <unistd.h> |
#include <errno.h> |
|
#include <fcntl.h> |
#include <fcntl.h> |
#include <sys/file.h> |
#include <sys/file.h> |
#include <sys/param.h> |
#include <sys/param.h> |
Line 98 void set_OpenXM_HOME() |
|
Line 97 void set_OpenXM_HOME() |
|
} |
} |
} |
} |
|
|
void ox_exec_local(char* host, char* ctl_prog, char* dat_prog, int portControl, int portStream, char *passwd) |
void ox_exec_local(char* ctl_prog, char* dat_prog, int portControl, int portStream, char *passwd) |
{ |
{ |
char ctl[128], dat[128]; |
char ctl[128], dat[128]; |
|
char localhost[MAXHOSTNAMELEN]; |
|
|
|
|
sprintf(ctl, "%d", portControl); |
sprintf(ctl, "%d", portControl); |
sprintf(dat, "%d", portStream); |
sprintf(dat, "%d", portStream); |
|
|
Line 109 void ox_exec_local(char* host, char* ctl_prog, char* d |
|
Line 110 void ox_exec_local(char* host, char* ctl_prog, char* d |
|
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 (gethostname(localhost, MAXHOSTNAMELEN)==0) { |
execlp("oxlog", "oxlog", "xterm", "-icon", "-e", ctl_prog, |
if (fork() == 0) { |
"-reverse", "-ox", dat_prog, |
execlp("oxlog", "oxlog", "xterm", "-icon", "-e", ctl_prog, |
"-data", dat, "-control", ctl, "-pass", passwd, |
"-reverse", "-ox", dat_prog, |
"-host", host, NULL); |
"-data", dat, "-control", ctl, "-pass", passwd, |
exit(1); |
"-host", localhost, NULL); |
} |
exit(1); |
|
} |
|
} |
} |
} |
|
|
/* |
/* |
Line 133 OXFILE *ox_start(char* host, char* ctl_prog, char* dat |
|
Line 135 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]; |
short ports[2] = {0}; /* short! */ |
int ports[2] = {0}; /* short! */ |
|
|
listen[0] = mysocketListen(host, &ports[0]); |
/* host を無視 */ |
listen[1] = mysocketListen(host, &ports[1]); |
listen[0] = oxf_listen(&ports[0]); |
|
listen[1] = oxf_listen(&ports[1]); |
|
|
ox_exec_local(host, ctl_prog, dat_prog, ports[0], ports[1], passwd); |
ox_exec_local(ctl_prog, dat_prog, ports[0], ports[1], passwd); |
|
|
ct = mysocketAccept2(listen[0], passwd); |
ct = mysocketAccept2(listen[0], passwd); |
if (ct != NULL) { |
if (ct != NULL) { |
usleep(10); /* zzz... */ |
usleep(10); /* zzz... */ |