2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: dos.library function Examine().
8 #include <exec/memory.h>
9 #include <proto/exec.h>
10 #include <dos/filesystem.h>
11 #include <dos/exall.h>
12 #include "dos_intern.h"
14 /*****************************************************************************
17 #include <proto/dos.h>
19 AROS_LH2(BOOL
, Examine
,
22 AROS_LHA(BPTR
, lock
, D1
),
23 AROS_LHA(struct FileInfoBlock
*, fib
, D2
),
26 struct DosLibrary
*, DOSBase
, 17, Dos
)
30 Fill in a FileInfoBlock structure concerning a file or directory
31 associated with a particular lock.
35 lock -- lock to examine
36 fib -- FileInfoBlock where the result of the examination is stored
40 A boolean telling whether the operation was successful or not.
44 FileInfoBlocks should be allocated with AllocDosObject(). You may make
45 a copy of the FileInfoBlock but, however, this copy may NOT be passed
54 Lock(), UnLock(), ExNext(), AllocDosObject(), ExAll(), <dos/dos.h>
58 *****************************************************************************/
60 /*****************************************************************************
63 #include <clib/dos_protos.h>
65 AROS_LH2(BOOL, ExamineFH,
68 AROS_LHA(BPTR , fh, D1),
69 AROS_LHA(struct FileInfoBlock *, fib, D2),
72 struct DosLibrary *, DOSBase, 65, Dos)
90 *****************************************************************************/
91 /*AROS alias ExamineFH Examine */
94 AROS_LIBBASE_EXT_DECL(struct DosLibrary
*,DOSBase
)
97 struct ExAllData
*ead
=(struct ExAllData
*)buffer
;
101 /* Get pointer to filehandle */
102 struct FileHandle
*fh
= (struct FileHandle
*)BADDR(lock
);
104 /* Get pointer to I/O request. Use stackspace for now. */
105 struct IOFileSys iofs
;
107 /* Prepare I/O request. */
108 InitIOFS(&iofs
, FSA_EXAMINE
, DOSBase
);
110 iofs
.IOFS
.io_Device
= fh
->fh_Device
;
111 iofs
.IOFS
.io_Unit
= fh
->fh_Unit
;
113 iofs
.io_Union
.io_EXAMINE
.io_ead
= (struct ExAllData
*)buffer
;
114 iofs
.io_Union
.io_EXAMINE
.io_Size
= sizeof(buffer
);
115 iofs
.io_Union
.io_EXAMINE
.io_Mode
= ED_OWNER
;
117 /* Send the request. */
120 /* Set error code and return */
121 SetIoErr(iofs
.io_DosError
);
127 /* in fib_DiskKey the result from telldir is being stored which
128 gives us important info for a call to ExNext() */
129 fib
->fib_DiskKey
= iofs
.io_DirPos
;
130 fib
->fib_DirEntryType
= ead
->ed_Type
;
133 dst
= fib
->fib_FileName
;
137 for(i
= 0; i
< MAXFILENAMELENGTH
- 1; i
++)
139 if(!(*dst
++ = *src
++))
146 fib
->fib_Protection
= ead
->ed_Prot
;
147 fib
->fib_EntryType
= ead
->ed_Type
;
148 fib
->fib_Size
= ead
->ed_Size
;
149 fib
->fib_Date
.ds_Days
= ead
->ed_Days
;
150 fib
->fib_Date
.ds_Minute
= ead
->ed_Mins
;
151 fib
->fib_Date
.ds_Tick
= ead
->ed_Ticks
;
153 src
= ead
->ed_Comment
;
154 dst
= fib
->fib_Comment
;
158 for(i
= 0; i
< 79; i
++)
160 if(!(*dst
++ = *src
++))
166 fib
->fib_OwnerUID
= ead
->ed_OwnerUID
;
167 fib
->fib_OwnerGID
= ead
->ed_OwnerGID
;