[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | DECWINDOWS 26-JAN-89 to 29-NOV-90 |
Notice: | See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit |
Moderator: | STAR::VATNE |
|
Created: | Mon Oct 30 1989 |
Last Modified: | Mon Dec 31 1990 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 3726 |
Total number of notes: | 19516 |
2842.0. "CREATE/TERMINAL from a subprocess" by TMIS01::DORON (Doing my BEST !!!) Thu May 31 1990 07:11
Hi,
I have tried to CREATE/TERMINAL from a subprocess that was created by an IMAGE
(using the LIB$SPAWN command). The result was that the new terminal window
appeared for a while and then disappeared (without giving any message). When I
gave the command CREATE/TERMINAL/DETACH it worked fine and when I gave the
command CREATE/TERMINAL/NOPROCESS it opened a new window and asked for Username
(as expected). I enclose a small C program that calls LIB$SPAWN and waits
without prompt for your input (just enter the DCL command U wish to be
performed). The question is, why does it happen when while trying to
CREATE/TERMINAL and let it be opend as another subprocess?
-------------------------------Cut Here----------------------------------------
/*
*
* Run the program and give it any dcl command you like
* create/terminal .....
* does not work.
* edit/tpu/disp=decw
* works fine.
*
*/
#include <clidef.h>
#include <descrip.h>
typedef char *string;
#define EOS '\0'
char spawn_cmd_error[80];
int
spawn_command(command)
string command;
{
struct dsc$descriptor_s cmddesc;
struct dsc$descriptor_s prmdesc;
int status, real_status;
int sa;
char mes_l[80+1];
char err_msg[80+1];
char str[256];
static $DESCRIPTOR(STR,"");
unsigned short m_len;
int i,s;
double x;
string serr;
static int event_flag= -1;
str[0] = EOS;
if(event_flag == -1){
if(!((s = lib$get_ef(&event_flag)) & 1)){
STR.dsc$a_pointer = str;
STR.dsc$w_length = 256;
sys$getmsg(s,&m_len,&STR,15,0);
str[m_len]=EOS;
strcpy(spawn_cmd_error,str);
return s;
}
}
cmddesc.dsc$w_length=strlen(command);
cmddesc.dsc$a_pointer=command;
cmddesc.dsc$b_class=DSC$K_CLASS_S;
cmddesc.dsc$b_dtype=DSC$K_DTYPE_T;
status = lib$spawn(&cmddesc,0,0,/*&CLI$M_NOWAIT*/0,0,0,&real_status,&event_flag,
0,0,0,0);
if(!((s=sys$waitfr(event_flag)) & 1)){
STR.dsc$a_pointer = str;
STR.dsc$w_length = 256;
sys$getmsg(s,&m_len,&STR,15,0);
str[m_len]=EOS;
strcpy(spawn_cmd_error,str);
return s;
}
if ( (!( status & 1 )) || (!( real_status & 1 )) ) {
if ( ! ( status & 1) )
sa=status;
else
sa=real_status;
STR.dsc$a_pointer = str;
STR.dsc$w_length = 256;
s = sys$getmsg(sa,&m_len,&STR,15,0);
str[m_len]=EOS;
}
strcpy(spawn_cmd_error,str);
if ( ! ( status & 1) )
return status;
else
return real_status;
}
main()
{
char buf[100];
for(;;){
gets(buf);
printf("%s\n",buf);
printf(" %d %s\n",spawn_command(buf),spawn_cmd_error);
}
}
T.R | Title | User | Personal Name | Date | Lines |
---|
2842.1 | Try CREATE/TERMINAL/WAIT | BOMBE::MOORE | Eat or be eaten | Thu May 31 1990 19:34 | 4 |
| This sounds like the same problem often encountered when using
CREATE/TERMINAL for applications started from the Session Manager.
Basically, CREATE/TERMINAL does not wait for the created process to
end (i.e. it's like SPAWN/NOWAIT).
|