Added kernel module for starting the usb stack at boot time. It's not activated thoug...
[cake.git] / rom / dos / displayerror.c
blob26aea63400660d7f2e2fc5d4b2bf2fe9f244b5d0
1 /*
2 Copyright 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
8 #include <proto/intuition.h>
9 #include "dos_intern.h"
10 #include <aros/debug.h>
11 #include <string.h>
13 /*****i***********************************************************************
15 NAME */
16 #include <proto/dos.h>
18 AROS_LH3(LONG, DisplayError,
20 /* SYNOPSIS */
21 AROS_LHA(CONST_STRPTR, formatStr, A0),
22 AROS_LHA(ULONG , flags , D0),
23 AROS_LHA(APTR , args , A1),
25 /* LOCATION */
26 struct DosLibrary *, DOSBase, 81, Dos)
28 /* FUNCTION
29 Displays an error message to and gets response from a user.
31 INPUTS
32 formatStr -- printf-style formatted string
33 flags -- arguments to EasyRequestArgs()
34 args -- arguments to 'formatStr'
36 RESULT
37 Nothing
39 NOTES
40 This is a PRIVATE dos function.
42 EXAMPLE
44 BUGS
46 SEE ALSO
48 INTERNALS
49 The purpose of this function is to put up a requester when an error
50 has occurred that is connected to the filesystem.
52 *****************************************************************************/
54 AROS_LIBFUNC_INIT
56 struct IntuitionBase *IntuitionBase = NULL;
57 struct Window *window; /* The window to put the requester in */
58 char gadTexts[128];
59 char *gtPtr = (char *)gadTexts;
60 ULONG idcmp = flags;
61 ULONG res;
63 struct EasyStruct es =
65 sizeof(struct EasyStruct),
66 0, /* flags */
67 DosGetString(STRING_REQUESTTITLE), /* "System Requester" */
68 (STRPTR)formatStr,
69 gadTexts /* "Retry|Cancel" */
72 window = (struct Window *)((struct Process *)FindTask(NULL))->pr_WindowPtr;
74 /* Supress requesters? */
75 if ((IPTR)window == (IPTR)-1L)
77 return 1;
80 if (DOSBase->dl_IntuitionBase == NULL)
82 DOSBase->dl_IntuitionBase = OpenLibrary("intuition.library", 37L);
85 if (DOSBase->dl_IntuitionBase == NULL)
87 return 1;
89 else
91 IntuitionBase = (struct IntuitionBase *)DOSBase->dl_IntuitionBase;
94 /* Create localised gadget texts */
95 strcpy(gtPtr, DosGetString(STRING_RETRY));
96 strcat(gtPtr, "|");
97 strcat(gtPtr, DosGetString(STRING_CANCEL));
99 res = EasyRequestArgs(window, &es, &idcmp, args);
101 if (res == 0)
103 return 1;
105 else
107 return 0;
110 AROS_LIBFUNC_EXIT
111 } /* DisplayError */