[net.micro.mac] Startup Applications

mike@smu (08/28/85)

Hi.  I have a small ignorance problem in the area of startup
applications.  Can an application figure out if it's being run as the
startup?  Is there something strange about the startup environment
(like what does it mean if a program runs from the finder but not as a
startup)?  Can the finder be told to pass an argument to the startup
application?

CONFUSED IN DALLAS

Mike McNally		SMU
mike@smu
...convex!smu!mike

vishniac@wanginst.UUCP (Ephraim Vishniac) (09/04/85)

> Hi.  I have a small ignorance problem in the area of startup
> applications.  Can an application figure out if it's being run as the
> startup?  Is there something strange about the startup environment
> (like what does it mean if a program runs from the finder but not as a
> startup)?  Can the finder be told to pass an argument to the startup
> application?
> 
> CONFUSED IN DALLAS
> 

Dear Confused:
	I don't know of any sure-fire way for an application to tell
that it is being run as the startup application.  It can take a guess
by inspecting the boot sectors of the startup disk: if the startup 
application listed there has some other name, then the present program
was certainly *not* the startup.

	The only strange feature of being run as the startup is that
no application has run before.  That means you can't cheat on all those
initialization calls.  Often, programs that neglect some initialization
calls will still run because some program has called them before and
(probably) left things in a useful state.  If you run normally, but not
as a startup, this may be the problem.

	The finder can't pass an argument to the startup application
because the finder doesn't launch the startup application: the system
does.  When you appear not to have a startup set, the finder is the
startup application.  So far as the system's concerned, launching the
finder is no different from launching anybody else.

-- 
Ephraim Vishniac
  [apollo, bbncca, cadmus, decvax, harvard, linus, masscomp]!wanginst!vishniac
  vishniac%Wang-Inst@Csnet-Relay

bhyde@inmet.UUCP (09/04/85)

  When a program isn't run from the finder, but is run as the startup
application, most all the tool box managers will not yet have been
initialized.  I presume that if you are clever you could use that fact
to tell you who launched the program.  The May sup. warns authors
to take care to test that their program will run when made the start
up application for this very reason.
  The bootstrap blocks on the disk have a slot for recording the 
first program to lanch, and a different slot for recording the program
to run when another program exits.  I have always presumed that the
set startup cmd in the finder writes the first of these slots, thus
changing the initial program and but leaving the second slot untouched.
One could check that out with fedit.
  The info about what program to run on exit of the current program is
moved into low core on boot and you can mess with it to make something other
than the finder the shell.
  I know of no way to launch the start up application with parameters, you
could leave defaults in a file someplace.
  There is one other way that the finder might implement "set as startup,"
i.e. using INIT resources.  These are code resources exectuted as the bootstrap
is done.  If one implemented startup applications that way, then you could
set the parameters of the startup application.
  ben hyde, cambridge.