2 Copyright © 2007-2011, The AROS Development Team. All rights reserved.
5 Manipulate ARexx lib list
8 #include <rexx/errors.h>
9 #include <rexx/storage.h>
10 #include <rexx/rxslib.h>
12 #include <proto/alib.h>
13 #include <proto/exec.h>
14 #include <proto/dos.h>
15 #include <proto/rexxsyslib.h>
17 static struct RexxMsg
*msg
= NULL
;
18 static struct MsgPort
*rexxport
= NULL
, *replyport
= NULL
;
19 BPTR out
= (BPTR
)NULL
;
20 static BOOL closeout
= FALSE
;
22 static BOOL
init(void)
30 rexxport
= FindPort("REXX");
33 FPuts(out
, "Could not start RexxMast\n");
37 replyport
= CreatePort(NULL
, 0);
38 if (replyport
== NULL
)
40 FPuts(out
, "Could not create a port\n");
44 msg
= CreateRexxMsg(replyport
, NULL
, NULL
);
47 FPuts(out
, "Could not create RexxMsg\n");
61 DeletePort(replyport
);
64 int main(int argc
, char **argv
)
66 struct RexxMsg
*reply
;
68 struct RexxRsrc
*rsrc
;
76 out
= Open("CON:////RXLIB Output/CLOSE/WAIT", MODE_READWRITE
);
78 Close(SelectOutput(out
));
82 ForeachNode(&RexxSysBase
->rl_LibList
, rsrc
)
84 FPrintf(out
, "%s (%s)\n", rsrc
->rr_Node
.ln_Name
,
85 rsrc
->rr_Node
.ln_Type
== RRT_LIB
?
94 msg
->rm_Action
= RXREMLIB
| 1;
95 msg
->rm_Args
[0] = (IPTR
)argv
[1];
99 msg
->rm_Action
= RXADDFH
| 2;
100 msg
->rm_Args
[0] = (IPTR
)argv
[1];
101 msg
->rm_Args
[1] = (IPTR
)argv
[2];
106 msg
->rm_Action
= RXADDLIB
| (argc
-1);
107 for (i
=1; i
<argc
; i
++)
108 msg
->rm_Args
[i
-1] = (IPTR
)argv
[i
];
112 FPuts(out
, "Wrong number of arguments\n");
117 if (!FillRexxMsg(msg
, msg
->rm_Action
& RXARGMASK
, 0))
119 FPuts(out
, "Not enough memory\n");
124 PutMsg(rexxport
, (struct Message
*)msg
);
126 reply
= (struct RexxMsg
*)WaitPort(replyport
);
127 } while (reply
!= msg
);
129 ret
= msg
->rm_Result1
;
130 ClearRexxMsg(msg
, msg
->rm_Action
& RXARGMASK
);