alsa.audio: move handling of XRUN when writting to the slave task
[AROS.git] / rom / filesys / SFS / SFSdefrag / support.c
blob9422d92d00d49ae28e52bd4c3e65d98f6b4d3846
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 "support.h"
16 #include "locale.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, "SFS Defrag", "Ok",
71 "%s:\n%s%s%s%s", "ERROR", message, newline, extra, period