version 1.11, 2001/01/10 06:54:36 |
version 1.13, 2004/12/01 17:42:46 |
|
|
/* -*- mode: C -*- */ |
/* -*- mode: C -*- */ |
/* $OpenXM: OpenXM/src/oxc/oxc.c,v 1.10 2000/12/16 01:52:32 ohara Exp $ */ |
/* $OpenXM: OpenXM/src/oxc/oxc.c,v 1.12 2003/05/07 04:00:30 ohara Exp $ */ |
|
|
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
Line 29 int lf_oxc_open_main(char *cmd, short port) |
|
Line 29 int lf_oxc_open_main(char *cmd, short port) |
|
pid_t pid; |
pid_t pid; |
if ((pid = fork()) == 0) { |
if ((pid = fork()) == 0) { |
oxf_connect_dup(remote_host, port); |
oxf_connect_dup(remote_host, port); |
fprintf(stderr, "oxc: oxc_open(%s, %d)\n", cmd, port); |
ox_printf("oxc: oxc_open(%s, %d)\n", cmd, port); |
execlp(cmd, cmd, NULL); |
execlp(cmd, cmd, NULL); |
} |
} |
return pid; /* if error, pid == 0 */ |
return pid; /* if error, pid == 0 */ |
Line 45 OXFILE *connection() |
|
Line 45 OXFILE *connection() |
|
if (--counter > 0) { |
if (--counter > 0) { |
usleep(100); /* spends 100 micro seconds */ |
usleep(100); /* spends 100 micro seconds */ |
}else { |
}else { |
fprintf(stderr, "oxc: cannot connect.\n"); |
ox_printf("oxc: cannot connect.\n"); |
return NULL; |
return NULL; |
} |
} |
} |
} |
Line 155 int main(int argc, char *argv[]) |
|
Line 155 int main(int argc, char *argv[]) |
|
int c; |
int c; |
int delay = 0; |
int delay = 0; |
char *delay_s = "0"; |
char *delay_s = "0"; |
|
int quiet = 0; |
|
|
while ((c = getopt(argc, argv, "d:c:p:h:x")) != -1) { |
while ((c = getopt(argc, argv, "c:d:h:p:qx")) != -1) { |
switch(c) { |
switch(c) { |
case 'h': |
case 'h': |
remote_host = optarg; |
remote_host = optarg; |
break; |
break; |
case 'c': |
case 'c': |
password = optarg; |
password = optarg; |
|
|
break; |
break; |
case 'p': |
case 'p': |
port = atoi(optarg); |
port = atoi(optarg); |
port_s = optarg; |
port_s = optarg; |
break; |
break; |
|
case 'q': |
|
quiet = 1; |
|
break; |
case 'x': |
case 'x': |
if (getenv("DISPLAY") != NULL) { |
if (getenv("DISPLAY") != NULL) { |
oxlog = 1; |
oxlog = 1; |
Line 179 int main(int argc, char *argv[]) |
|
Line 182 int main(int argc, char *argv[]) |
|
delay = atoi(optarg); |
delay = atoi(optarg); |
break; |
break; |
default: |
default: |
|
; |
} |
} |
} |
} |
argc -= optind; |
argc -= optind; |
argv += optind; |
argv += optind; |
|
|
|
if (!quiet) { |
|
ox_stderr_init(stderr); |
|
} |
|
|
if (strlen(remote_host) == 0) { |
if (strlen(remote_host) == 0) { |
pipe_read_info(&remote_host, &port, &password); |
pipe_read_info(&remote_host, &port, &password); |
port_s = malloc(32); |
port_s = malloc(32); |
Line 197 int main(int argc, char *argv[]) |
|
Line 205 int main(int argc, char *argv[]) |
|
execvp(args[0], args); |
execvp(args[0], args); |
} |
} |
|
|
fprintf(stderr, "start connection!\n"); |
ox_printf("start connection!\n"); |
usleep(delay); |
usleep(delay); |
if ((oxfp = connection()) != NULL) { |
if ((oxfp = connection()) != NULL) { |
fprintf(stderr, "oxc: oxfp = %p, fd = %d\n", oxfp, oxfp->fd); |
ox_printf("oxc: oxfp = %p, fd = %d\n", oxfp, oxfp->fd); |
mathcap_init(20001006, "v2000.10.06", "oxc", basic0, NULL); |
mathcap_init(20001006, "v2000.10.06", "oxc", basic0, NULL); |
sm(oxfp); |
sm(oxfp); |
} |
} |