revert between 56095 -> 55830 in arch
[AROS.git] / compiler / autoinit / __showerror.c
blob50e26281090df2a626de1cfa69536348f0d30400
1 /*
2 Copyright � 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: autoinit library - support function for showing errors to the user
6 Lang: english
7 */
9 #include <exec/rawfmt.h>
10 #include <proto/exec.h>
11 #include <proto/dos.h>
12 #include <proto/intuition.h>
13 #include <aros/autoinit.h>
14 #include <aros/debug.h>
16 #include <stdarg.h>
18 const int __forceerrorrequester __attribute__((weak)) = 0;
20 static AROS_UFH2(IPTR, RawPutc,
21 AROS_UFHA(UBYTE, c, D0),
22 AROS_UFHA(struct ExecBase *, SysBase, A3))
24 AROS_USERFUNC_INIT
25 if (c)
26 RawPutChar(c);
27 return c;
28 AROS_USERFUNC_EXIT
31 void ___showerror(struct ExecBase *SysBase, const char *format, ...)
33 struct IntuitionBase *IntuitionBase;
34 struct DosLibrary *DOSBase = NULL;
35 const char *name = FindTask(NULL)->tc_Node.ln_Name;
37 AROS_SLOWSTACKFORMAT_PRE(format);
41 !__forceerrorrequester &&
42 (DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 0)) != NULL &&
43 Cli() != NULL &&
44 Output() != BNULL
47 if (name)
49 PutStr(name);
50 PutStr(": ");
53 VPrintf(format, AROS_SLOWSTACKFORMAT_ARG(format));
55 PutStr("\n");
58 else
59 if ((IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 0)))
61 struct EasyStruct es =
63 sizeof(struct EasyStruct),
65 name,
66 format,
67 "Exit"
70 EasyRequestArgs(NULL, &es, NULL, AROS_SLOWSTACKFORMAT_ARG(format));
72 CloseLibrary((struct Library *)IntuitionBase);
74 else
76 if (name) {
77 RawDoFmt("%s: ", (RAWARG)&name, (VOID_FUNC)RawPutc, SysBase);
80 RawDoFmt(format, AROS_SLOWSTACKFORMAT_ARG(format), (VOID_FUNC)RawPutc, SysBase);
81 RawPutChar('\n');
84 AROS_SLOWSTACKFORMAT_POST(format);
86 CloseLibrary((struct Library *)DOSBase);