2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
6 #include <proto/alib.h>
7 #include <proto/exec.h>
8 #include <proto/gadtools.h>
9 #include <proto/intuition.h>
11 #include <intuition/intuition.h>
12 #include <libraries/gadtools.h>
20 #define HDTB_HAVE_VARARGPROTOS
21 #include "hdtoolbox_support.h"
24 struct Node
*getNumNode(struct List
*list
, int num
)
28 D(bug("[HDToolBox] getNumNode()\n"));
31 while ((num
) && (node
->ln_Succ
))
36 return node
->ln_Succ
? node
: 0;
39 ULONG
getNodeNum(struct Node
*node
)
43 D(bug("[HDToolBox] getNodeNum()\n"));
48 if (node
->ln_Pred
== 0)
54 ULONG
countNodes(struct List
*list
, UBYTE type
)
59 D(bug("[HDToolBox] countNodes()\n"));
64 if ((type
== (UBYTE
)-1) || (node
->ln_Type
== type
))
71 void typestrncpy(STRPTR dst
, STRPTR src
, ULONG len
)
80 sprintf(dst
,"%o", *src
++);
89 UWORD
strcpyESC(STRPTR dst
, STRPTR fmt
, ...){
91 UWORD
strcpyESC(STRPTR dst
, STRPTR fmt
){
93 #warning "TODO: Check varargs usage is correct"
118 D(bug("[HDToolBox] strcpyESC:%s-%ld: unknown escape sequence\n", __FILE__
, __LINE__
));
131 void getSizeStr(STRPTR str
, ULONG size
)
145 sprintf(str
, "%ld.%ld%c",size
,r
,c
);
149 ULONG
sizeStrToUL(STRPTR str
)
156 size
= strtoul(str
, &end
, 0);
159 value
= strtoul(end
+1, &end
, 0);
166 else if (*end
== 'G')
176 size
/= 1024; /* we want it in kB */
184 } while ((value
/d
)>=1);
192 LONG
GetPartitionAttrsA(struct PartitionHandle
*ph
, IPTR tag
, ... )
195 AROS_SLOWSTACKTAGS_PRE(tag
)
196 retval
= GetPartitionAttrs(ph
, AROS_SLOWSTACKTAGS_ARG(tag
));
197 AROS_SLOWSTACKTAGS_POST
199 return GetPartitionAttrs(ph
, (struct TagItem
*)&tag
);
203 LONG
SetPartitionAttrsA(struct PartitionHandle
*ph
, IPTR tag
, ... )
206 AROS_SLOWSTACKTAGS_PRE(tag
)
207 retval
= SetPartitionAttrs(ph
, AROS_SLOWSTACKTAGS_ARG(tag
));
208 AROS_SLOWSTACKTAGS_POST
210 return SetPartitionAttrs(ph
, (struct TagItem
*)&tag
);
214 LONG
GetPartitionTableAttrsA(struct PartitionHandle
*ph
, IPTR tag
, ... )
217 AROS_SLOWSTACKTAGS_PRE(tag
)
218 retval
= GetPartitionTableAttrs(ph
, AROS_SLOWSTACKTAGS_ARG(tag
));
219 AROS_SLOWSTACKTAGS_POST
221 return GetPartitionTableAttrs(ph
, (struct TagItem
*)&tag
);
225 ULONG
getAttrInfo(struct PartitionAttribute
*attrlist
, ULONG attr
)
227 D(bug("[HDToolBox] getAttrInfo()\n"));
229 while (attrlist
[0].attribute
!= PTA_DONE
)
231 if (attrlist
[0].attribute
== attr
)
232 return attrlist
[0].mode
;
238 UBYTE
getBitNum(ULONG val
)