Fix clipping when rendering a single icon so that it takes the objects dimensions...
[AROS.git] / test / getdeviceproc.c
blob506a5a501b03aa095fd276c7f74f9ea715450f39
1 #include <exec/types.h>
2 #include <dos/dos.h>
3 #include <dos/dosextens.h>
4 #include <dos/filesystem.h>
5 #include <proto/exec.h>
6 #include <proto/dos.h>
7 #include <stdio.h>
9 int main(int argc, char **argv) {
10 struct DevProc *dvp;
11 struct IOFileSys iofs;
12 struct FileHandle *fh;
13 UBYTE buf[256];
15 if (argc != 2) {
16 printf("usage: %s path\n", argv[0]);
17 return 1;
20 iofs.IOFS.io_Message.mn_Node.ln_Type = NT_REPLYMSG;
21 iofs.IOFS.io_Message.mn_ReplyPort = &(((struct Process *) FindTask(NULL))->pr_MsgPort);
22 iofs.IOFS.io_Message.mn_Length = sizeof(struct IOFileSys);
23 iofs.IOFS.io_Flags = 0;
25 iofs.io_Union.io_OPEN.io_Filename = "";
26 iofs.io_Union.io_OPEN.io_FileMode = FMF_READ;
28 dvp = NULL;
29 while ((dvp = GetDeviceProc(argv[1], dvp)) != NULL) {
30 iofs.IOFS.io_Command = FSA_OPEN;
31 iofs.IOFS.io_Device = (struct Device *) dvp->dvp_Port;
33 if (dvp->dvp_Lock != NULL)
34 iofs.IOFS.io_Unit = ((struct FileHandle *) BADDR(dvp->dvp_Lock))->fh_Unit;
35 else
36 iofs.IOFS.io_Unit = dvp->dvp_DevNode->dol_Ext.dol_AROS.dol_Unit;
38 DoIO(&iofs.IOFS);
40 if (iofs.io_DosError == 0) {
41 fh = AllocDosObject(DOS_FILEHANDLE, NULL);
42 fh->fh_Device = iofs.IOFS.io_Device;
43 fh->fh_Unit = iofs.IOFS.io_Unit;
45 if (NameFromLock(MKBADDR(fh), buf, sizeof(buf)) == DOSFALSE) {
46 Fault(IoErr(), NULL, buf, sizeof(buf));
47 printf("found file, but couldn't get lock name: %s\n", buf);
49 else
50 printf("found in: %s\n", buf);
52 Close(MKBADDR(fh));
55 else if (iofs.io_DosError != ERROR_OBJECT_NOT_FOUND) {
56 Fault(IoErr(), NULL, buf, sizeof(buf));
57 printf("error expanding name: %s\n", buf);
58 FreeDeviceProc(dvp);
59 return 1;
63 FreeDeviceProc(dvp);
65 return 0;