Don't call ReadArgs() if started from WB.
[tangerine.git] / compiler / alib / checkrexxmsg.c
blobd8483107fec48ce2b974c56189ccc89f9efc8394
1 /*
2 Copyright © 1995-2002, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include <proto/alib.h>
9 #include <proto/exec.h>
10 #include <proto/rexxsyslib.h>
11 #include <rexx/storage.h>
12 #include <rexx/errors.h>
14 /*****************************************************************************
16 NAME */
18 BOOL CheckRexxMsg(
20 /* SYNOPSIS */
21 struct RexxMsg * msg)
23 /* FUNCTION
24 Check to see if provided message was generated by the rexx interpreter
26 INPUTS
27 msg - The message to check
29 RESULT
30 Wether this message is OK.
32 NOTES
34 EXAMPLE
36 BUGS
38 SEE ALSO
39 SetRexxVar, GetRexxVar
41 INTERNALS
42 This function creates a rexx message that is sent to the AREXX
43 port with a RXCHECKMSG command.
46 *****************************************************************************/
48 AROS_GET_SYSBASE_OK
49 struct Library *RexxSysBase = NULL;
50 struct RexxMsg *msg2 = NULL, *msg3;
51 struct MsgPort *port = NULL, *rexxport;
52 BOOL retval = FALSE;
54 RexxSysBase = OpenLibrary("rexxsyslib.library", 0);
55 if (RexxSysBase == NULL) goto cleanup;
57 if (!IsRexxMsg(msg)) goto cleanup;
58 rexxport = FindPort("REXX");
59 if (rexxport==NULL) goto cleanup;
61 port = CreateMsgPort();
62 if (port == NULL) goto cleanup;
63 msg2 = CreateRexxMsg(port, NULL, NULL);
64 if (msg2==NULL) goto cleanup;
65 msg2->rm_Private1 = msg->rm_Private1;
66 msg2->rm_Private2 = msg->rm_Private2;
67 msg2->rm_Action = RXCHECKMSG;
69 PutMsg(rexxport, (struct Message *)msg2);
70 msg3 = NULL;
71 while (msg3!=msg2)
73 WaitPort(port);
74 msg3 = (struct RexxMsg *)GetMsg(port);
75 if (msg3!=msg2) ReplyMsg((struct Message *)msg3);
78 retval = msg3->rm_Result1==RC_OK;
80 cleanup:
81 if (msg2!=NULL) DeleteRexxMsg(msg2);
82 if (port!=NULL) DeletePort(port);
83 if (RexxSysBase!=NULL) CloseLibrary(RexxSysBase);
84 return retval;
85 } /* CheckRexxMsg */