Fix for a crash which happened when a document couldn't be opened.
[AROS-Contrib.git] / regina / rexxmast / listen4msg.c
blobabf39b6bfe18a873a9cc7276c55f9ec40939a837
1 #include <proto/alib.h>
2 #include <proto/dos.h>
3 #include <proto/exec.h>
4 #include <proto/rexxsyslib.h>
5 #include <stdio.h>
7 #include <exec/ports.h>
8 #include <rexx/storage.h>
10 int main(void)
12 struct RexxMsg *msg;
13 struct MsgPort *port;
15 port = CreatePort("TEST", 0);
16 if (port == NULL)
18 puts("Error creating TEST port");
19 return 20;
22 msg = (struct RexxMsg *)WaitPort(port);
23 if (msg == NULL)
25 puts("Received NULL message");
27 else if (!IsRexxMsg(msg))
29 puts("Received message that is not a RexxMsg");
31 else
33 puts("Received RexxMsg");
34 printf("%08lx\n", (long)msg->rm_Action);
35 Write(msg->rm_Stdin, "Hello\n", 6);
36 puts((STRPTR)msg->rm_Args[0]);
38 ReplyMsg((struct Message *)msg);
39 DeletePort(port);
41 return 0;