2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Add a directory to an assign.
8 #include <exec/memory.h>
9 #include <proto/exec.h>
11 #include <dos/dosextens.h>
12 #include "dos_intern.h"
14 /*****************************************************************************
17 #include <proto/dos.h>
19 AROS_LH2(BOOL
, AssignAdd
,
22 AROS_LHA(CONST_STRPTR
, name
, D1
),
23 AROS_LHA(BPTR
, lock
, D2
),
26 struct DosLibrary
*, DOSBase
, 105, Dos
)
29 Create a multi-directory assign, or adds to it if it already was one.
30 Do not use or free the lock after calling this function - it becomes
31 the assign and will be freed by the system when the assign is removed.
34 name - NULL terminated name of the assign.
35 lock - Lock on the assigned directory.
38 != 0 success, 0 on failure. IoErr() gives additional information
39 in that case. The lock is not freed on failure.
42 This will only work with an assign created with AssignLock() or
43 a resolved AssignLate() assign.
50 Lock(), AssignLock(), AssignPath(), AssignLate(), DupLock(),
55 *****************************************************************************/
58 AROS_LIBBASE_EXT_DECL(struct DosLibrary
*,DOSBase
)
60 struct AssignList
**al
, *newal
;
65 dl
= LockDosList(LDF_ASSIGNS
| LDF_WRITE
);
66 dl
= FindDosEntry(dl
, name
, LDF_ASSIGNS
);
68 if((dl
== NULL
) || (dl
->dol_Type
!= DLT_DIRECTORY
))
70 UnLockDosList(LDF_ASSIGNS
| LDF_WRITE
);
71 SetIoErr(ERROR_OBJECT_WRONG_TYPE
);
76 newal
= AllocVec(sizeof(struct AssignList
), MEMF_PUBLIC
| MEMF_CLEAR
);
80 UnLockDosList(LDF_ASSIGNS
| LDF_WRITE
);
81 SetIoErr(ERROR_NO_FREE_STORE
);
86 newal
->al_Lock
= lock
;
88 for(al
= &dl
->dol_misc
.dol_assign
.dol_List
; *al
; al
= &((*al
)->al_Next
));
91 UnLockDosList(LDF_ASSIGNS
| LDF_WRITE
);