Update to lasso handling. Adjust scroll amount based on difference between mouse...
[AROS.git] / rom / dos / makedosentry.c
blob328f24e5ee0e5e3b74685a0a7ee905580d3bf8d0
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Creates an entry for the dos list.
6 Lang: english
7 */
8 #include <exec/memory.h>
9 #include <proto/exec.h>
11 #include <string.h>
13 #include "dos_intern.h"
15 /*****************************************************************************
17 NAME */
18 #include <proto/dos.h>
20 AROS_LH2(struct DosList *, MakeDosEntry,
22 /* SYNOPSIS */
23 AROS_LHA(CONST_STRPTR, name, D1),
24 AROS_LHA(LONG, type, D2),
26 /* LOCATION */
27 struct DosLibrary *, DOSBase, 116, Dos)
29 /* FUNCTION
30 Create an entry for the dos list. Depending on the type this may
31 be a device, a volume or an assign node.
33 INPUTS
34 name -- pointer to name
35 type -- type of list entry to create
37 RESULT
39 The new device entry, or NULL if it couldn't be created.
41 NOTES
43 EXAMPLE
45 BUGS
47 SEE ALSO
49 AddDosEntry(), RemDosEntry(), FindDosEntry(), LockDosList(),
50 NextDosEntry(), FreeDosEntry()
52 INTERNALS
54 This call should be replaced by a value for AllocDosObject().
56 *****************************************************************************/
58 AROS_LIBFUNC_INIT
60 ULONG len = strlen(name);
61 STRPTR s2;
62 struct DosList *dl;
64 dl = (struct DosList *)AllocMem(sizeof(struct DosList),
65 MEMF_PUBLIC | MEMF_CLEAR);
67 if (dl != NULL)
69 #ifdef AROS_FAST_BPTR
70 s2 = (STRPTR)AllocVec(len+1, MEMF_PUBLIC | MEMF_CLEAR);
71 dl->dol_Name = MKBADDR(s2);
72 #else
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
76 * C string
78 s2 = (STRPTR)AllocVec(len+2, MEMF_PUBLIC | MEMF_CLEAR);
79 dl->dol_Name = MKBADDR(s2);
80 if (s2 != NULL)
81 *s2++ = (UBYTE)(len > 255 ? 255 : len);
82 #endif
83 if (s2 != NULL)
85 strcpy(s2, name);
86 dl->dol_Ext.dol_AROS.dol_DevName = s2;
87 dl->dol_Type = type;
88 return dl;
90 else
92 SetIoErr(ERROR_NO_FREE_STORE);
95 FreeMem(dl, sizeof(struct DosList));
97 else
99 SetIoErr(ERROR_NO_FREE_STORE);
102 return NULL;
104 AROS_LIBFUNC_EXIT
105 } /* MakeDosEntry */