some fixes to accented characters
[tangerine.git] / rom / dos / remassignlist.c
blobbd28b4f5f4b23379ae07fe419a63f3ed97217f9c
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: RemAssignList() - Remove an entry from a multi-dir assign.
6 Lang: English
7 */
9 #include <aros/debug.h>
10 #include "dos_intern.h"
11 #include <proto/exec.h>
13 /*****************************************************************************
15 NAME */
16 #include <proto/dos.h>
18 AROS_LH2(LONG, RemAssignList,
20 /* SYNOPSIS */
21 AROS_LHA(CONST_STRPTR, name, D1),
22 AROS_LHA(BPTR , lock, D2),
24 /* LOCATION */
25 struct DosLibrary *, DOSBase, 106, Dos)
27 /* FUNCTION
28 Remove an entry from a multi-dir assign. The entry removed will be
29 the first one that the SameLock() function called on the 'lock'
30 parameter returns that they belong to the same object.
32 The entry for this lock will be remove from the lock, and the
33 lock for the entry in the list will be unlocked.
35 INPUTS
36 name - Name of the device to remove lock from. This should
37 not contain the trailing ':'.
38 lock - Lock on the object to remove from the list.
40 RESULT
41 success - Have we actually succeeded
43 NOTES
45 EXAMPLE
47 BUGS
48 If this is the first lock in a list, this will not set
49 dol_Device/dol_Unit correctly. This will be fixed shortly.
51 SEE ALSO
53 INTERNALS
55 *****************************************************************************/
57 AROS_LIBFUNC_INIT
59 struct DosList *dl = NULL;
60 BOOL res = DOSFALSE;
62 D(bug("RemAssignList: name = \"%s\", lock = $%lx\n", name, lock));
63 dl = LockDosList(LDF_ASSIGNS | LDF_WRITE);
65 while (!res && (dl = FindDosEntry(dl, name, LDF_ASSIGNS)))
67 struct AssignList *al, *lastal = NULL;
69 al = dl->dol_misc.dol_assign.dol_List;
72 We have a matching element, lets find the correct
73 member to remove. Initially check the inline lock.
76 if (SameLock(dl->dol_Lock, lock) == LOCK_SAME)
79 This is a bit tricky, me move the first element
80 in the list to the header
83 UnLock(dl->dol_Lock);
85 if (al)
87 dl->dol_misc.dol_assign.dol_List = al->al_Next;
88 dl->dol_Lock = al->al_Lock;
89 FreeVec(al);
91 else
93 RemDosEntry(dl);
94 FreeDosEntry(dl);
97 res = DOSTRUE;
99 else
101 while (al)
103 if (SameLock(al->al_Lock, lock) == LOCK_SAME)
105 /* Remove this element. Singly linked list */
106 if (lastal == NULL)
108 /* First element of list... */
109 dl->dol_misc.dol_assign.dol_List = al->al_Next;
111 else
113 lastal->al_Next = al->al_Next;
116 UnLock(al->al_Lock);
117 FreeVec(al);
118 al = NULL;
119 res = DOSTRUE;
121 else
123 lastal = al;
124 al = al->al_Next;
127 } /* in the assignlist */
129 } /* the assign exists */
131 UnLockDosList(LDF_ASSIGNS | LDF_WRITE);
133 return res;
135 AROS_LIBFUNC_EXIT
136 } /* RemAssignList */