grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / rexxsupport / offset.c
blobc158ad351c78b7016d22b34f4926be8753980150
1 /*
2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Add offset to a pointer
6 Lang: English
7 */
9 #include <proto/exec.h>
10 #include <proto/rexxsyslib.h>
11 #include <exec/types.h>
12 #include <exec/memory.h>
13 #include <rexx/storage.h>
14 #include <rexx/errors.h>
16 #include <ctype.h>
17 #include <stdlib.h>
19 #include "rexxsupport_intern.h"
20 #include "rxfunctions.h"
22 LONG rxsupp_offset(struct Library *RexxSupportBase, struct RexxMsg *msg, UBYTE **argstring)
24 char *ptr, *end;
25 LONG offset;
27 *argstring = NULL;
29 offset = strtol(ARG2(msg), &end, 10);
30 while (isspace(*end)) end++;
31 if (*end != 0)
32 return ERR10_018;
35 if (LengthArgstring(ARG1(msg)) != sizeof(void *))
36 return ERR10_018;
38 ptr = *(char **)ARG1(msg) + offset;
40 *argstring = CreateArgstring((UBYTE *)&ptr, sizeof(void *));
41 return RC_OK;