grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / utilities / Installer / cleanup.c
blobae2ae9d9ebcbfecbd072274c3e4dbaece0f33554
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 /* cleanup.c -- here are all functions used before exiting program */
8 #include "Installer.h"
9 #include "execute.h"
10 #include "locale.h"
11 #include "gui.h"
12 #include "procedure.h"
13 #include "variables.h"
14 #include "cleanup.h"
16 /* External variables */
17 extern ScriptArg script;
18 extern InstallerPrefs preferences;
19 extern int error;
22 void free_script(ScriptArg *first)
24 if (first != NULL)
26 free_script(first->cmd);
27 free_script(first->next);
28 free(first->arg);
29 free(first);
33 void cleanup()
35 if (preferences.transcriptstream != BNULL)
37 Close(preferences.transcriptstream);
40 free_script(script.cmd);
41 free_varlist();
42 deinit_gui();
43 Locale_Deinitialize();
46 void end_alloc()
48 #ifdef DEBUG
49 fprintf(stderr, "Couldn't allocate memory!\n");
50 #endif /* DEBUG */
51 cleanup();
52 exit(-1);
55 void outofmem(void * ptr)
57 if (ptr == NULL)
59 error = OUTOFMEMORY;
60 traperr("Out of memory!\n", NULL);