Humble script for creating the port's snapshots.
[AROS.git] / test / displayalert.c
blobe5990214f43acc66843404f0dc533d316aa39eea
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <exec/alerts.h>
7 #include <proto/intuition.h>
9 #include <stdio.h>
10 #include <string.h>
13 * An EXTREMELY ugly test quickly made of alert.hook source.
14 * I just didn't have any other text data with proper layout.
15 * Please rewrite this into something better.
18 static UBYTE *const recov = "\x38\x0f" "Recoverable Alert! ";
19 static UBYTE *const mouse = "\x01\x50\x0f" "Press mouse button to continue.";
20 static UBYTE *const fmtstring = "\xa8\x2a" "Task: 12345678 - ";
21 static UBYTE *tname = "--task not found--";
23 static STRPTR mystrcpy(STRPTR dest, STRPTR src, LONG len)
25 while(len && *src)
27 *dest++ = *src++;
28 len--;
30 *dest++ = 0;
31 return dest;
34 int main(int argc, char **argv)
36 UBYTE buffer[256], *buf;
37 BOOL ret;
38 ULONG code;
40 if ((argc > 1) && (!stricmp(argv[1], "deadend")))
41 code = AT_DeadEnd;
42 else
43 code = 0;
45 buffer[0] = 0;
46 buf = &buffer[1];
48 buf = mystrcpy(buf, recov, -1);
49 *buf++ = 1;
51 buf = mystrcpy(buf, mouse, -1);
52 *buf++ = 1;
54 *buf++ = 0;
55 buf = mystrcpy(buf, fmtstring, -1);
57 buf = mystrcpy(buf - 1, tname, 30);
59 *buf = 0;
61 ret = DisplayAlert(code, buffer, 0x38);
63 printf("Result is: %d\n", ret);
64 return 0;