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
++);
88 UWORD
strcpyESC(STRPTR dst
, STRPTR fmt
)
114 D(bug("[HDToolBox] strcpyESC:%s-%ld: unknown escape sequence\n", __FILE__
, __LINE__
));
127 void getSizeStr(STRPTR str
, ULONG size
)
141 sprintf(str
, "%d.%d%c",(int)size
,(int)r
,c
);
145 ULONG
sizeStrToUL(STRPTR str
)
152 size
= strtoul(str
, &end
, 0);
155 value
= strtoul(end
+1, &end
, 0);
162 else if (*end
== 'G')
172 size
/= 1024; /* we want it in kB */
180 } while ((value
/d
)>=1);
188 LONG
GetPartitionAttrsA(struct PartitionHandle
*ph
, IPTR tag
, ... )
191 AROS_SLOWSTACKTAGS_PRE(tag
)
192 retval
= GetPartitionAttrs(ph
, AROS_SLOWSTACKTAGS_ARG(tag
));
193 AROS_SLOWSTACKTAGS_POST
195 return GetPartitionAttrs(ph
, (struct TagItem
*)&tag
);
199 LONG
SetPartitionAttrsA(struct PartitionHandle
*ph
, IPTR tag
, ... )
202 AROS_SLOWSTACKTAGS_PRE(tag
)
203 retval
= SetPartitionAttrs(ph
, AROS_SLOWSTACKTAGS_ARG(tag
));
204 AROS_SLOWSTACKTAGS_POST
206 return SetPartitionAttrs(ph
, (struct TagItem
*)&tag
);
210 LONG
GetPartitionTableAttrsA(struct PartitionHandle
*ph
, IPTR tag
, ... )
213 AROS_SLOWSTACKTAGS_PRE(tag
)
214 retval
= GetPartitionTableAttrs(ph
, AROS_SLOWSTACKTAGS_ARG(tag
));
215 AROS_SLOWSTACKTAGS_POST
217 return GetPartitionTableAttrs(ph
, (struct TagItem
*)&tag
);
221 ULONG
getAttrInfo(const struct PartitionAttribute
*attrlist
, ULONG attr
)
223 D(bug("[HDToolBox] getAttrInfo()\n"));
225 while (attrlist
[0].attribute
!= PTA_DONE
)
227 if (attrlist
[0].attribute
== attr
)
228 return attrlist
[0].mode
;
234 UBYTE
getBitNum(ULONG val
)