=================================================================== RCS file: /home/cvs/OpenXM/src/ox_toolkit/testclient.c,v retrieving revision 1.1 retrieving revision 1.4 diff -u -p -r1.1 -r1.4 --- OpenXM/src/ox_toolkit/testclient.c 1999/12/15 05:21:25 1.1 +++ OpenXM/src/ox_toolkit/testclient.c 2000/03/10 12:24:40 1.4 @@ -1,5 +1,5 @@ /* -*- mode: C -*- */ -/* $OpenXM$ */ +/* $OpenXM: OpenXM/src/ox_toolkit/testclient.c,v 1.3 1999/12/22 11:26:37 ohara Exp $ */ /* A sample implementation of an OpenXM client with OpenXM C library */ @@ -9,8 +9,9 @@ #include #include #include -#include "ox.h" +#include "ox_toolkit.h" + ox_file_t sv; int dumpx(int fd, int n) @@ -30,14 +31,21 @@ int dumpx(int fd, int n) return len; } -#define VERSION 0x11121500 -#define ID_STRING "testclient version 0.11121500" +#define SIZE_CMDLINE 8192 -int prompt() +static int size = SIZE_CMDLINE; +static char cmdline[SIZE_CMDLINE]; + +static int prompt() { - printf("> "); + fprintf(stdout, "> "); + fgets(cmdline, size, stdin); + init_parser(cmdline); } +#define VERSION 0x11121500 +#define ID_STRING "testclient version 0.11121500" + int test_0() { cmo* c = NULL; @@ -76,6 +84,12 @@ int test_1() fputc('\n', stderr); } +/* Example: + testclient + >(OX_DATA,(CMO_INT32,123)) + >(OX_COMMAND,(SM_popCMO)) + */ + int main(int argc, char* argv[]) { ox* m = NULL; @@ -98,6 +112,8 @@ int main(int argc, char* argv[]) if (strcmp(server, "ox_math")==0) { test_1(); } + + setflag_parse(PFLAG_ADDREV); while(prompt(), (m = parse()) != NULL) { send_ox(sv->stream, m);