[comp.sys.amiga.tech] Process Startup... from WB or another process?

terry@chaplin.uwo.ca (Terry Cudney) (10/04/90)

Hi all,

     Is there an officially accepted way for a process to determine how
it was started?

     It's easy to tell if it started from WB or CLI. But how does it know
if it was started from another Process (which PutMsg'ed a WBStartup to get
it going)?

     I have a suite of programs that can be individually launched from CLI
or WB, or from a master control program which orchestrates the whole suite.
In each slave program I check pr -> CLI to see if it was launched from CLI,
If not I assume it was launched from either WB or the master program. Here
is my question:

     How should the new process determine if it was started from WB or
from another application process?

     In the master program all ports are created without names so that multiple
master programs/suites can be run concurrently without name collisions.
What I've been doing is:

strcmp(WBStartup.sm_Message.mn_ReplyPort -> mp_Node.ln_Name, "Workbench")

     If a match, assume WB launched us, otherwise assume the master program
launched us. Is this safe? Or is there a better way?
Thanks for any help you can give.
--terry

/*
 * terry@chaplin.csd.uwo.ca
 * Terry Cudney Amistosa MicroWare 9 Durham Street, LONDON, Ontario, N5Y 2H9
 */

--
--terry

/*
 * terry@chaplin.csd.uwo.ca

ken@cbmvax.commodore.com (Ken Farinsky - CATS) (10/04/90)

In article <1083@ria.ccs.uwo.ca> terry@chaplin.uwo.ca (Terry Cudney) writes:
>     Is there an officially accepted way for a process to determine how
>it was started?
>...easy to tell if it started from WB or CLI...
>     How should the new process determine if it was started from WB or
>from another application process?

Have you tried putting data in the WBStartup message or WBArg list that
tells the process that it was started by your control program?
-- 
--
Ken Farinsky - CATS - (215) 431-9421 - Commodore Business Machines
uucp: ken@cbmvax.commodore.com   or  ...{uunet,rutgers}!cbmvax!ken
bix:  kfarinsky

terry@chaplin.uwo.ca (Terry Cudney) (10/14/90)

Hi all,

     Is there an officially sanctioned way for a process to determine how
it was started?

     It's easy to tell if it started from WB or CLI. But how does it know
if it was started from another Process (which PutMsg'ed a WBStartup to get
it going)? How should the new process determine if it was started from WB
or from another application process?

     I have a suite of programs that can be individually launched from CLI
or WB, or from a master control program which orchestrates the whole suite.
In each slave program I check pr -> CLI to see if it was launched from CLI,
If not I assume it was launched from either WB or the master program.
In the master program all ports are created without names so that multiple
master programs/suites can be run concurrently without name collisions.

What I've been doing is:

     if  (strcmp(WBStartup.sm_Message.mn_ReplyPort -> mp_Node.ln_Name,
                "Workbench") == 0)
         /* launched by WB */
     else
         /* launced by control process */

     Is this safe? Or is there a better way?
Thanks for any help you can give.
--terry

/*
 * terry@chaplin.csd.uwo.ca
 * Terry Cudney Amistosa MicroWare 9 Durham Street, LONDON, Ontario, N5Y 2H9
 */

--
--terry

/*
 * terry@chaplin.csd.uwo.ca