version 1.10, 2000/11/08 06:21:17 |
version 1.14, 2001/07/23 05:05:41 |
|
|
* OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY |
* OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* $OpenXM: OpenXM_contrib2/asir2000/io/ox_launch.c,v 1.9 2000/11/07 09:31:36 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/io/ox_launch.c,v 1.13 2001/06/27 09:14:08 noro Exp $ |
*/ |
*/ |
#include <setjmp.h> |
#include <setjmp.h> |
#include <signal.h> |
#include <signal.h> |
Line 82 static int ox_io_init(int); |
|
Line 82 static int ox_io_init(int); |
|
static void push_one(Obj); |
static void push_one(Obj); |
static Obj pop_one(); |
static Obj pop_one(); |
static void do_cmd(int); |
static void do_cmd(int); |
|
static void terminate_server(); |
|
|
static Obj *asir_OperandStack; |
static Obj *asir_OperandStack; |
static int asir_OperandStackPtr; |
static int asir_OperandStackPtr; |
|
|
#if defined(SIGUSR1) |
#if defined(SIGUSR1) |
signal(SIGUSR1,SIG_IGN); |
signal(SIGUSR1,SIG_IGN); |
#endif |
#endif |
|
#if defined(SIGTERM) |
|
signal(SIGTERM,terminate_server); |
|
#endif |
|
|
if ( accept_client ) { |
if ( accept_client ) { |
cs = try_bind_listen(use_unix,control_port_str); |
cs = try_bind_listen(use_unix,control_port_str); |
|
|
close(i); |
close(i); |
#endif |
#endif |
} |
} |
if ( !strcmp(dname,"1" ) ) /* XXX: for ssh */ |
if ( !nolog && !strcmp(dname,"1" ) ) /* XXX: for ssh */ |
execl(prog,prog,0); |
execl(prog,prog,0); |
else if ( nolog || !strcmp(dname,"0") ) { |
else if ( nolog || !strcmp(dname,"0") ) { |
FILE *null; |
FILE *null; |
|
|
null = fopen("/dev/null","wb"); |
null = fopen("/dev/null","wb"); |
dup2(fileno(null),1); |
dup2(fileno(null),1); |
dup2(fileno(null),2); |
dup2(fileno(null),2); |
if ( !nolog ) { |
if ( !strcmp(dname,"1") ) { |
|
/* XXX */ |
putenv("DISPLAY="); |
putenv("DISPLAY="); |
execl(prog,prog,0); |
execl(prog,prog,0); |
} else |
} else if ( strcmp(dname,"0") ) |
execl(prog,prog,"-display",dname,0); |
execl(prog,prog,"-display",dname,0); |
|
else { |
|
putenv("DISPLAY="); |
|
execl(prog,prog,0); |
|
} |
} else |
} else |
execl(prog,prog,"-display",dname,0); |
execl(prog,prog,"-display",dname,0); |
/* On failure */ |
/* On failure */ |
Line 403 static Obj pop_one() { |
|
Line 412 static Obj pop_one() { |
|
if ( asir_OperandStackPtr >= 0 ) { |
if ( asir_OperandStackPtr >= 0 ) { |
return asir_OperandStack[asir_OperandStackPtr--]; |
return asir_OperandStack[asir_OperandStackPtr--]; |
} |
} |
|
} |
|
|
|
static void terminate_server() |
|
{ |
|
#if defined(SIGKILL) |
|
kill(cpid,SIGKILL); |
|
#endif |
|
exit(0); |
} |
} |
|
|