Fixed semaphore handling code that was mistakingly removed from port (pointed out...
[cake.git] / compiler / arossupport / isdosentrya.c
blob090f7e0485ebae9e5140fb2c74c607dff393c2a7
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/arossupport.h>
7 #include <proto/dos.h>
8 #include <proto/utility.h>
10 #include <aros/system.h>
11 #include <dos/dos.h>
13 #include <dos/dosextens.h>
14 #include <exec/types.h>
15 #include <utility/utility.h>
17 #define BUFFER_SIZE 100
19 /*****************************************************************************
21 NAME */
23 BOOL IsDosEntryA(
25 /* SYNOPSIS */
27 char * Name,
28 ULONG Flags)
30 /* LOCATION */
32 /* FUNCTION
34 There is a need in file/directory processing where an application
35 may need to determine whether a path is just a volume/device or
36 assignment name.
38 INPUTS
40 Name - The path to test.
42 Flags - Any combination of the following:
44 LDF_ASSIGNS
45 LDF_DEVICES
46 LDF_VOLUMES
48 RESULT
50 Boolean True or False.
52 NOTES
54 Requires the programmer to open the utility.library and initialise
55 UtilityBase.
57 In future releases the buffer size will be set via a taglist.
59 EXAMPLE
61 BOOL Success;
63 ...
65 Success = IsDosEntryA("Work:", LDF_VOLUMES)
66 if (Success == TRUE)
68 ...
71 BUGS
73 SEE ALSO
75 <dos/dosextens.h>
77 INTERNALS
79 HISTORY
81 27-Jul-1997 laguest Initial inclusion into the AROS tree
83 ******************************************************************************/
85 struct DosList *DList;
86 char *DLName;
87 int Position;
88 int Success;
89 BOOL ReturnValue;
90 char Buffer[BUFFER_SIZE + 1];
92 ReturnValue = FALSE;
94 Position = SplitName(Name, ':', &Buffer[0], 0, BUFFER_SIZE + 1);
95 if (Position != -1 && Name[Position] == NULL)
97 DList = AttemptLockDosList(Flags | LDF_READ);
98 if (DList != NULL)
100 DList = NextDosEntry(DList, Flags);
101 while (DList != NULL && ReturnValue == FALSE)
103 DLName = AROS_BSTR_ADDR(DList->dol_Name);
105 Success = Strnicmp(DLName, &Buffer[0], Position - 1);
106 if (Success == 0)
108 ReturnValue = TRUE;
111 DList = NextDosEntry(DList, Flags);
114 UnLockDosList(Flags | LDF_READ);
118 return (ReturnValue);
120 } /* IsDosEntry */