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

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

1.5     ! takayama    1: /* $OpenXM: OpenXM/doc/oxlib/test.c,v 1.4 2003/03/08 07:49:59 takayama Exp $ */
1.4       takayama    2: #include <stdio.h>
1.5     ! takayama    3: #include "hhh.h"
1.1       noro        4:
                      5: main() {
                      6:        char ibuf[BUFSIZ];
1.2       noro        7:        char *obuf;
1.1       noro        8:        int len,len0;
                      9:
                     10:        asir_ox_init(1);  /* Use the network byte order */
                     11:
                     12:        len0 = BUFSIZ;
1.2       noro       13:        obuf = (char *)malloc(len0);
1.1       noro       14:        while ( 1 ) {
1.3       noro       15:                printf("Input> ");
1.1       noro       16:                fgets(ibuf,BUFSIZ,stdin);
                     17:                if ( !strncmp(ibuf,"bye",3) )
                     18:                        exit(0);
                     19:                asir_ox_execute_string(ibuf);
                     20:                len = asir_ox_peek_cmo_string_length();
                     21:                if ( len > len0 ) {
                     22:                        len0 = len;
1.2       noro       23:                        obuf = (char *)realloc(obuf,len0);
1.1       noro       24:                }
1.2       noro       25:                asir_ox_pop_string(obuf,len0);
1.3       noro       26:                printf("Output> %s\n",obuf);
1.1       noro       27:        }
                     28: }
                     29:

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