add NOWARN_SIZEOF_POINTER_MEMACCESS
[AROS.git] / rom / dos / printfault.c
blobebfaafb8285d59baca5b93273d5b5bff8cf925e6
1 /*
2 Copyright © 1995-2013, 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_PROCESS(me);
64 ASSERT_VALID_PTR_OR_NULL(BADDR(stream));
65 ASSERT_VALID_PTR_OR_NULL(header);
67 /* Fault() will do all the formatting of the string */
68 Fault(code, NULL, buffer, 80);
70 if (code == 0)
72 ret = DOSTRUE;
74 else if (header != NULL)
76 if(!FPuts(stream, header) && !FPuts(stream, ": ") &&
77 !FPuts(stream, buffer) && !FPuts(stream, "\n"))
79 ret = DOSTRUE;
81 else
83 ret = DOSFALSE;
86 else
88 if (!FPuts(stream, buffer) && !FPuts(stream,"\n"))
90 ret = DOSTRUE;
92 else
94 ret = DOSFALSE;
98 /* All done. */
99 SetIoErr(code);
101 return ret;
103 AROS_LIBFUNC_EXIT
104 } /* PrintFault */