grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / rexxsupport / portcleanup.c
blobfe482022f648af42336b79451547f8f47a59d838
1 #include <proto/exec.h>
2 #include <proto/rexxsyslib.h>
3 #include <rexx/storage.h>
4 #include <rexx/errors.h>
6 #include <string.h>
8 #include "portnode.h"
10 #include "rexxsupport_intern.h"
12 void portcleanup(struct Library *RexxSupportBase, struct PortNode *node)
14 struct RexxMsg *msg;
15 struct PortNodeData *data = &node->data;
17 Remove(&data->node);
18 if (IsListEmpty(&RSBI(RexxSupportBase)->openports))
19 RexxSupportBase->lib_OpenCnt--;
21 RemPort(data->port);
23 ForeachNode(&data->msgs, msg)
25 if (IsRexxMsg(msg))
27 msg->rm_Result1 = RC_ERROR;
28 msg->rm_Result2 = (IPTR)ERR10_013;
30 ReplyMsg((struct Message *)msg);
33 while ((msg = (struct RexxMsg *)GetMsg(node->data.port)) != NULL)
35 if (IsRexxMsg(msg))
37 msg->rm_Result1 = RC_ERROR;
38 msg->rm_Result2 = (IPTR)ERR10_013;
40 ReplyMsg((struct Message *)msg);
43 DeleteMsgPort(data->port);
45 FreeMem(data->node.ln_Name, strlen(data->node.ln_Name)+1);
46 FreeMem(node, sizeof(struct PortNode));