2 Copyright © 2008, The AROS Development Team. All rights reserved.
5 Test for OpenFromLock(), NameFromLock(), NameFromFH() and DupLockFromFH().
8 #include <exec/types.h>
9 #include <dos/dosextens.h>
11 #include <proto/exec.h>
12 #include <proto/dos.h>
17 int main(int argc
, char **argv
) {
23 printf("usage: %s filename\n", argv
[0]);
27 lock
= Lock(argv
[1], SHARED_LOCK
);
29 PrintFault(IoErr(), "openfromlock");
33 fh
= OpenFromLock(lock
);
35 PrintFault(IoErr(), "openfromlock");
40 if (NameFromFH(fh
, buffer
, 100))
41 Printf("Name from filehandle: %s\n", buffer
);
44 PutStr("Couldn't get name from file handle.\n");
50 lock
= DupLockFromFH(fh
);
53 PutStr("Couldn't duplicate lock from file handle.\n");
60 if (NameFromLock(lock
, buffer
, 100))
61 Printf("Name from lock: %s\n", buffer
);
63 PutStr("Couldn't get name from lock.\n");