Updated PCI IDs to latest snapshot.
[tangerine.git] / rom / dos / printfault.c
blob2a341dce0ee9aa3d0ee6794f78b17b800b8cb0aa
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
8 #include <proto/exec.h>
9 #include "dos_intern.h"
11 #include <aros/debug.h>
14 /*****************************************************************************
16 NAME */
17 #include <proto/dos.h>
19 AROS_LH2(BOOL, PrintFault,
21 /* SYNOPSIS */
22 AROS_LHA(LONG, code, D1),
23 AROS_LHA(CONST_STRPTR, header, D2),
25 /* LOCATION */
26 struct DosLibrary *, DOSBase, 79, Dos)
28 /* FUNCTION
29 Prints the header and the text associated with the error code to
30 the console (buffered), then sets the value returned by IoErr() to
31 the error code given.
33 INPUTS
34 code -- Error code.
35 header -- Text to print before the error message. This may be NULL
36 in which case only the error message is printed.
38 RESULT
39 Boolean success indicator.
41 NOTES
43 EXAMPLE
45 BUGS
47 SEE ALSO
48 IoErr(), Fault(), SetIoErr()
50 INTERNALS
52 *****************************************************************************/
54 AROS_LIBFUNC_INIT
56 struct Process *me = (struct Process *)FindTask(NULL);
57 /* BPTR stream = me->pr_CES ? me->pr_CES : me->pr_COS; */
58 BPTR stream = me->pr_COS; /* unfortunately AmigaOS programs expect
59 this to be sent to Output() */
60 UBYTE buffer[80];
61 BOOL ret;
63 ASSERT_VALID_PTR(stream);
64 ASSERT_VALID_PTR_OR_NULL(header);
66 /* Fault() will do all the formatting of the string */
67 Fault(code, NULL, buffer, 80);
69 if (code == 0)
71 ret = DOSTRUE;
73 else if (header != NULL)
75 if(!FPuts(stream, header) && !FPuts(stream, ": ") &&
76 !FPuts(stream, buffer) && !FPuts(stream, "\n"))
78 ret = DOSTRUE;
80 else
82 ret = DOSFALSE;
85 else
87 if (!FPuts(stream, buffer) && !FPuts(stream,"\n"))
89 ret = DOSTRUE;
91 else
93 ret = DOSFALSE;
97 /* All done. */
98 SetIoErr(code);
100 return ret;
102 AROS_LIBFUNC_EXIT
103 } /* PrintFault */