version 1.3, 2003/01/11 11:42:32 |
version 1.4, 2003/01/13 12:03:13 |
|
|
/* -*- mode: C -*- */ |
/* -*- mode: C -*- */ |
/* $OpenXM: OpenXM/src/ox_toolkit/zclient.c,v 1.2 2000/10/12 15:30:32 ohara Exp $ */ |
/* $OpenXM: OpenXM/src/ox_toolkit/zclient.c,v 1.3 2003/01/11 11:42:32 ohara Exp $ */ |
|
|
/* A sample implementation of an OpenXM client with OpenXM C library */ |
/* A sample implementation of an OpenXM client with OpenXM C library */ |
|
|
Line 28 OXFILE *open_server(char *remote_host) |
|
Line 28 OXFILE *open_server(char *remote_host) |
|
|
|
if ((listen = oxf_listen(&port)) != -1) { |
if ((listen = oxf_listen(&port)) != -1) { |
if (oxc_start(remote_host, port, passwd) != 0) { |
if (oxc_start(remote_host, port, passwd) != 0) { |
fprintf(ox_stderr, "zclient:: remotehost = %s.\n", remote_host); |
ox_printf("zclient:: remotehost = %s.\n", remote_host); |
return connection(listen, passwd); |
return connection(listen, passwd); |
} |
} |
} |
} |
Line 41 int main(int argc, char* argv[]) |
|
Line 41 int main(int argc, char* argv[]) |
|
char *remote, *cmd; |
char *remote, *cmd; |
|
|
ox_stderr_init(NULL); |
ox_stderr_init(NULL); |
setbuf(ox_stderr, NULL); |
|
if (argc < 3) { |
if (argc < 3) { |
fprintf(ox_stderr, "we have a few argument.\n"); |
ox_printf("we have a few argument.\n"); |
fprintf(ox_stderr, "Usage:\n %s [remotehost] [command]\n", argv[0]); |
ox_printf("Usage:\n %s [remotehost] [command]\n", argv[0]); |
return 0; |
return 0; |
} |
} |
|
|
Line 52 int main(int argc, char* argv[]) |
|
Line 51 int main(int argc, char* argv[]) |
|
cmd = argv[2]; |
cmd = argv[2]; |
|
|
if ((oxfp = open_server(remote)) == NULL) { |
if ((oxfp = open_server(remote)) == NULL) { |
fprintf(ox_stderr, "zclient:: I cannot open a server.\n"); |
ox_printf("zclient:: I cannot open a server.\n"); |
exit(1); |
exit(1); |
} |
} |
fprintf(ox_stderr, "zclient:: I succeed to open an OX server.\n"); |
ox_printf("zclient:: I succeed to open an OX server.\n"); |
|
|
if(oxf_execute_cmd(oxfp, cmd) != NULL) { |
if(oxf_execute_cmd(oxfp, cmd) != NULL) { |
fprintf(ox_stderr, "zclient:: I succeed to connect a calc server!!\n"); |
ox_printf("zclient:: I succeed to connect a calc server!!\n"); |
} |
} |
|
|
oxf_close(oxfp); |
oxf_close(oxfp); |
fprintf(ox_stderr, "zclient:: closed.\n"); |
ox_printf("zclient:: closed.\n"); |
return 0; |
return 0; |
} |
} |