diskimage: Compiler delint
[AROS.git] / test / dos / examinelock.c
blob777b7b2420e7e536033efd1920c869df2a0fc430
1 #include <dos/dos.h>
2 #include <proto/dos.h>
3 #include <stdio.h>
5 int main(int argc, char **argv)
7 BPTR fh;
9 if (argc < 2)
11 printf("Usage: %s <file name>\n", argv[0]);
12 return 1;
15 fh = Lock(argv[1], SHARED_LOCK);
17 if (fh != BNULL)
19 struct FileInfoBlock *fib = AllocDosObject(DOS_FIB, NULL);
21 if (fib != NULL)
23 if (Examine(fh, fib))
25 printf("Got FIB:\n");
26 printf("Filename = %s\n" , fib->fib_FileName);
27 printf("Protection = 0x%08X\n", (unsigned)fib->fib_Protection);
29 else
31 printf("Examine() failed, ioerr = %d\n", (int)IoErr());
33 FreeDosObject(DOS_FIB, fib);
35 else
37 printf("couldn't allocate fileinfoblock\n");
40 UnLock(fh);
42 else
44 printf("couldn't lock file\n");
47 return 0;