Fixed typo in structure name.
[AROS.git] / compiler / autoinit / __showerror.c
blobfa648be749dffcb15afd79902f8b482556f123d2
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(char *format, const IPTR *args, struct ExecBase *SysBase)
33 struct IntuitionBase *IntuitionBase;
34 struct DosLibrary *DOSBase = NULL;
35 const char *name = FindTask(NULL)->tc_Node.ln_Name;
39 !__forceerrorrequester &&
40 (DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 0)) != NULL &&
41 Cli() != NULL &&
42 Output() != BNULL
45 if (name)
47 PutStr(name);
48 PutStr(": ");
51 if (args)
52 VPrintf(format, (IPTR*)args);
53 else
54 PutStr(format);
56 PutStr("\n");
59 else
60 if ((IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 0)))
62 struct EasyStruct es =
64 sizeof(struct EasyStruct),
66 name,
67 format,
68 "Exit"
71 EasyRequestArgs(NULL, &es, NULL, (APTR)args);
73 CloseLibrary((struct Library *)IntuitionBase);
75 else
77 if (name) {
78 IPTR args[] = { (IPTR)name };
79 RawDoFmt("%s: ", (APTR)args, (VOID_FUNC)RawPutc, SysBase);
82 RawDoFmt(format, (APTR)args, (VOID_FUNC)RawPutc, SysBase);
83 RawPutChar('\n');
86 CloseLibrary((struct Library *)DOSBase);