1 #include <exec/types.h>
4 #include <dos/dosextens.h>
5 #include <dos/datetime.h>
9 #define ENTRYTYPESTR(e) ( \
10 e == ST_PIPEFILE ? "ST_PIPEFILE" : \
11 e == ST_LINKFILE ? "ST_LINKFILE" : \
12 e == ST_FILE ? "ST_FILE" : \
13 e == ST_ROOT ? "ST_ROOT" : \
14 e == ST_USERDIR ? "ST_USERDIR" : \
15 e == ST_SOFTLINK ? "ST_SOFTLINK" : \
16 e == ST_LINKDIR ? "ST_LINKDIR" : \
20 int main (int argc
, char **argv
) {
22 struct FileInfoBlock
*fib
;
24 char date
[32], time
[32];
27 printf("usage: %s file\n", argv
[0]);
31 lock
= Lock(argv
[1], SHARED_LOCK
);
33 printf("couldn't open file [%ld]\n", IoErr());
37 fib
= (struct FileInfoBlock
*) AllocDosObject(DOS_FIB
, NULL
);
39 printf("couldn't allocate FileInfoBlock structure\n");
44 if (! Examine(lock
, fib
)) {
45 printf("Examine() failed [%ld]\n", IoErr());
46 FreeDosObject(DOS_FIB
, fib
);
51 printf("fib_DiskKey : 0x%x\n", fib
->fib_DiskKey
);
52 printf("fib_DirEntryType: %d [%s]\n", fib
->fib_DirEntryType
, ENTRYTYPESTR(fib
->fib_DirEntryType
));
53 printf("fib_FileName : %s\n", fib
->fib_FileName
);
54 printf("fib_Protection : 0x%04x\n", fib
->fib_Protection
);
55 printf("fib_EntryType : %d [%s]\n", fib
->fib_EntryType
, ENTRYTYPESTR(fib
->fib_EntryType
));
56 printf("fib_Size : %d\n", fib
->fib_Size
);
57 printf("fib_NumBlocks : %d\n", fib
->fib_NumBlocks
);
59 dt
.dat_Stamp
= fib
->fib_Date
;
60 dt
.dat_Format
= FORMAT_DOS
;
63 dt
.dat_StrDate
= date
;
64 dt
.dat_StrTime
= time
;
67 printf("fib_Date : %s %s\n", date
, time
);
69 printf("fib_Comment : %s\n", fib
->fib_Comment
);
70 printf("fib_OwnerUID : %d\n", fib
->fib_OwnerUID
);
71 printf("fib_OwnerGID : %d\n", fib
->fib_OwnerGID
);
73 FreeDosObject(DOS_FIB
, fib
);