Annotation of OpenXM/doc/oxlib/test.c, Revision 1.2
1.2 ! noro 1: /* $OpenXM: OpenXM/doc/oxlib/test.c,v 1.1 2002/02/25 07:09:01 noro Exp $ */
1.1 noro 2: #include <asir/ox.h>
3:
4: main() {
5: char ibuf[BUFSIZ];
1.2 ! noro 6: char *obuf;
1.1 noro 7: int len,len0;
8:
9: asir_ox_init(1); /* Use the network byte order */
10:
11: len0 = BUFSIZ;
1.2 ! noro 12: obuf = (char *)malloc(len0);
1.1 noro 13: while ( 1 ) {
14: fgets(ibuf,BUFSIZ,stdin);
15: if ( !strncmp(ibuf,"bye",3) )
16: exit(0);
17: asir_ox_execute_string(ibuf);
18: len = asir_ox_peek_cmo_string_length();
19: if ( len > len0 ) {
20: len0 = len;
1.2 ! noro 21: obuf = (char *)realloc(obuf,len0);
1.1 noro 22: }
1.2 ! noro 23: asir_ox_pop_string(obuf,len0);
! 24: printf("%s\n",obuf);
1.1 noro 25: }
26: }
27:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>