2 Copyright © 1995-2007, 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 */
96 struct ExAllData
*ead
=(struct ExAllData
*)buffer
;
100 /* Get pointer to filehandle */
101 struct FileHandle
*fh
= (struct FileHandle
*)BADDR(lock
);
103 /* Get pointer to I/O request. Use stackspace for now. */
104 struct IOFileSys iofs
;
106 /* Prepare I/O request. */
107 InitIOFS(&iofs
, FSA_EXAMINE
, DOSBase
);
109 iofs
.IOFS
.io_Device
= fh
->fh_Device
;
110 iofs
.IOFS
.io_Unit
= fh
->fh_Unit
;
112 iofs
.io_Union
.io_EXAMINE
.io_ead
= (struct ExAllData
*)buffer
;
113 iofs
.io_Union
.io_EXAMINE
.io_Size
= sizeof(buffer
);
114 iofs
.io_Union
.io_EXAMINE
.io_Mode
= ED_OWNER
;
116 /* Send the request. */
119 /* Set error code and return */
120 SetIoErr(iofs
.io_DosError
);
126 /* in fib_DiskKey the result from telldir is being stored which
127 gives us important info for a call to ExNext() */
128 fib
->fib_DiskKey
= iofs
.io_DirPos
;
129 fib
->fib_DirEntryType
= ead
->ed_Type
;
132 dst
= fib
->fib_FileName
;
136 for(i
= 0; i
< MAXFILENAMELENGTH
- 1; i
++)
138 if(!(*dst
++ = *src
++))
145 fib
->fib_Protection
= ead
->ed_Prot
;
146 fib
->fib_EntryType
= ead
->ed_Type
;
147 fib
->fib_Size
= ead
->ed_Size
;
148 fib
->fib_Date
.ds_Days
= ead
->ed_Days
;
149 fib
->fib_Date
.ds_Minute
= ead
->ed_Mins
;
150 fib
->fib_Date
.ds_Tick
= ead
->ed_Ticks
;
152 src
= ead
->ed_Comment
;
153 dst
= fib
->fib_Comment
;
157 for(i
= 0; i
< 79; i
++)
159 if(!(*dst
++ = *src
++))
165 fib
->fib_OwnerUID
= ead
->ed_OwnerUID
;
166 fib
->fib_OwnerGID
= ead
->ed_OwnerGID
;