=================================================================== RCS file: /home/cvs/OpenXM/src/ox_toolkit/testclient.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -p -r1.9 -r1.10 --- OpenXM/src/ox_toolkit/testclient.c 2003/01/11 11:42:32 1.9 +++ OpenXM/src/ox_toolkit/testclient.c 2003/01/13 12:03:12 1.10 @@ -1,5 +1,5 @@ /* -*- mode: C -*- */ -/* $OpenXM: OpenXM/src/ox_toolkit/testclient.c,v 1.8 2000/11/28 04:24:12 ohara Exp $ */ +/* $OpenXM: OpenXM/src/ox_toolkit/testclient.c,v 1.9 2003/01/11 11:42:32 ohara Exp $ */ /* A sample implementation of an OpenXM client with OpenXM C library */ @@ -21,14 +21,14 @@ int dumpx(OXFILE *oxfp, int n) int i; int len = oxf_read(buff, 1, n, oxfp); - fprintf(ox_stderr, "I have read %d byte from socket(%d).\n", len, oxfp->fd); + ox_printf("I have read %d byte from socket(%d).\n", len, oxfp->fd); for(i = 0; i < len; i++) { - fprintf(ox_stderr, "%02x ", buff[i]); + ox_printf("%02x ", buff[i]); if (i%20 == 19) { - fprintf(ox_stderr, "\n"); + ox_printf("\n"); } } - fprintf(ox_stderr, "\n"); + ox_printf("\n"); return len; } @@ -51,14 +51,13 @@ int test_0() { cmo* c = NULL; #ifdef DEBUG - fprintf(ox_stderr, "testclient:: calling ox_mathcap().\n"); + ox_printf("testclient:: calling ox_mathcap().\n"); c = ox_mathcap(sv); - fprintf(ox_stderr, "testclient:: cmo received.(%p)\n", c); + ox_printf("testclient:: cmo received.(%p)\n", c); #else c = (cmo *)ox_mathcap(sv); #endif print_cmo(c); - fflush(ox_stderr); mathcap_init(VERSION, ID_STRING, "testclient", NULL, NULL); send_ox_cmo(sv, oxf_cmo_mathcap(sv)); @@ -69,7 +68,7 @@ int test_0() send_ox_command(sv, SM_popCMO); receive_ox_tag(sv); c = receive_cmo(sv); - fprintf(ox_stderr, "testclient:: cmo received.\n"); + ox_printf("testclient:: cmo received.\n"); print_cmo(c); } @@ -79,14 +78,14 @@ int test_1() mathcap_init(1000, "test!", "testclient", NULL, NULL); m = oxf_cmo_mathcap(sv); - fprintf(ox_stderr, "testclient:: test cmo_mathcap.\n"); + ox_printf("testclient:: test cmo_mathcap.\n"); send_ox_cmo(sv, m); send_ox_command(sv, SM_popCMO); receive_ox_tag(sv); c = receive_cmo(sv); - fprintf(ox_stderr, "testclient:: cmo received.(%p)\n", c); + ox_printf("testclient:: cmo received.(%p)\n", c); print_cmo(c); - fputc('\n', ox_stderr); + ox_printf("\n"); } /* Example: @@ -103,15 +102,14 @@ int main(int argc, char* argv[]) char *server = "ox_sm1"; ox_stderr_init(NULL); - setbuf(ox_stderr, NULL); if (argc>1) { server = argv[1]; } - fprintf(ox_stderr, "testclient:: I use %s as an OX server.\n", server); + ox_printf("testclient:: I use %s as an OX server.\n", server); /* sv = ox_start("localhost", "ox", server); */ if (sv == NULL) { - fprintf(ox_stderr, "testclient:: I cannot connect to servers.\n"); + ox_printf("testclient:: I cannot connect to servers.\n"); exit(1); } @@ -130,16 +128,16 @@ int main(int argc, char* argv[]) }else if (code == SM_popCMO || code == SM_popString) { receive_ox_tag(sv); c = receive_cmo(sv); - fprintf(ox_stderr, "testclient:: cmo received.\n"); + ox_printf("testclient:: cmo received.\n"); print_cmo(c); } } } ox_reset(sv); - fprintf(ox_stderr, "The testclient resets.\n"); + ox_printf("The testclient resets.\n"); ox_close(sv); - fprintf(ox_stderr, "The testclient halts.\n"); + ox_printf("The testclient halts.\n"); return 0; }