version 1.4, 2002/10/27 10:39:33 |
version 1.9, 2016/03/31 05:27:34 |
|
|
/* |
/* |
$OpenXM: OpenXM/src/kxx/oxd.c,v 1.3 2002/10/20 23:49:12 takayama Exp $ |
$OpenXM: OpenXM/src/kxx/oxd.c,v 1.8 2004/09/17 03:28:21 takayama Exp $ |
*/ |
*/ |
|
|
#include <stdio.h> |
#include <stdio.h> |
|
|
int LocalMode = 1; |
int LocalMode = 1; |
static int findOxServer(char *server); |
static int findOxServer(char *server); |
static void couldNotFind(char *s); |
static void couldNotFind(char *s); |
#if defined(__CYGWIN__) |
|
int errno; |
|
#endif |
|
#define NOBODY 65534 |
#define NOBODY 65534 |
|
|
main(int argc, char *argv[]) { |
main(int argc, char *argv[]) { |
Line 136 childServerMain(int fd) { |
|
Line 133 childServerMain(int fd) { |
|
char ccc[SIZE*3]; |
char ccc[SIZE*3]; |
extern int Serial; |
extern int Serial; |
char *openxm; |
char *openxm; |
|
int resultCode; |
|
int st; |
|
|
/* Starting oxd session */ |
/* Starting oxd session */ |
signal(SIGALRM,exitServer); |
mysignal(SIGALRM,exitServer); |
alarm(60); |
alarm(60); |
fp = fdopen(fd,"w+"); |
fp = fdopen(fd,"w+"); |
if (fp == NULL) oxdError("failed fdopen\n"); |
if (fp == NULL) oxdError("failed fdopen\n"); |
Line 190 childServerMain(int fd) { |
|
Line 190 childServerMain(int fd) { |
|
openxm = getOpenXMpath(); |
openxm = getOpenXMpath(); |
sprintf(ccc,"%s %s",openxm,body); |
sprintf(ccc,"%s %s",openxm,body); |
fprintf(stderr,"Serial=%d : Executing command=%s\n",Serial,ccc); |
fprintf(stderr,"Serial=%d : Executing command=%s\n",Serial,ccc); |
|
/* Old code. |
fprintf(fp,"<bye/>\n"); fflush(NULL); |
fprintf(fp,"<bye/>\n"); fflush(NULL); |
fclose(fp); /* close the connection */ |
fclose(fp); |
system(ccc); |
system(ccc); |
fprintf(stderr,"Serial=%d : The following command is finished : %s\n",Serial,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,"<suceeded/>\n"); |
|
}else{ |
|
fprintf(fp,"<failed code=\"%d\"/>\n",resultCode); |
|
} |
|
|
|
GET_COMMAND /* expect <login/> */ |
|
|
|
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() { |
char *getOpenXMpath() { |
Line 225 oxdError(char *s) { |
|
Line 244 oxdError(char *s) { |
|
} |
} |
|
|
|
|
|
void *sGC_malloc(int n) { return (void *) GC_malloc(n); } |
|
|