version 1.3, 2002/10/20 23:49:12 |
version 1.7, 2004/02/25 23:14:36 |
|
|
/* |
/* |
$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.6 2002/10/28 08:57:28 takayama Exp $ |
*/ |
*/ |
|
|
#include <stdio.h> |
#include <stdio.h> |
|
|
#include "ox_kan.h" |
#include "ox_kan.h" |
#include "serversm.h" |
#include "serversm.h" |
|
|
|
/* #define DEBUG */ |
|
|
char *getTag(char *s); |
char *getTag(char *s); |
char *getKeyValue(char *s,char *key); |
char *getKeyValue(char *s,char *key); |
char *getBody(char *s); |
char *getBody(char *s); |
|
|
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 134 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); |
signal(SIGALRM,exitServer); |
alarm(60); |
alarm(60); |
Line 188 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() { |