revert between 56095 -> 55830 in arch
[AROS.git] / rom / hidds / pci / pcitool / support.c
bloba49263071161261277a14b4520c87aa6a4d76cdc
1 /*
2 Copyright © 2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <exec/memory.h>
7 #include <dos/var.h>
9 #include <proto/exec.h>
10 #include <proto/dos.h>
11 #include <proto/muimaster.h>
13 #include <ctype.h>
15 #include "locale.h"
16 #include "support.h"
18 STRPTR GetENV(CONST_STRPTR name)
20 UBYTE dummy = 0;
21 STRPTR value = NULL;
23 /* Check that the variable exists, and get the length */
24 if (GetVar(name, &dummy, 1, GVF_GLOBAL_ONLY) != -1)
26 ULONG length = IoErr() + 1;
28 if ((value = AllocVec(length, MEMF_ANY)) != NULL)
30 if (GetVar(name, value, length, GVF_GLOBAL_ONLY) == -1)
32 FreeVec(value);
33 value = NULL;
38 return value;
41 BOOL SetENV(CONST_STRPTR name, CONST_STRPTR value)
43 return SetVar(name, value, -1, GVF_GLOBAL_ONLY);
46 VOID ShowError(Object *application, Object *window, CONST_STRPTR message, BOOL useIOError)
48 TEXT buffer[128];
49 STRPTR newline = "\n",
50 period = ".",
51 extra = buffer;
53 /* Never use IO error if it is 0 */
54 if (IoErr() == 0) useIOError = FALSE;
56 if (useIOError)
58 Fault(IoErr(), NULL, buffer, sizeof(buffer));
59 buffer[0] = toupper(buffer[0]);
61 else
63 newline = "";
64 period = "";
65 extra = "";
68 MUI_Request
70 application, window, 0, _(MSG_TITLE), _(MSG_ERROR_OK),
71 "%s:\n%s%s%s%s", _(MSG_ERROR_HEADER), message, newline, extra, period