Fixes to comments.
[AROS.git] / compiler / autoinit / __showerror.c
bloba24b5672574e3f832652e450d33ab91bca39fc01
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 int __forceerrorrequester __attribute__((weak)) = 0;
20 void __showerror(char *format, const IPTR *args)
22 struct IntuitionBase *IntuitionBase;
23 struct DosLibrary *DOSBase = NULL;
24 const char *name = FindTask(NULL)->tc_Node.ln_Name;
28 !__forceerrorrequester &&
29 (DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 0)) != NULL &&
30 Cli() != NULL
33 if (name)
35 PutStr(name);
36 PutStr(": ");
39 if (args)
40 VPrintf(format, (IPTR*)args);
41 else
42 PutStr(format);
44 PutStr("\n");
46 CloseLibrary((struct Library *)DOSBase);
48 else
49 if ((IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 0)))
51 struct EasyStruct es =
53 sizeof(struct EasyStruct),
55 name,
56 format,
57 "Exit"
60 EasyRequestArgs(NULL, &es, NULL, (APTR)args);
62 CloseLibrary((struct Library *)IntuitionBase);
64 else
66 if (name) {
67 IPTR args[] = { (IPTR)name };
68 RawDoFmt("%s: ", (APTR)args, (VOID_FUNC)RAWFMTFUNC_SERIAL, NULL);
71 RawDoFmt(format, (APTR)args, (VOID_FUNC)RAWFMTFUNC_SERIAL, NULL);
72 RawPutChar('\n');