TaggedOpenLibrary constants off by one fix.
[AROS.git] / test / dos / examinelock.c
blob7a6998d5e8dfb5c44a1b09d135df2907fcd0fcae
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 != NULL)
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", fib->fib_Protection);
29 else
31 printf("Examine() failed, ioerr = %d\n", 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;