Listtree.mcc: simplify the drag & drop handling by making the listtree object the...
[AROS.git] / test / dos / examinelock.c
blobcc1ccfb01229711cf3f536b303c0ec7eb33ca83d
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <dos/dos.h>
7 #include <proto/dos.h>
8 #include <stdio.h>
10 int main(int argc, char **argv)
12 BPTR fh;
14 if (argc < 2)
16 printf("Usage: %s <file name>\n", argv[0]);
17 return 1;
20 fh = Lock(argv[1], SHARED_LOCK);
22 if (fh != BNULL)
24 struct FileInfoBlock *fib = AllocDosObject(DOS_FIB, NULL);
26 if (fib != NULL)
28 if (Examine(fh, fib))
30 printf("Got FIB:\n");
31 printf("Filename = %s\n" , fib->fib_FileName);
32 printf("Protection = 0x%08X\n", (unsigned)fib->fib_Protection);
34 else
36 printf("Examine() failed, ioerr = %d\n", (int)IoErr());
38 FreeDosObject(DOS_FIB, fib);
40 else
42 printf("couldn't allocate fileinfoblock\n");
45 UnLock(fh);
47 else
49 printf("couldn't lock file\n");
52 return 0;