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

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

1.1     ! noro        1: /* $OpenXM$ */
        !             2: #include <asir/ox.h>
        !             3:
        !             4: main() {
        !             5:        char ibuf[BUFSIZ];
        !             6:        char *s,*buf;
        !             7:        int len,len0;
        !             8:
        !             9:        asir_ox_init(1);  /* Use the network byte order */
        !            10:
        !            11:        len0 = BUFSIZ;
        !            12:        buf = (char *)malloc(len0);
        !            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;
        !            21:                        buf = (char *)realloc(buf,len0);
        !            22:                }
        !            23:                asir_ox_pop_string(buf,len0);
        !            24:                printf("%s\n",buf);
        !            25:        }
        !            26: }
        !            27:

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