2 Copyright © 1995-2002, 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(UBYTE
*, string
, A0
),
20 AROS_LHA(ULONG
, length
, D0
),
23 struct Library
*, 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 Will return a pointer the string part of the allocated RexxArg
38 Pointer to the string returned by this function may be used as a
39 null terminated C string but should be considered read-only.
46 DeleteArgstring(), LengthArgstring()
51 *****************************************************************************/
55 /* size is the length of the memory to allocate: size of RexxArg without Buff + length of string + 1 */
56 ULONG size
= sizeof(struct RexxArg
) - 8 + length
+ 1;
57 struct RexxArg
*ra
= (struct RexxArg
*)AllocMem(size
, MEMF_PUBLIC
|MEMF_CLEAR
);
61 if (ra
== NULL
) ReturnPtr("CreateArgstring", UBYTE
*, NULL
);
64 ra
->ra_Length
= length
;
65 #warning FIXME: Maybe the next two fields only need to be intialized on m68k
66 /* Initialize the depricated fields to a sane value for compatibility under AmigaOS */
67 ra
->ra_Depricated1
= 1<<1 | 1<<2 | 1<<6; /* Was ra_Flags = NSF_ALPHA | NSF_EXT */
68 for (i
=0; i
<length
; i
++)
70 ra
->ra_Depricated2
= (UBYTE
)(hash
& 255); /* Was ra_Hash */
71 CopyMem(string
, ra
->ra_Buff
, length
);
72 *(ra
->ra_Buff
+ length
) = '\0';
74 ReturnPtr("CreateArgString", UBYTE
*, ra
->ra_Buff
);
76 } /* CreateArgstring */