revert between 56095 -> 55830 in arch
[AROS.git] / rom / filesys / afs / error.c
blobcd5186680ef8f1db7c434d8f30c8096e72c6853c
1 /*
2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 /*
7 * -date------ -name------------------- -description-----------------------------
8 * 02-jan-2008 [Tomasz Wiszkowski] added disk check option for broken disks
9 * 04-jan-2008 [Tomasz Wiszkowski] corrected tabulation
12 #include <proto/intuition.h>
13 #include <aros/debug.h>
14 #include <exec/rawfmt.h>
15 #include <intuition/intuition.h>
17 #include "os.h"
18 #include "error.h"
19 #include "errstrings.h"
20 #include "baseredef.h"
24 * displays requester on screen or puts text to the debug buffer
26 LONG showPtrArgsText(struct AFSBase *afsbase, const char *string, enum showReqType type, RAWARG args)
28 LONG answer = 0;
29 char* options[] =
31 "Cancel",
32 "Retry|Cancel",
33 "Check disk|Cancel",
34 "Continue|Cancel",
35 "Continue",
36 NULL
38 struct EasyStruct es={sizeof (struct EasyStruct),0,"AFFS",0,options[type]};
39 struct IntuitionBase *IntuitionBase;
41 IntuitionBase = (APTR)OpenLibrary("intuition.library", 39);
42 if (IntuitionBase != NULL)
44 es.es_TextFormat=string;
46 if (IntuitionBase->FirstScreen != NULL)
48 answer = EasyRequestArgs(NULL,&es,NULL,args);
50 CloseLibrary((struct Library *)IntuitionBase);
52 else
54 /* We use serial for error printing when gfx.hidd is not initialized */
55 RawDoFmt(string, args, RAWFMTFUNC_SERIAL, NULL);
56 RawPutChar('\n');
59 return answer;
62 LONG showError(struct AFSBase *afsbase, ULONG error, ...)
64 LONG ret;
66 if (error == ERR_ALREADY_PRINTED)
67 ret = 0;
68 else if (error >= ERR_UNKNOWN)
69 ret = showPtrArgsText(afsbase, texts[ERR_UNKNOWN].text, texts[ERR_UNKNOWN].type, (RAWARG)&error);
70 else {
71 AROS_SLOWSTACKFORMAT_PRE_USING(error, texts[error].text);
72 ret = showPtrArgsText(afsbase, texts[error].text, texts[error].type, AROS_SLOWSTACKFORMAT_ARG(error));
73 AROS_SLOWSTACKFORMAT_POST(error);
76 return ret;
80 /* vim: set ts=3 noet fdm=marker fmr={,}: */