Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / compiler / autoinit / __showerror.c
blob0d998dba5deda102cd1816f3ccef9c38f7763b42
1 /*
2 Copyright © 1995-2007, 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 <proto/exec.h>
10 #include <proto/dos.h>
11 #include <proto/intuition.h>
12 #include <aros/autoinit.h>
14 #include <stdarg.h>
16 int __forceerrorrequester __attribute__((weak)) = 0;
18 void __showerror(char *format, const IPTR *args)
20 struct IntuitionBase *IntuitionBase;
21 struct DosLibrary *DOSBase = NULL;
22 const char *name = FindTask(NULL)->tc_Node.ln_Name;
26 !__forceerrorrequester &&
27 (DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 0)) != NULL &&
28 Cli() != NULL
31 if (name)
33 PutStr(name);
34 PutStr(": ");
37 if (args)
38 VPrintf(format, args);
39 else
40 PutStr(format);
42 PutStr("\n");
44 else
45 if ((IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 0)))
47 struct EasyStruct es =
49 sizeof(struct EasyStruct),
51 name,
52 format,
53 "Exit"
56 EasyRequestArgs(NULL, &es, NULL, args);
58 CloseLibrary((struct Library *)IntuitionBase);
61 if (DOSBase != NULL)
62 CloseLibrary((struct Library *)DOSBase);