=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/io/ox_launch.c,v retrieving revision 1.8 retrieving revision 1.12 diff -u -p -r1.8 -r1.12 --- OpenXM_contrib2/asir2000/io/ox_launch.c 2000/11/07 06:35:39 1.8 +++ OpenXM_contrib2/asir2000/io/ox_launch.c 2001/06/06 02:21:40 1.12 @@ -44,7 +44,7 @@ * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. - * $OpenXM: OpenXM_contrib2/asir2000/io/ox_launch.c,v 1.7 2000/10/06 06:05:23 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/io/ox_launch.c,v 1.11 2000/12/16 07:12:01 noro Exp $ */ #include #include @@ -76,7 +76,7 @@ HANDLE hIntr,hReset,hKill; static void put_log(char *); static int which_command(char *,char *); static int search_command(char *); -static int ox_spawn(char *,int,char *); +static int ox_spawn(char *,int,char *,int); static void launch_error(char *); static int ox_io_init(int); static void push_one(Obj); @@ -148,6 +148,7 @@ char *file; argv[4] : server_port argv[5] : server argv[6] : display or "0" + argv[7] : if exists, it should be "-nolog" */ void launch_main(argc,argv) @@ -160,7 +161,7 @@ char **argv; char buf[BUFSIZ]; int cs,ss; unsigned int cmd; - int use_unix,accept_client; + int use_unix,accept_client,nolog; char *control_port_str,*server_port_str; char *rhost,*server,*dname; @@ -173,6 +174,7 @@ char **argv; server_port_str = argv[4]; server = argv[5]; dname = argv[6]; + nolog = argc > 7 ? 1 : 0; #if defined(VISUAL) init_socket(); @@ -195,7 +197,7 @@ char **argv; ox_io_init(cs); if ( cs < 0 || ss < 0 ) launch_error("cannot connect to the client"); - cpid = ox_spawn(server,ss,dname); + cpid = ox_spawn(server,ss,dname,nolog); while ( 1 ) { ox_recv(sindex,&id,&obj); @@ -277,10 +279,11 @@ int cmd; } #endif -static int ox_spawn(prog,bs,dname) +static int ox_spawn(prog,bs,dname,nolog) char *prog; int bs; char *dname; +int nolog; { #if defined(VISUAL) char *av[BUFSIZ]; @@ -313,11 +316,7 @@ char *dname; av[5] = ox_kill; av[6] = NULL; Pget_rootdir(&rootdir); - if ( !strcmp(prog,"ox_plot") ) { -// sprintf(AsirExe,"d:\\home\\noro\\ox_plot\\debug\\ox_plot.exe"); - sprintf(AsirExe,"%s\\bin\\ox_plot.exe",BDY(rootdir)); - } else - sprintf(AsirExe,"%s\\bin\\engine.exe",BDY(rootdir)); + sprintf(AsirExe,"%s\\bin\\engine.exe",BDY(rootdir)); _fileinfo = 1; hProc = _spawnv(_P_NOWAIT,AsirExe,av); return (int)hProc; @@ -354,16 +353,24 @@ char *dname; close(i); #endif } - if ( !strcmp(dname,"1" ) ) /* XXX: for ssh */ + if ( !nolog && !strcmp(dname,"1" ) ) /* XXX: for ssh */ execl(prog,prog,0); - else if ( !strcmp(dname,"0") ) { + else if ( nolog || !strcmp(dname,"0") ) { FILE *null; null = fopen("/dev/null","wb"); dup2(fileno(null),1); dup2(fileno(null),2); - putenv("DISPLAY="); - execl(prog,prog,0); + if ( !strcmp(dname,"1") ) { + /* XXX */ + putenv("DISPLAY="); + execl(prog,prog,0); + } else if ( strcmp(dname,"0") ) + execl(prog,prog,"-display",dname,0); + else { + putenv("DISPLAY="); + execl(prog,prog,0); + } } else execl(prog,prog,"-display",dname,0); /* On failure */