[BACK]Return to test.c CVS log [TXT][DIR] Up to [local] / OpenXM / doc / oxlib

Annotation of OpenXM/doc/oxlib/test.c, Revision 1.3

1.3     ! noro        1: /* $OpenXM: OpenXM/doc/oxlib/test.c,v 1.2 2002/02/25 07:14:44 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 ) {
1.3     ! noro       14:                printf("Input> ");
1.1       noro       15:                fgets(ibuf,BUFSIZ,stdin);
                     16:                if ( !strncmp(ibuf,"bye",3) )
                     17:                        exit(0);
                     18:                asir_ox_execute_string(ibuf);
                     19:                len = asir_ox_peek_cmo_string_length();
                     20:                if ( len > len0 ) {
                     21:                        len0 = len;
1.2       noro       22:                        obuf = (char *)realloc(obuf,len0);
1.1       noro       23:                }
1.2       noro       24:                asir_ox_pop_string(obuf,len0);
1.3     ! noro       25:                printf("Output> %s\n",obuf);
1.1       noro       26:        }
                     27: }
                     28:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>