2 Copyright © 1995-2005, The AROS Development Team. All rights reserved.
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
13 #include <proto/intuition.h>
14 #include <aros/debug.h>
16 #include <intuition/intuition.h>
19 #include "baseredef.h"
22 * showReqType matches adequate option[] in showPtrArgsText.
34 * showReqStruct: a group describing particular requester:
35 * - text - content to be displayed
36 * - type - set of buttons for the requester
41 enum showReqType type
;
45 * displays requester on screen or puts text to the debug buffer
47 LONG
showPtrArgsText(struct AFSBase
*afsbase
, char *string
, enum showReqType type
, ULONG
*args
)
58 struct EasyStruct es
={sizeof (struct EasyStruct
),0,"AFFS",0,options
[type
]};
60 es
.es_TextFormat
=string
;
61 #if (AROS_FLAVOUR & AROS_FLAVOUR_STANDALONE)
62 if (IntuitionBase
->FirstScreen
!= NULL
)
65 return EasyRequestArgs(NULL
,&es
,NULL
,args
);
66 #if (AROS_FLAVOUR & AROS_FLAVOUR_STANDALONE)
70 #warning "kprintf for error printing when gfx.hidd is not initialized"
71 vkprintf(string
, args
);
78 void showText(struct AFSBase
*afsbase
, char *string
, ...)
80 showPtrArgsText(afsbase
, string
, Req_Cancel
, (ULONG
*)(&string
+1));
83 LONG
showRetriableError(struct AFSBase
*afsbase
, TEXT
*string
, ...)
85 return showPtrArgsText(afsbase
, string
, Req_RetryCancel
, (ULONG
*)(&string
+1));
88 LONG
showError(struct AFSBase
*afsbase
, ULONG error
, ...)
90 struct showReqStruct texts
[] =
93 {"No ioport", Req_Cancel
},
94 {"Couldn't open device %s", Req_Cancel
},
95 {"Couldn't add disk as dosentry", Req_Cancel
},
96 {"Disk is not validated!", Req_CheckCancel
},
97 {"Wrong data block %lu", Req_Cancel
},
98 {"Wrong checksum on block %lu", Req_CheckCancel
},
99 {"Missing some more bitmap blocks", Req_Cancel
},
100 {"Wrong blocktype on block %lu", Req_CheckCancel
},
101 {"Read/Write Error %ld accessing block %lu", Req_Cancel
},
102 {"*** This may be a non-AFS disk. ***\n"
103 "Any attempt to fix it in this case may render the original\n"
104 "file system invalid, and its contents unrecoverable.\n\n"
105 "Please select what to do", Req_ContinueCancel
},
106 {"Block %lu used twice", Req_Cancel
},
107 {"Block %lu is located outside volume scope\nand will be removed.", Req_Continue
},
108 {"Repairing disk structure will lead to data loss.\n"
109 "It's best to make a backup before proceeding.\n\n"
110 "Please select what to do.", Req_ContinueCancel
},
112 {"Unknown error", Req_Cancel
}
115 if (error
== ERR_ALREADY_PRINTED
)
117 if (error
>= ERR_UNKNOWN
)
119 return showPtrArgsText(afsbase
, texts
[ERR_UNKNOWN
].text
, texts
[ERR_UNKNOWN
].type
, (ULONG
*)&error
);
122 return showPtrArgsText(afsbase
, texts
[error
].text
, texts
[error
].type
, (ULONG
*)(&error
+1));
126 /* vim: set ts=3 noet fdm=marker fmr={,}: */