Support rastport clipping rectangle for layerless rastports
[tangerine.git] / rom / dos / finddosentry.c
blob521db160c032c3652ec2fefa448001418ffe53ab
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #include <dos/dosextens.h>
10 #include <proto/utility.h>
11 #include "dos_intern.h"
13 # undef DEBUG
14 # define DEBUG 0
15 # include <aros/debug.h>
17 /*****************************************************************************
19 NAME */
20 #include <proto/dos.h>
22 AROS_LH3(struct DosList *, FindDosEntry,
24 /* SYNOPSIS */
25 AROS_LHA(struct DosList *, dlist, D1),
26 AROS_LHA(CONST_STRPTR, name, D2),
27 AROS_LHA(ULONG, flags, D3),
29 /* LOCATION */
30 struct DosLibrary *, DOSBase, 114, Dos)
32 /* FUNCTION
33 Looks for the next dos list entry with the right name. The list
34 must be locked for this. There may be not more than one device
35 or assign node of the same name. There are no restrictions on
36 volume nodes.
38 INPUTS
39 dlist - the value given by LockDosList() or the last call to
40 FindDosEntry().
41 name - logical device name without colon. Case insensitive.
42 flags - the same flags as given to LockDosList() or a subset
43 of them.
45 RESULT
46 Pointer to dos list entry found or NULL if the are no more entries.
48 NOTES
50 EXAMPLE
52 BUGS
54 SEE ALSO
56 INTERNALS
58 *****************************************************************************/
60 AROS_LIBFUNC_INIT
61 AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
63 static const ULONG flagarray[]=
64 { 0, LDF_DEVICES, LDF_ASSIGNS, LDF_VOLUMES, LDF_ASSIGNS, LDF_ASSIGNS };
66 /* Determine the size of the name (-1 if the last character is a ':') */
67 CONST_STRPTR end = name;
68 ULONG size;
70 while (*end++)
73 size = ~(name-end);
75 if (size && end[-2] == ':')
77 size--;
80 /* Follow the list */
81 for (;;)
83 /* Get next entry. Return NULL if there is none. */
84 dlist = dlist->dol_Next;
86 if (dlist == NULL)
88 return NULL;
91 D(bug("Found list entry %s\n", dlist->dol_DevName));
93 /* Check type and name */
94 if (flags & flagarray[dlist->dol_Type + 1] &&
95 !Strnicmp(name, dlist->dol_DevName, size) &&
96 !dlist->dol_DevName[size])
98 return dlist;
101 AROS_LIBFUNC_EXIT
102 } /* FindDosEntry */