2 Copyright © 1995-2016, The AROS Development Team. All rights reserved.
8 #include <proto/exec.h>
9 #include "rexxsyslib_intern.h"
11 /*****************************************************************************
14 #include <clib/rexxsyslib_protos.h>
16 AROS_LH2(UBYTE
*, CreateArgstring
,
19 AROS_LHA(CONST UBYTE
*, string
, A0
),
20 AROS_LHA(ULONG
, length
, D0
),
23 struct RxsLib
*, RexxSysBase
, 21, RexxSys
)
26 This function will create a RexxArg structure and copy the supplied
30 string - String to copy into the RexxArg structure
31 length - Length of the string to copy.
34 A pointer to the string part of the allocated RexxArg structure.
37 Pointer to the string returned by this function may be used as a
38 null terminated C string but should be considered read-only.
45 DeleteArgstring(), LengthArgstring()
50 *****************************************************************************/
54 /* size is the length of the memory to allocate: size of RexxArg without Buff + length of string + 1 */
55 ULONG size
= sizeof(struct RexxArg
) - 8 + length
+ 1;
56 struct RexxArg
*ra
= (struct RexxArg
*)AllocMem(size
, MEMF_PUBLIC
|MEMF_CLEAR
);
60 if (ra
== NULL
) ReturnPtr("CreateArgstring", UBYTE
*, NULL
);
63 ra
->ra_Length
= length
;
64 /* FIXME: Maybe the next two fields only need to be intialized on m68k? */
65 /* Initialize the deprecated fields to a sane value for compatibility under AmigaOS */
66 ra
->ra_Deprecated1
= 1<<1 | 1<<2 | 1<<6; /* Was ra_Flags = NSF_ALPHA | NSF_EXT */
67 for (i
=0; i
<length
; i
++)
69 ra
->ra_Deprecated2
= (UBYTE
)(hash
& 255); /* Was ra_Hash */
70 CopyMem(string
, ra
->ra_Buff
, length
);
71 *(ra
->ra_Buff
+ length
) = '\0';
73 ReturnPtr("CreateArgString", UBYTE
*, ra
->ra_Buff
);
75 } /* CreateArgstring */