From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 27-JUL-1990 03:51:26.93
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	Re: Running my own image in a detached decwindow

Received:  by crdgw1.ge.com (5.57/GE 1.70)
	 id AA24980; Wed, 25 Jul 90 00:37:27 EDT
Received: From UCBVAX.BERKELEY.EDU by CRVAX.SRI.COM with TCP; Tue, 24 JUL 90 21:23:08 PDT
Received: by ucbvax.Berkeley.EDU (5.63/1.42)
	id AA00572; Tue, 24 Jul 90 21:04:01 -0700
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 25 Jul 90 14:59:26 GMT
From: bacchus.pa.dec.com!shlump.nac.dec.com!mountn.dec.com!hkov04.dec.com!terence@decwrl.dec.com  (Terence Lee @HKO, Digital Equipment Corporation)
Organization: Digital Equipment Corporation, Hong Kong
Subject: Re: Running my own image in a detached decwindow
Message-Id: <1789@mountn.dec.com>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com


In article <254@talarian.UUCP>, tim@talarian.UUCP (Tim Young) writes...
#I am running DECwindows under VMS 5.2 and am trying to write a program which
#uses DECw$Term_Port and sys$creprc to create a new DECwindow running another of
#my programs. I found some routines in the VMS 5.2 release notes (page 4-19)
#which allow me to create a logged-in decterm, but when I try to replace the
#command "SYS$SYSTEM:LOGINOUT.EXE" with a call to my own program, things start
#getting wierd. It seems the SYS$OUTPUT and SYS$ERROR do not get defined, so
#my program creates a decterm, then the printf statements in my code write to a
#file called SYS$OUTPUT.;1 and the decterm goes away. If you have figured out
#how to solve this dilemma, I would appreciate hearing from you.
#
#Tim Young
#Talarian Corp.

Following is an example. NEVER use logical names like SYS$LOGIN, SYS$OUTPUT
in the sys$creprc() routine call.

#include <ssdef.h>
#include <stdio.h>
#include <prcdef.h>
#include <descrip.h>

#define MAX_descriptorS         32              /* Number of descriptors. */

int     descrS_index = 0;
struct dsc$descriptor_s descriptorS[MAX_descriptorS];

#define descrS(string,len) ( \
        descrS_index = (descrS_index == MAX_descriptorS) ? 0 : descrS_index, \
        descriptorS[descrS_index].dsc$a_pointer = (string), \
        descriptorS[descrS_index].dsc$w_length = (len) ? len : strlen(string), \
        descriptorS[descrS_index].dsc$b_dtype = DSC$K_DTYPE_T, \
        descriptorS[descrS_index].dsc$b_class = DSC$K_CLASS_S, \
        &descriptorS[descrS_index++])

main()
{
        unsigned long status;
        int     len;
        char    image[128],terminal[64];

        printf("Image name: "); scanf("%s",image);

        status = DECwTermPort(0,0,0,terminal,&len);
        if (status != SS$_NORMAL) exit(status);
        terminal[len] = 0;

        status = sys$creprc(0,descrS(image,0),descrS(terminal,0),
            descrS(terminal,0),descrS(terminal,0),0,0,0,0,0,0,PRC$M_DETACH);
        if (status != SS$_NORMAL) exit(status);
}

================================================================================
Terence Lee          | terence%hkov04.dec@decwrl.dec.com
                     | root%hkvs04.dec@decwrl.dec.com
=====================+==========================================================
From Middlesex, UWO  | Just forget what I've said. I don't know it neither.
================================================================================

