Tested and debugged ToolTypes.
[AROS.git] / compiler / autoinit / fromwb.c
blob8d00bb2560f55cd278ea307681fb67c1920753a4
1 /*
2 Copyright © 2009, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: autoinit library - handle program started from workbench.
6 */
7 #include <dos/dos.h>
8 #include <dos/dosextens.h>
9 #include <aros/startup.h>
10 #include <aros/symbolsets.h>
12 #define DEBUG 0
13 #include <aros/debug.h>
15 struct WBStartup *WBenchMsg;
17 int __nowbsupport __attribute__((weak)) = 0;
19 static void __startup_fromwb(void)
21 struct Process *myproc;
23 D(bug("Entering __startup_fromwb()\n"));
25 myproc = (struct Process *)FindTask(NULL);
27 /* Do we have a CLI structure? */
28 if (!myproc->pr_CLI)
30 /* Workbench startup. Get WBenchMsg and pass it to main() */
32 WaitPort(&myproc->pr_MsgPort);
33 WBenchMsg = (struct WBStartup *)GetMsg(&myproc->pr_MsgPort);
34 __argv = (char **) WBenchMsg;
35 __argc = 0;
37 D(bug("[startup] Started from Workbench\n"));
40 __startup_entries_next();
42 /* Reply startup message to Workbench */
43 if (WBenchMsg)
45 Forbid(); /* make sure we're not UnLoadseg()ed before we're really done */
46 ReplyMsg((struct Message *) WBenchMsg);
49 D(bug("Leaving __startup_fromwb\n"));
52 ADD2SET(__startup_fromwb, program_entries, -50);