version 1.1, 2002/02/25 07:09:01 |
version 1.2, 2002/02/25 07:14:44 |
|
|
/* $OpenXM$ */ |
/* $OpenXM: OpenXM/doc/oxlib/test.c,v 1.1 2002/02/25 07:09:01 noro Exp $ */ |
#include <asir/ox.h> |
#include <asir/ox.h> |
|
|
main() { |
main() { |
char ibuf[BUFSIZ]; |
char ibuf[BUFSIZ]; |
char *s,*buf; |
char *obuf; |
int len,len0; |
int len,len0; |
|
|
asir_ox_init(1); /* Use the network byte order */ |
asir_ox_init(1); /* Use the network byte order */ |
|
|
len0 = BUFSIZ; |
len0 = BUFSIZ; |
buf = (char *)malloc(len0); |
obuf = (char *)malloc(len0); |
while ( 1 ) { |
while ( 1 ) { |
fgets(ibuf,BUFSIZ,stdin); |
fgets(ibuf,BUFSIZ,stdin); |
if ( !strncmp(ibuf,"bye",3) ) |
if ( !strncmp(ibuf,"bye",3) ) |
|
|
len = asir_ox_peek_cmo_string_length(); |
len = asir_ox_peek_cmo_string_length(); |
if ( len > len0 ) { |
if ( len > len0 ) { |
len0 = len; |
len0 = len; |
buf = (char *)realloc(buf,len0); |
obuf = (char *)realloc(obuf,len0); |
} |
} |
asir_ox_pop_string(buf,len0); |
asir_ox_pop_string(obuf,len0); |
printf("%s\n",buf); |
printf("%s\n",obuf); |
} |
} |
} |
} |
|
|