2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
9 #include <exec/memory.h>
10 #include <exec/tasks.h>
11 #include <exec/execbase.h>
12 #include <exec/devices.h>
13 #include <proto/exec.h>
14 #include <dos/dosextens.h>
15 #include <proto/dos.h>
17 const TEXT version
[] = "$VER: DevList 41.1 (14.3.1997)\n";
29 static int adddev(struct Device
*dev
, struct dev
**l
, STRPTR
*e
)
34 (*l
)->version
= dev
->dd_Library
.lib_Version
;
35 (*l
)->revision
= dev
->dd_Library
.lib_Revision
;
36 (*l
)->opencnt
= dev
->dd_Library
.lib_OpenCnt
;
37 (*l
)->flags
= dev
->dd_Library
.lib_Flags
;
39 s1
= dev
->dd_Library
.lib_Node
.ln_Name
;
48 if(*e
<=(STRPTR
)(*l
+2))
62 static int fillbuffer(struct dev
**buffer
, IPTR size
)
64 STRPTR end
=(STRPTR
)*buffer
+size
;
67 for(dev
=(struct Device
*)SysBase
->DeviceList
.lh_Head
;
68 dev
->dd_Library
.lib_Node
.ln_Succ
!=NULL
;
69 dev
=(struct Device
*)dev
->dd_Library
.lib_Node
.ln_Succ
)
70 if(!adddev(dev
,buffer
,&end
))
79 int __nocommandline
= 1;
84 struct dev
*buffer
,*devs
,*devs2
;
87 for(size
=2048;;size
+=2048)
89 buffer
=AllocVec(size
,MEMF_ANY
);
92 FPuts(Output(),"Not Enough memory for device buffer\n");
96 if(fillbuffer(&devs
,size
))
98 FPuts(Output(),"address\t\tversion\trev\topencnt\tflags\tname\n"
99 "------------------------------------------------------------\n");
100 for(devs2
=buffer
;devs2
<devs
;devs2
++)
103 args
[0] = (IPTR
)devs2
->address
;
104 args
[1] = (IPTR
)devs2
->version
;
105 args
[2] = (IPTR
)devs2
->revision
;
106 args
[3] = (IPTR
)devs2
->opencnt
;
107 args
[4] = (IPTR
)devs2
->flags
;
108 args
[5] = (IPTR
)devs2
->name
;
110 VPrintf("0x%08.lx\t%ld\t%ld\t%ld\t0x%lx\t%s\n", args
);
111 if(SetSignal(0L,SIGBREAKF_CTRL_C
) & SIGBREAKF_CTRL_C
)
114 SetIoErr(ERROR_BREAK
);
123 if (error
!= RETURN_OK
)
125 PrintFault(IoErr(), NULL
);