whitespace
[AROS.git] / rom / dos / displayerror.c
blob4fce3335cdf0e2abd0ce54a3303a1786747debf1
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #include <proto/intuition.h>
10 #include <aros/debug.h>
12 #include <string.h>
14 #define CATCOMP_NUMBERS
16 #include "dos_intern.h"
17 #include "strings.h"
19 /*****i***********************************************************************
21 NAME */
22 #include <proto/dos.h>
24 AROS_LH3(LONG, DisplayError,
26 /* SYNOPSIS */
27 AROS_LHA(CONST_STRPTR, formatStr, A0),
28 AROS_LHA(ULONG , flags , D0),
29 AROS_LHA(APTR , args , A1),
31 /* LOCATION */
32 struct DosLibrary *, DOSBase, 81, Dos)
34 /* FUNCTION
35 Displays an error message to and gets response from a user.
37 INPUTS
38 formatStr - printf-style formatted string
39 flags - arguments to EasyRequestArgs()
40 args - arguments to 'formatStr'
42 RESULT
43 Nothing
45 NOTES
46 This is a PRIVATE dos function.
48 EXAMPLE
50 BUGS
52 SEE ALSO
54 INTERNALS
55 The purpose of this function is to put up a requester when an error
56 has occurred that is connected to the filesystem.
58 *****************************************************************************/
60 AROS_LIBFUNC_INIT
62 struct IntuitionBase *IntuitionBase = NULL;
63 struct Process *me = (struct Process *)FindTask(NULL);
64 struct Window *window; /* The window to put the requester in */
65 char gadTexts[128];
66 char *gtPtr = (char *)gadTexts;
67 ULONG idcmp = flags;
68 ULONG res;
70 struct EasyStruct es =
72 sizeof(struct EasyStruct),
73 0, /* flags */
74 DosGetString(MSG_STRING_REQUESTTITLE), /* "System Requester" */
75 (STRPTR)formatStr,
76 gadTexts /* "Retry|Cancel" */
79 ASSERT_VALID_PROCESS(me);
80 window = (struct Window *)me->pr_WindowPtr;
82 /* Supress requesters? */
83 if ((IPTR)window == (IPTR)-1L)
85 return 1;
88 if (DOSBase->dl_IntuitionBase == NULL)
90 DOSBase->dl_IntuitionBase = OpenLibrary("intuition.library", 37L);
93 if (DOSBase->dl_IntuitionBase == NULL)
95 return 1;
97 else
99 IntuitionBase = (struct IntuitionBase *)DOSBase->dl_IntuitionBase;
102 /* Create localised gadget texts */
103 strcpy(gtPtr, DosGetString(MSG_STRING_RETRY));
104 strcat(gtPtr, "|");
105 strcat(gtPtr, DosGetString(MSG_STRING_CANCEL));
107 res = EasyRequestArgs(window, &es, &idcmp, args);
109 if (res == 0)
111 return 1;
113 else
115 return 0;
118 AROS_LIBFUNC_EXIT
119 } /* DisplayError */