Indentation fix, cleanup.
[AROS.git] / workbench / system / Wanderer / Tools / DiskInfo / main.c
blob85ab44ababd5c484db7a7024fb19d8d7fee9df09
1 /*
2 Copyright © 2005-2011, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define MUIMASTER_YES_INLINE_STDARG
8 #define DEBUG 0
9 #include <aros/debug.h>
11 #include <proto/alib.h>
12 #include <proto/intuition.h>
13 #include <proto/muimaster.h>
14 #include <proto/workbench.h>
15 #include <proto/dos.h>
17 #include <dos/dos.h>
18 #include <libraries/mui.h>
19 #include <workbench/startup.h>
21 #include <stdlib.h>
23 #include "diskinfo.h"
24 #include "locale.h"
25 #include "support.h"
27 void cleanup(CONST_STRPTR message)
29 DiskInfo_Deinitialize();
30 Locale_Deinitialize();
32 if (message != NULL)
34 ShowError(NULL, NULL, message, TRUE);
35 exit(RETURN_FAIL);
37 else
39 exit(RETURN_OK);
43 int main(int argc, char **argv)
45 Object *application;
46 BPTR initial = BNULL;
48 Locale_Initialize();
50 if (!DiskInfo_Initialize()) cleanup(_(MSG_ERROR_CLASSES));
52 if (argc != 0)
54 /* start from wanderer only */
55 DiskInfo_Deinitialize();
56 Locale_Deinitialize();
57 PrintFault(ERROR_OBJECT_WRONG_TYPE, argv[0]);
58 return RETURN_FAIL;
61 struct WBStartup *startup = (struct WBStartup *) argv;
62 if (startup->sm_NumArgs > 1)
64 initial = startup->sm_ArgList[1].wa_Lock;
65 D(bug("[DiskInfo] main, initial: 0x%08lX\n", initial));
66 application = (Object *)DiskInfoObject,
67 MUIA_DiskInfo_Initial, (IPTR) initial,
68 MUIA_DiskInfo_Aspect, 0,
69 End;
71 if (application != NULL)
73 DoMethod(application, MUIM_Application_Execute);
74 MUI_DisposeObject(application);
76 } else {
77 DiskInfo_Deinitialize();
78 Locale_Deinitialize();
79 PrintFault(ERROR_REQUIRED_ARG_MISSING, argv[0]);
80 return RETURN_FAIL;
82 cleanup(NULL);
84 return RETURN_OK; /* make compiler happy */