=================================================================== RCS file: /home/cvs/OpenXM/src/kxx/oxd.c,v retrieving revision 1.3 retrieving revision 1.8 diff -u -p -r1.3 -r1.8 --- OpenXM/src/kxx/oxd.c 2002/10/20 23:49:12 1.3 +++ OpenXM/src/kxx/oxd.c 2004/09/17 03:28:21 1.8 @@ -1,5 +1,5 @@ /* - $OpenXM: OpenXM/src/kxx/oxd.c,v 1.2 2002/10/20 23:38:12 takayama Exp $ + $OpenXM: OpenXM/src/kxx/oxd.c,v 1.7 2004/02/25 23:14:36 takayama Exp $ */ #include @@ -17,6 +17,8 @@ #include "ox_kan.h" #include "serversm.h" +/* #define DEBUG */ + char *getTag(char *s); char *getKeyValue(char *s,char *key); char *getBody(char *s); @@ -31,9 +33,6 @@ int Serial = 0; int LocalMode = 1; static int findOxServer(char *server); static void couldNotFind(char *s); -#if defined(__CYGWIN__) -int errno; -#endif #define NOBODY 65534 main(int argc, char *argv[]) { @@ -134,6 +133,9 @@ childServerMain(int fd) { char ccc[SIZE*3]; extern int Serial; char *openxm; + int resultCode; + int st; + /* Starting oxd session */ signal(SIGALRM,exitServer); alarm(60); @@ -188,10 +190,29 @@ childServerMain(int fd) { openxm = getOpenXMpath(); sprintf(ccc,"%s %s",openxm,body); fprintf(stderr,"Serial=%d : Executing command=%s\n",Serial,ccc); + /* Old code. fprintf(fp,"\n"); fflush(NULL); - fclose(fp); /* close the connection */ + fclose(fp); system(ccc); fprintf(stderr,"Serial=%d : The following command is finished : %s\n",Serial,ccc); + */ + /* New code. It requires ox with -finish option. */ + resultCode = system(ccc); + fprintf(stderr,"Serial=%d : The following command is finished : %s, resultCode=%d\n",Serial,ccc,resultCode); + if (resultCode == 0) { + fprintf(fp,"\n"); + }else{ + fprintf(fp,"\n",resultCode); + } + + GET_COMMAND /* expect */ + + fclose(fp); /* close the connection */ + fprintf(stderr,"Waiting the termination of the child process (ox server).\n"); + fflush(NULL); + wait(&st); + fprintf(stderr,"%d: The child process is terminated.\n",Serial); + exit(0); } char *getOpenXMpath() { @@ -223,4 +244,5 @@ oxdError(char *s) { } +void *sGC_malloc(int n) { return (void *) GC_malloc(n); }