=================================================================== RCS file: /home/cvs/OpenXM/src/oxc/oxc.c,v retrieving revision 1.10 retrieving revision 1.12 diff -u -p -r1.10 -r1.12 --- OpenXM/src/oxc/oxc.c 2000/12/16 01:52:32 1.10 +++ OpenXM/src/oxc/oxc.c 2003/05/07 04:00:30 1.12 @@ -1,9 +1,10 @@ /* -*- mode: C -*- */ -/* $OpenXM: OpenXM/src/oxc/oxc.c,v 1.9 2000/12/15 03:34:43 ohara Exp $ */ +/* $OpenXM: OpenXM/src/oxc/oxc.c,v 1.11 2001/01/10 06:54:36 ohara Exp $ */ #include #include #include +#include #include #include "mysocket.h" #include "ox_toolkit.h" @@ -28,7 +29,7 @@ int lf_oxc_open_main(char *cmd, short port) pid_t pid; if ((pid = fork()) == 0) { oxf_connect_dup(remote_host, port); - fprintf(stderr, "oxc: oxc_open(%s, %d)\n", cmd, port); + ox_printf("oxc: oxc_open(%s, %d)\n", cmd, port); execlp(cmd, cmd, NULL); } return pid; /* if error, pid == 0 */ @@ -44,7 +45,7 @@ OXFILE *connection() if (--counter > 0) { usleep(100); /* spends 100 micro seconds */ }else { - fprintf(stderr, "oxc: cannot connect.\n"); + ox_printf("oxc: cannot connect.\n"); return NULL; } } @@ -53,11 +54,77 @@ OXFILE *connection() return oxfp; } +__inline__ +static char *sskip(char *s) +{ + while (isspace(*s)) { + s++; + } + return s; +} + +__inline__ +static char *wskip(char *s) +{ + while (!isspace(*s) && *s != '\0') { + s++; + } + return s; +} + +static int wc(char *s) +{ + int n = 0; + s = sskip(s); + while(*s != '\0') { + s = wskip(s); + s = sskip(s); + n++; + } + return n; +} + +static void word(char *str, int argc, char *argv[]) +{ + int i; + char *s = strcpy(malloc(strlen(str)+1), str); + for(i=0; ifd); + ox_printf("oxc: oxfp = %p, fd = %d\n", oxfp, oxfp->fd); mathcap_init(20001006, "v2000.10.06", "oxc", basic0, NULL); sm(oxfp); }