revert between 56095 -> 55830 in arch
[AROS.git] / workbench / system / Wanderer / Tools / ExecuteCommand / main.c
blob4cc8f6cfe07850abcbac0b26faedfb08fb9c9557
1 /*
2 Copyright © 2003-2011, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define MUIMASTER_YES_INLINE_STDARG
8 #include <aros/debug.h>
10 #include <proto/alib.h>
11 #include <proto/intuition.h>
12 #include <proto/muimaster.h>
13 #include <proto/workbench.h>
14 #include <proto/dos.h>
16 #include <dos/dos.h>
17 #include <libraries/mui.h>
18 #include <workbench/startup.h>
20 #include <stdlib.h>
22 #include "executecommand.h"
23 #include "locale.h"
24 #include "support.h"
26 void cleanup(CONST_STRPTR message)
28 ExecuteCommand_Deinitialize();
30 if (message != NULL)
32 ShowError(NULL, NULL, message, TRUE);
33 exit(RETURN_FAIL);
35 else
37 exit(RETURN_OK);
41 int main(int argc, char **argv)
43 Object *application;
44 BPTR parent = BNULL;
45 STRPTR initial = NULL;
47 if (!ExecuteCommand_Initialize()) cleanup(_(MSG_ERROR_CLASSES));
49 if (argc == 0)
51 struct WBStartup *startup = (struct WBStartup *) argv;
53 if (startup->sm_NumArgs > 1)
55 parent = startup->sm_ArgList[1].wa_Lock;
56 initial = startup->sm_ArgList[1].wa_Name;
60 application = (Object *)ExecuteCommandObject,
61 MUIA_ExecuteCommand_Parent, (IPTR) parent,
62 MUIA_ExecuteCommand_Initial, (IPTR) initial,
63 End;
65 if (application != NULL)
67 DoMethod(application, MUIM_Application_Execute);
68 MUI_DisposeObject(application);
71 cleanup(NULL);
73 return 0; /* make compiler happy */