2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Creates an entry for the dos list.
8 #include <exec/memory.h>
9 #include <proto/exec.h>
13 #include "dos_intern.h"
15 /*****************************************************************************
18 #include <proto/dos.h>
20 AROS_LH2(struct DosList
*, MakeDosEntry
,
23 AROS_LHA(CONST_STRPTR
, name
, D1
),
24 AROS_LHA(LONG
, type
, D2
),
27 struct DosLibrary
*, DOSBase
, 116, Dos
)
30 Create an entry for the dos list. Depending on the type this may
31 be a device, a volume or an assign node.
34 name -- pointer to name
35 type -- type of list entry to create
39 The new device entry, or NULL if it couldn't be created.
49 AddDosEntry(), RemDosEntry(), FindDosEntry(), LockDosList(),
50 NextDosEntry(), FreeDosEntry()
54 This call should be replaced by a value for AllocDosObject().
56 *****************************************************************************/
60 ULONG len
= strlen(name
);
64 dl
= (struct DosList
*)AllocMem(sizeof(struct DosList
),
65 MEMF_PUBLIC
| MEMF_CLEAR
);
70 s2
= (STRPTR
)AllocVec(len
+1, MEMF_PUBLIC
| MEMF_CLEAR
);
71 dl
->dol_Name
= MKBADDR(s2
);
73 /* Binary compatibility for BCPL string.
74 * First byte is the length then comes the string.
75 * For ease of use a zero is put at the end so it can be used as a
78 s2
= (STRPTR
)AllocVec(len
+2, MEMF_PUBLIC
| MEMF_CLEAR
);
79 dl
->dol_Name
= MKBADDR(s2
);
81 *s2
++ = (UBYTE
)(len
> 255 ? 255 : len
);
86 dl
->dol_Ext
.dol_AROS
.dol_DevName
= s2
;
92 SetIoErr(ERROR_NO_FREE_STORE
);
95 FreeMem(dl
, sizeof(struct DosList
));
99 SetIoErr(ERROR_NO_FREE_STORE
);