some fixes to accented characters
[tangerine.git] / rom / dos / finddosentry.c
blob6b633ad3eed57031c6c25fb4861f468a819ff3cb
1 /*
2 Copyright © 1995-2007, 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
62 static const ULONG flagarray[]=
63 { 0, LDF_DEVICES, LDF_ASSIGNS, LDF_VOLUMES, LDF_ASSIGNS, LDF_ASSIGNS };
65 /* Determine the size of the name (-1 if the last character is a ':') */
66 CONST_STRPTR end = name;
67 ULONG size;
69 if (!dlist)
70 return NULL;
72 while (*end++)
75 size = ~(name-end);
77 if (size && end[-2] == ':')
79 size--;
82 /* Follow the list */
83 for (;;)
85 /* Get next entry. Return NULL if there is none. */
86 dlist = dlist->dol_Next;
88 if (dlist == NULL)
90 return NULL;
93 D(bug("Found list entry %s\n", dlist->dol_Ext.dol_AROS.dol_DevName));
95 /* Check type and name */
96 if (flags & flagarray[dlist->dol_Type + 1] &&
97 !Strnicmp(name, dlist->dol_Ext.dol_AROS.dol_DevName, size) &&
98 !dlist->dol_Ext.dol_AROS.dol_DevName[size])
100 return dlist;
103 AROS_LIBFUNC_EXIT
104 } /* FindDosEntry */