| version 1.12, 2002/10/28 00:38:32 |
version 1.17, 2004/03/03 02:31:50 |
|
|
| /* $OpenXM: OpenXM/src/kxx/oxmain.c,v 1.11 2002/05/02 08:33:47 ohara Exp $ */ |
/* $OpenXM: OpenXM/src/kxx/oxmain.c,v 1.16 2004/02/25 23:14:36 takayama Exp $ */ |
| /* nullserver01 */ |
/* nullserver01 */ |
| #include <stdio.h> |
#include <stdio.h> |
| #include <fcntl.h> |
#include <fcntl.h> |
|
|
| #include <netdb.h> |
#include <netdb.h> |
| #include <signal.h> |
#include <signal.h> |
| #include <setjmp.h> |
#include <setjmp.h> |
| |
#include <stdlib.h> |
| /* -lnsl -lsocket /usr/ucblib/libucb.a */ |
/* -lnsl -lsocket /usr/ucblib/libucb.a */ |
| #include "ox_kan.h" |
#include "ox_kan.h" |
| #include "serversm.h" |
#include "serversm.h" |
| |
|
| #define SERVERNAME "ox_sm1" |
#define SERVERNAME "ox_sm1" |
| |
|
| |
extern char **environ; |
| int OxCritical = 0; |
int OxCritical = 0; |
| int OxInterruptFlag = 0; |
int OxInterruptFlag = 0; |
| int OxTerminateMode = 0; |
int OxTerminateMode = 0; |
| Line 34 int Do_not_use_control_stream_to_tell_no_server = 1; |
|
| Line 36 int Do_not_use_control_stream_to_tell_no_server = 1; |
|
| static void errorToStartEngine(void); |
static void errorToStartEngine(void); |
| 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 |
|
| /* gcc -v -c hoge.c */ |
/* gcc -v -c hoge.c */ |
| |
|
| |
void *sGC_malloc(int n) { |
| |
return (void *)malloc(n); |
| |
} |
| |
|
| main(int argc, char *argv[]) { |
main(int argc, char *argv[]) { |
| int fd; |
int fd; |
| int size; |
int size; |
| Line 56 main(int argc, char *argv[]) { |
|
| Line 59 main(int argc, char *argv[]) { |
|
| int sleepingTime = 0; |
int sleepingTime = 0; |
| extern int OxTerminateMode; |
extern int OxTerminateMode; |
| |
|
| |
signal(SIGHUP,SIG_IGN); /* ignore x of xterm */ |
| strcpy(sname,"localhost"); |
strcpy(sname,"localhost"); |
| strcpy(ServerName,SERVERNAME); |
strcpy(ServerName,SERVERNAME); |
| i = 1; |
i = 1; |
| Line 269 parentServerMain(int fdControl, int fdStream) { |
|
| Line 273 parentServerMain(int fdControl, int fdStream) { |
|
| } |
} |
| } |
} |
| |
|
| controlByteOrder = oxTellMyByteOrder(fdControl); |
controlByteOrder = oxTellMyByteOrder(fdControl,fdControl); |
| /* Set the network byte order. */ |
/* Set the network byte order. */ |
| fprintf(stderr,"controlByteOrder=%x\n",controlByteOrder); |
fprintf(stderr,"controlByteOrder=%x\n",controlByteOrder); |
| |
|
| Line 326 childServerMain(int fdControl, int fdStream) { |
|
| Line 330 childServerMain(int fdControl, int fdStream) { |
|
| } |
} |
| } |
} |
| fprintf(stderr,"childServerMain: Starting the server %s\n",ServerName); fflush(NULL); |
fprintf(stderr,"childServerMain: Starting the server %s\n",ServerName); fflush(NULL); |
| |
|
| |
/* |
| |
{ |
| |
int i; |
| |
i=0; |
| |
while (environ[i] != NULL) { |
| |
fprintf(stderr,"%s ",environ[i++]); |
| |
} |
| |
fprintf(stderr,"\n"); |
| |
} |
| |
*/ |
| |
/* bug: xterm of potato does not seem to pass the LD_LIBRARY_PATH. |
| |
So, the new gc does not work. |
| |
it is an workaround for OpenXM */ |
| |
if (getenv("LD_LIBRARY_PATH") == (char *)NULL) { |
| |
char *s,*o; |
| |
fprintf(stderr,"Hmm... LD_LIBRARY_PATH does not seem to be set.\n"); |
| |
o = getenv("OpenXM_HOME"); |
| |
if (o == NULL) { |
| |
fprintf(stderr,"Giving up to set the LD_LIBRARY_PATH variable.\n"); |
| |
}else{ |
| |
s = (char *)malloc(strlen(o)+64); |
| |
sprintf(s,"LD_LIBRARY_PATH=%s/lib",o); |
| |
putenv(s); |
| |
} |
| |
} |
| |
|
| if (PacketMonitor) { |
if (PacketMonitor) { |
| if (execl(ServerName,ServerName,"-monitor",NULL)) { |
if (execle(ServerName,ServerName,"-monitor",NULL,environ)) { |
| fprintf(stderr,"%s cannot be executed with -monitor.\n",ServerName); |
fprintf(stderr,"%s cannot be executed with -monitor.\n",ServerName); |
| fflush(NULL); |
fflush(NULL); |
| return(-1); |
return(-1); |
| } |
} |
| }else { |
}else { |
| if (execl(ServerName,ServerName,NULL)) { |
if (execle(ServerName,ServerName,NULL,environ)) { |
| fprintf(stderr,"%s cannot be executed.\n",ServerName); |
fprintf(stderr,"%s cannot be executed.\n",ServerName); |
| fflush(NULL); |
fflush(NULL); |
| return(-1); |
return(-1); |
| Line 350 restoreLockCtrlCForOx() { ; } |
|
| Line 381 restoreLockCtrlCForOx() { ; } |
|
| static int findOxServer(char *server) { |
static int findOxServer(char *server) { |
| char *p; |
char *p; |
| char *p2; |
char *p2; |
| char *getenv(char *s); |
|
| if (strlen(server) == 0) return(-1); |
if (strlen(server) == 0) return(-1); |
| /* fd = open(server,O_RDONLY); */ |
/* fd = open(server,O_RDONLY); */ |
| if (access(server,X_OK&R_OK) == 0) { |
if (access(server,X_OK&R_OK) == 0) { |