2 Copyright © 1995-2002, The AROS Development Team. All rights reserved.
5 Desc: Rexx function to close a MsgPort
9 #include <proto/exec.h>
10 #include <proto/rexxsyslib.h>
11 #include <proto/alib.h>
13 #include <exec/types.h>
14 #include <exec/memory.h>
15 #include <rexx/storage.h>
16 #include <rexx/errors.h>
20 #include "rexxsupport_intern.h"
23 LONG
rxsupp_closeport(struct Library
*RexxSupportBase
, struct RexxMsg
*msg
, UBYTE
**argstring
)
25 struct PortNodeData
*data
;
27 data
= (struct PortNodeData
*)FindName(&RSBI(RexxSupportBase
)->openports
, ARG1(msg
));
30 struct MsgPort
*replyport
, *rexxport
;
31 struct RexxMsg
*msg2
, *msg3
;
33 rexxport
= FindPort("REXX");
34 replyport
= CreateMsgPort();
35 msg2
= CreateRexxMsg(replyport
, NULL
, NULL
);
36 if (rexxport
== NULL
|| replyport
== NULL
|| msg2
== NULL
)
39 return rexxport
== NULL
? ERR10_013
: ERR10_003
;
41 replyport
->mp_Node
.ln_Name
= NULL
;
42 msg2
->rm_Private1
= msg
->rm_Private1
;
43 msg2
->rm_Private2
= msg
->rm_Private2
;
44 msg2
->rm_Action
= RXREMRSRC
;
45 msg2
->rm_Args
[0] = (IPTR
)data
->self
;
46 PutMsg(rexxport
, (struct Message
*)msg2
);
49 msg3
= (struct RexxMsg
*)GetMsg(replyport
);
50 } while (msg3
!= msg2
);
51 if (msg2
->rm_Result1
!= RC_OK
)
52 kprintf("ClosePort REMRSRC Result1 != RC_OK\n");
53 DeleteMsgPort(replyport
);
56 portcleanup(RexxSupportBase
, (struct PortNode
*)data
->self
);
58 *argstring
= CreateArgstring("1", 1);
62 *argstring
= CreateArgstring("0", 1);