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

File: [local] / OpenXM / doc / oxlib / test.c (download)

Revision 1.4, Sat Mar 8 07:49:59 2003 UTC (21 years, 2 months ago) by takayama
Branch: MAIN
CVS Tags: R_1_3_1-2, RELEASE_1_3_1_13b, RELEASE_1_2_3_12, RELEASE_1_2_3, RELEASE_1_2_2_KNOPPIX_b, RELEASE_1_2_2_KNOPPIX, RELEASE_1_2_2, KNOPPIX_2006, DEB_REL_1_2_3-9
Changes since 1.3: +2 -2 lines

Update for a configuration, but it still does not work.

/* $OpenXM: OpenXM/doc/oxlib/test.c,v 1.4 2003/03/08 07:49:59 takayama Exp $ */
#include <stdio.h>

main() {
	char ibuf[BUFSIZ];
	char *obuf;
	int len,len0;

	asir_ox_init(1);  /* Use the network byte order */

	len0 = BUFSIZ;
	obuf = (char *)malloc(len0);
	while ( 1 ) {
		printf("Input> ");
		fgets(ibuf,BUFSIZ,stdin);
		if ( !strncmp(ibuf,"bye",3) )
			exit(0);
		asir_ox_execute_string(ibuf);
		len = asir_ox_peek_cmo_string_length();
		if ( len > len0 ) {
			len0 = len;
			obuf = (char *)realloc(obuf,len0);
		}
		asir_ox_pop_string(obuf,len0);
		printf("Output> %s\n",obuf);
	}
}