2 Copyright � 1995-2010, The AROS Development Team. All rights reserved.
5 Desc: autoinit library - support function for showing errors to the user
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>
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
))
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
&&
53 VPrintf(format
, AROS_SLOWSTACKFORMAT_ARG(format
));
59 if ((IntuitionBase
= (struct IntuitionBase
*)OpenLibrary("intuition.library", 0)))
61 struct EasyStruct es
=
63 sizeof(struct EasyStruct
),
70 EasyRequestArgs(NULL
, &es
, NULL
, AROS_SLOWSTACKFORMAT_ARG(format
));
72 CloseLibrary((struct Library
*)IntuitionBase
);
77 RawDoFmt("%s: ", (RAWARG
)&name
, (VOID_FUNC
)RawPutc
, SysBase
);
80 RawDoFmt(format
, AROS_SLOWSTACKFORMAT_ARG(format
), (VOID_FUNC
)RawPutc
, SysBase
);
84 AROS_SLOWSTACKFORMAT_POST(format
);
86 CloseLibrary((struct Library
*)DOSBase
);