2 Copyright © 2009, The AROS Development Team. All rights reserved.
5 Desc: autoinit library - handle program started from workbench.
8 #include <dos/dosextens.h>
9 #include <aros/startup.h>
10 #include <aros/symbolsets.h>
11 #include <proto/dos.h>
12 #include <workbench/startup.h>
15 #include <aros/debug.h>
17 struct WBStartup
*WBenchMsg
;
19 int __nowbsupport
__attribute__((weak
)) = 0;
21 static void __startup_fromwb(struct ExecBase
*SysBase
)
23 struct Process
*myproc
;
26 D(bug("Entering __startup_fromwb()\n"));
28 myproc
= (struct Process
*)FindTask(NULL
);
30 /* Do we have a CLI structure? */
33 /* Workbench startup. Get WBenchMsg and pass it to main() */
35 WaitPort(&myproc
->pr_MsgPort
);
36 WBenchMsg
= (struct WBStartup
*)GetMsg(&myproc
->pr_MsgPort
);
37 __argv
= (char **) WBenchMsg
;
40 /* WB started processes' pr_CurrentDir = BNULL */
41 curdir
= DupLock(WBenchMsg
->sm_ArgList
->wa_Lock
);
44 D(bug("[startup] Started from Workbench\n"));
47 __startup_entries_next();
49 /* Reply startup message to Workbench */
52 /* Close original lock */
56 Forbid(); /* make sure we're not UnLoadseg()ed before we're really done */
57 ReplyMsg((struct Message
*) WBenchMsg
);
60 D(bug("Leaving __startup_fromwb\n"));
63 ADD2SET(__startup_fromwb
, PROGRAM_ENTRIES
, -50);