disable debug
[AROS.git] / workbench / libs / rexxsupport / next.c
blob9ddec1d2432f4a326a5127661e9fe98d5787759b
1 /*
2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Get the pointer value a pointer is pointing to, often used to get
6 the next element of a list
7 Lang: English
8 */
10 #include <proto/exec.h>
11 #include <proto/rexxsyslib.h>
12 #include <exec/types.h>
13 #include <exec/memory.h>
14 #include <rexx/storage.h>
15 #include <rexx/errors.h>
17 #include <ctype.h>
18 #include <stdlib.h>
20 #include "rexxsupport_intern.h"
21 #include "rxfunctions.h"
23 LONG rxsupp_next(struct Library *RexxSupportBase, struct RexxMsg *msg, UBYTE **argstring)
25 char *ptr, *end;
26 LONG offset = 0;
28 if ((msg->rm_Action & RXARGMASK) > 1)
30 offset = strtol(ARG2(msg), &end, 10);
31 while (isspace(*end)) end++;
32 if (*end != 0)
34 *argstring = NULL;
35 return ERR10_018;
39 if (LengthArgstring(ARG1(msg)) != sizeof(void *))
41 *argstring = NULL;
42 return ERR10_018;
45 ptr = (char *)ARG1(msg) + offset;
47 *argstring = CreateArgstring((UBYTE *)ptr, sizeof(void *));
48 return RC_OK;