intuition.library wasn't closed after being opened to show an error message.
[AROS.git] / rom / filesys / afs / error.c
blobc423d883882a65a922b40944172297d6020d275e
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 "error.h"
18 #include "errstrings.h"
19 #include "baseredef.h"
23 * displays requester on screen or puts text to the debug buffer
25 LONG showPtrArgsText(struct AFSBase *afsbase, const char *string, enum showReqType type, IPTR *args)
27 LONG answer = 0;
28 char* options[] =
30 "Cancel",
31 "Retry|Cancel",
32 "Check disk|Cancel",
33 "Continue|Cancel",
34 "Continue",
35 NULL
37 struct EasyStruct es={sizeof (struct EasyStruct),0,"AFFS",0,options[type]};
38 struct IntuitionBase *IntuitionBase;
40 IntuitionBase = (APTR)OpenLibrary("intuition.library", 39);
41 if (IntuitionBase != NULL)
43 es.es_TextFormat=string;
45 if (IntuitionBase->FirstScreen != NULL)
47 answer = EasyRequestArgs(NULL,&es,NULL,args);
49 CloseLibrary((struct Library *)IntuitionBase);
51 else
53 /* We use serial for error printing when gfx.hidd is not initialized */
54 RawDoFmt(string, args, RAWFMTFUNC_SERIAL, NULL);
55 RawPutChar('\n');
58 return answer;
61 LONG showErrorArgs(struct AFSBase *afsbase, IPTR *args)
63 ULONG error = args[0];
65 if (error == ERR_ALREADY_PRINTED)
66 return 0;
67 else if (error >= ERR_UNKNOWN)
68 return showPtrArgsText(afsbase, texts[ERR_UNKNOWN].text, texts[ERR_UNKNOWN].type, args);
69 else
70 return showPtrArgsText(afsbase, texts[error].text, texts[error].type, &args[1]);
74 /* vim: set ts=3 noet fdm=marker fmr={,}: */