grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / rexxsupport / getarg.c
blob8076566934bae74742f69108d462aec4bf2d23ea
1 /*
2 Copyright © 1995-2002, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Rexx function to wait for a packet on a port
6 Lang: English
7 */
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>
18 #include <stdlib.h>
20 #include "rexxsupport_intern.h"
21 #include "portnode.h"
23 LONG rxsupp_getarg(struct Library *RexxSupportBase, struct RexxMsg *msg, UBYTE **argstring)
25 struct RexxMsg *msg2 = *(struct RexxMsg **)ARG1(msg);
26 UBYTE arg;
28 if (msg2 == NULL || !IsRexxMsg(msg2))
30 *argstring = NULL;
31 return ERR10_018;
34 if ((msg->rm_Action & RXARGMASK) == 1)
35 arg = 0;
36 else
38 char *end;
39 int size = strtoul(ARG1(msg), &end, 10);
40 if ((*end != 0) || size<0 || size>15)
42 *argstring = NULL;
43 return ERR10_018;
45 else
46 arg = size;
49 *argstring = CreateArgstring(RXARG(msg2, arg), LengthArgstring(RXARG(msg2, arg)));
50 return RC_OK;