Support rastport clipping rectangle for layerless rastports
[tangerine.git] / rom / dos / assignadd.c
blob5dbccee7e2bfc455adf59228bf701fb06527adab
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Add a directory to an assign.
6 Lang: English
7 */
8 #include <exec/memory.h>
9 #include <proto/exec.h>
10 #include <dos/dos.h>
11 #include <dos/dosextens.h>
12 #include "dos_intern.h"
14 /*****************************************************************************
16 NAME */
17 #include <proto/dos.h>
19 AROS_LH2(BOOL, AssignAdd,
21 /* SYNOPSIS */
22 AROS_LHA(CONST_STRPTR, name, D1),
23 AROS_LHA(BPTR , lock, D2),
25 /* LOCATION */
26 struct DosLibrary *, DOSBase, 105, Dos)
28 /* FUNCTION
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.
33 INPUTS
34 name - NULL terminated name of the assign.
35 lock - Lock on the assigned directory.
37 RESULT
38 != 0 success, 0 on failure. IoErr() gives additional information
39 in that case. The lock is not freed on failure.
41 NOTES
42 This will only work with an assign created with AssignLock() or
43 a resolved AssignLate() assign.
45 EXAMPLE
47 BUGS
49 SEE ALSO
50 Lock(), AssignLock(), AssignPath(), AssignLate(), DupLock(),
51 RemAssignList()
53 INTERNALS
55 *****************************************************************************/
57 AROS_LIBFUNC_INIT
58 AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
59 struct DosList *dl;
60 struct AssignList **al, *newal;
62 if(lock == NULL)
63 return DOSFALSE;
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);
73 return DOSFALSE;
76 newal = AllocVec(sizeof(struct AssignList), MEMF_PUBLIC | MEMF_CLEAR);
78 if(newal == NULL)
80 UnLockDosList(LDF_ASSIGNS | LDF_WRITE);
81 SetIoErr(ERROR_NO_FREE_STORE);
83 return DOSFALSE;
86 newal->al_Lock = lock;
88 for(al = &dl->dol_misc.dol_assign.dol_List; *al; al = &((*al)->al_Next));
90 *al = newal;
91 UnLockDosList(LDF_ASSIGNS | LDF_WRITE);
93 return DOSTRUE;
95 AROS_LIBFUNC_EXIT
96 } /* AssignAdd */