2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <exec/types.h>
9 #include <dos/dosextens.h>
10 #include <dos/datetime.h>
11 #include <proto/dos.h>
14 #define ENTRYTYPESTR(e) ( \
15 e == ST_PIPEFILE ? "ST_PIPEFILE" : \
16 e == ST_LINKFILE ? "ST_LINKFILE" : \
17 e == ST_FILE ? "ST_FILE" : \
18 e == ST_ROOT ? "ST_ROOT" : \
19 e == ST_USERDIR ? "ST_USERDIR" : \
20 e == ST_SOFTLINK ? "ST_SOFTLINK" : \
21 e == ST_LINKDIR ? "ST_LINKDIR" : \
25 int main (int argc
, char **argv
) {
27 struct FileInfoBlock
*fib
;
29 char date
[32], time
[32];
32 printf("usage: %s file\n", argv
[0]);
36 lock
= Lock(argv
[1], SHARED_LOCK
);
38 printf("couldn't open file [%ld]\n", (long)IoErr());
42 fib
= (struct FileInfoBlock
*) AllocDosObject(DOS_FIB
, NULL
);
44 printf("couldn't allocate FileInfoBlock structure\n");
49 if (! Examine(lock
, fib
)) {
50 printf("Examine() failed [%ld]\n", (long)IoErr());
51 FreeDosObject(DOS_FIB
, fib
);
56 printf("fib_DiskKey : 0x%lx\n", fib
->fib_DiskKey
);
57 printf("fib_DirEntryType: %d [%s]\n", (int)fib
->fib_DirEntryType
, ENTRYTYPESTR(fib
->fib_DirEntryType
));
58 printf("fib_FileName : %s\n", fib
->fib_FileName
);
59 printf("fib_Protection : 0x%04x\n", (unsigned)fib
->fib_Protection
);
60 printf("fib_EntryType : %d [%s]\n", (int)fib
->fib_EntryType
, ENTRYTYPESTR(fib
->fib_EntryType
));
61 printf("fib_Size : %d\n", (int)fib
->fib_Size
);
62 printf("fib_NumBlocks : %d\n", (int)fib
->fib_NumBlocks
);
64 dt
.dat_Stamp
= fib
->fib_Date
;
65 dt
.dat_Format
= FORMAT_DOS
;
68 dt
.dat_StrDate
= date
;
69 dt
.dat_StrTime
= time
;
72 printf("fib_Date : %s %s\n", date
, time
);
74 printf("fib_Comment : %s\n", fib
->fib_Comment
);
75 printf("fib_OwnerUID : %d\n", fib
->fib_OwnerUID
);
76 printf("fib_OwnerGID : %d\n", fib
->fib_OwnerGID
);
78 FreeDosObject(DOS_FIB
, fib
);