2 Copyright © 1995-2007, 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 *****************************************************************************/
59 struct AssignList
**al
, *newal
;
64 dl
= LockDosList(LDF_ASSIGNS
| LDF_WRITE
);
65 dl
= FindDosEntry(dl
, name
, LDF_ASSIGNS
);
67 if((dl
== NULL
) || (dl
->dol_Type
!= DLT_DIRECTORY
))
69 UnLockDosList(LDF_ASSIGNS
| LDF_WRITE
);
70 SetIoErr(ERROR_OBJECT_WRONG_TYPE
);
75 newal
= AllocVec(sizeof(struct AssignList
), MEMF_PUBLIC
| MEMF_CLEAR
);
79 UnLockDosList(LDF_ASSIGNS
| LDF_WRITE
);
80 SetIoErr(ERROR_NO_FREE_STORE
);
85 newal
->al_Lock
= lock
;
87 for(al
= &dl
->dol_misc
.dol_assign
.dol_List
; *al
; al
= &((*al
)->al_Next
));
90 UnLockDosList(LDF_ASSIGNS
| LDF_WRITE
);