1 #include <exec/types.h>
3 #include <dos/dosextens.h>
4 #include <dos/filesystem.h>
5 #include <proto/exec.h>
9 int main(int argc
, char **argv
) {
10 #ifdef AROS_DOS_PACKETS
14 struct IOFileSys iofs
;
15 struct FileHandle
*fh
;
19 printf("usage: %s path\n", argv
[0]);
23 iofs
.IOFS
.io_Message
.mn_Node
.ln_Type
= NT_REPLYMSG
;
24 iofs
.IOFS
.io_Message
.mn_ReplyPort
= &(((struct Process
*) FindTask(NULL
))->pr_MsgPort
);
25 iofs
.IOFS
.io_Message
.mn_Length
= sizeof(struct IOFileSys
);
26 iofs
.IOFS
.io_Flags
= 0;
28 iofs
.io_Union
.io_OPEN
.io_Filename
= "";
29 iofs
.io_Union
.io_OPEN
.io_FileMode
= FMF_READ
;
32 while ((dvp
= GetDeviceProc(argv
[1], dvp
)) != NULL
) {
33 iofs
.IOFS
.io_Command
= FSA_OPEN
;
34 iofs
.IOFS
.io_Device
= (struct Device
*) dvp
->dvp_Port
;
36 if (dvp
->dvp_Lock
!= NULL
)
37 iofs
.IOFS
.io_Unit
= ((struct FileHandle
*) BADDR(dvp
->dvp_Lock
))->fh_Unit
;
39 iofs
.IOFS
.io_Unit
= dvp
->dvp_DevNode
->dol_Ext
.dol_AROS
.dol_Unit
;
43 if (iofs
.io_DosError
== 0) {
44 fh
= AllocDosObject(DOS_FILEHANDLE
, NULL
);
45 fh
->fh_Device
= iofs
.IOFS
.io_Device
;
46 fh
->fh_Unit
= iofs
.IOFS
.io_Unit
;
48 if (NameFromLock(MKBADDR(fh
), buf
, sizeof(buf
)) == DOSFALSE
) {
49 Fault(IoErr(), NULL
, buf
, sizeof(buf
));
50 printf("found file, but couldn't get lock name: %s\n", buf
);
53 printf("found in: %s\n", buf
);
58 else if (iofs
.io_DosError
!= ERROR_OBJECT_NOT_FOUND
) {
59 Fault(IoErr(), NULL
, buf
, sizeof(buf
));
60 printf("error expanding name: %s\n", buf
);