C:Avail - FLUSH should now handle systems with >2G of memory
[AROS.git] / test / displayalert.c
blobb0353395238d09fd71cdb7079eca9479d70e9a4c
1 #include <exec/alerts.h>
2 #include <proto/intuition.h>
4 #include <stdio.h>
5 #include <string.h>
7 /*
8 * An EXTREMELY ugly test quickly made of alert.hook source.
9 * I just didn't have any other text data with proper layout.
10 * Please rewrite this into something better.
13 static UBYTE *const recov = "\x38\x0f" "Recoverable Alert! ";
14 static UBYTE *const mouse = "\x01\x50\x0f" "Press mouse button to continue.";
15 static UBYTE *const fmtstring = "\xa8\x2a" "Task: 12345678 - ";
16 static UBYTE *tname = "--task not found--";
18 static STRPTR mystrcpy(STRPTR dest, STRPTR src, LONG len)
20 while(len && *src)
22 *dest++ = *src++;
23 len--;
25 *dest++ = 0;
26 return dest;
29 int main(int argc, char **argv)
31 UBYTE buffer[256], *buf;
32 BOOL ret;
33 ULONG code;
35 if ((argc > 1) && (!stricmp(argv[1], "deadend")))
36 code = AT_DeadEnd;
37 else
38 code = 0;
40 buffer[0] = 0;
41 buf = &buffer[1];
43 buf = mystrcpy(buf, recov, -1);
44 *buf++ = 1;
46 buf = mystrcpy(buf, mouse, -1);
47 *buf++ = 1;
49 *buf++ = 0;
50 buf = mystrcpy(buf, fmtstring, -1);
52 buf = mystrcpy(buf - 1, tname, 30);
54 *buf = 0;
56 ret = DisplayAlert(code, buffer, 0x38);
58 printf("Result is: %d\n", ret);
59 return 0;