Recommit of r44635:
[AROS.git] / test / fsresource.c
blobc9178fd5377055f8ac70fa31a7bc93a53105463b
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id: fsresource.c $
4 */
6 #include <proto/exec.h>
7 #include <stdio.h>
9 #include <resources/filesysres.h>
11 static void checkpatch(struct FileSysEntry *fse, UBYTE patchid)
13 printf ("%c ", (fse->fse_PatchFlags & (1 << patchid)) ? '*' : ' ');
16 int main(int argc, char **argv)
18 struct FileSysResource *fsr;
20 fsr = OpenResource(FSRNAME);
21 if (fsr)
23 struct FileSysEntry *fse;
24 WORD cnt;
26 printf("FileSysResource at %p\n", fsr);
27 printf("Creator: '%s'\n", fsr->fsr_Creator);
28 printf("\n");
29 cnt = 0;
30 ForeachNode(&fsr->fsr_FileSysEntries, fse)
32 char dostype[5];
33 WORD i;
35 printf("FileSysEntry %d at %p\n", cnt++, fse);
36 for (i = 0; i < 4; i++)
38 dostype[i] = (fse->fse_DosType >> ((3 - i) * 8)) & 0xff;
39 if (dostype[i] < 9)
40 dostype[i] += '0';
41 else if (dostype[i] < 32)
42 dostype[i] = '.';
44 dostype[4] = 0;
45 printf("DOSType : %08lx (%s)\n", (unsigned long)fse->fse_DosType, dostype);
46 printf("Version : %08lx (%d.%d)\n", (unsigned long)fse->fse_Version, (int)(fse->fse_Version >> 16), (int)(fse->fse_Version & 0xffff));
47 printf("PatchFlags : %08lx\n", (unsigned long)fse->fse_PatchFlags);
48 checkpatch(fse, FSEB_TYPE);
49 printf("Type : %08lx\n", (unsigned long)fse->fse_Type);
50 checkpatch(fse, FSEB_TASK);
51 printf("Task : %p\n", (void *)fse->fse_Task);
52 checkpatch(fse, FSEB_LOCK);
53 printf("Lock : %p\n", (APTR)fse->fse_Lock);
54 checkpatch(fse, FSEB_HANDLER);
55 printf("Handler : %p (%s)\n", (APTR)fse->fse_Handler, AROS_BSTR_ADDR(fse->fse_Handler));
56 checkpatch(fse, FSEB_STACKSIZE);
57 printf("StackSize : %u\n", (unsigned int)fse->fse_StackSize);
58 checkpatch(fse, FSEB_PRIORITY);
59 printf("Priority : %d\n", (int)fse->fse_Priority);
60 checkpatch(fse, FSEB_STARTUP);
61 printf("Startup : %p\n", (APTR)fse->fse_Startup);
62 checkpatch(fse, FSEB_SEGLIST);
63 printf("SegList : %p\n", (APTR)fse->fse_SegList);
64 checkpatch(fse, FSEB_GLOBALVEC);
65 printf("GlobalVec : %ld\n", (long)fse->fse_GlobalVec);
66 printf("\n");
68 } else {
69 printf("FileSystem.resource failed to open!\n");
71 return 0;