2 Copyright © 2003-2016, The AROS Development Team. All rights reserved.
6 #include <exec/memory.h>
9 #include <proto/exec.h>
10 #include <proto/dos.h>
11 #include <proto/muimaster.h>
18 STRPTR
GetENV(CONST_STRPTR name
)
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)
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
)
49 STRPTR newline
= "\n",
53 /* Never use IO error if it is 0 */
54 if (IoErr() == 0) useIOError
= FALSE
;
58 Fault(IoErr(), NULL
, buffer
, sizeof(buffer
));
59 buffer
[0] = toupper(buffer
[0]);
70 application
, window
, 0, _(MSG_TITLE
), _(MSG_ERROR_OK
),
71 "%s:\n%s%s%s%s", _(MSG_ERROR_HEADER
), message
, newline
, extra
, period