Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / system / Wanderer / Tools / ExecuteCommand / main.c
blob29a849ac66dd946e2ef4eb2cda060c037f18c9fb
1 /*
2 Copyright © 2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define MUIMASTER_YES_INLINE_STDARG
8 #include <aros/debug.h>
10 #include <proto/intuition.h>
11 #include <proto/muimaster.h>
12 #include <proto/workbench.h>
13 #include <proto/dos.h>
15 #include <dos/dos.h>
16 #include <libraries/mui.h>
17 #include <workbench/startup.h>
19 #include <stdlib.h>
21 #include "executecommand.h"
22 #include "locale.h"
23 #include "support.h"
25 void cleanup(CONST_STRPTR message)
27 ExecuteCommand_Deinitialize();
29 if (message != NULL)
31 ShowError(NULL, NULL, message, TRUE);
32 exit(RETURN_FAIL);
34 else
36 exit(RETURN_OK);
40 int main(int argc, char **argv)
42 Object *application;
43 BPTR parent = NULL;
44 STRPTR initial = NULL;
46 if (!ExecuteCommand_Initialize()) cleanup(_(MSG_ERROR_CLASSES));
48 if (argc == 0)
50 struct WBStartup *startup = (struct WBStartup *) argv;
52 if (startup->sm_NumArgs > 1)
54 parent = startup->sm_ArgList[1].wa_Lock;
55 initial = startup->sm_ArgList[1].wa_Name;
59 application = (Object *)ExecuteCommandObject,
60 MUIA_ExecuteCommand_Parent, (IPTR) parent,
61 MUIA_ExecuteCommand_Initial, (IPTR) initial,
62 End;
64 if (application != NULL)
66 DoMethod(application, MUIM_Application_Execute);
67 MUI_DisposeObject(application);
70 cleanup(NULL);
72 return 0; /* make compiler happy */