Detabbed
[AROS.git] / rom / dos / duplockfromfh.c
blob544d4db569805c2fdfde9fb7686c0441018554d0
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: dos.library function DupLockFromFH()
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <proto/exec.h>
11 #include "dos_intern.h"
13 /*****************************************************************************
15 NAME */
16 #include <proto/dos.h>
18 AROS_LH1(BPTR, DupLockFromFH,
20 /* SYNOPSIS */
21 AROS_LHA(BPTR, handle, D1),
23 /* LOCATION */
24 struct DosLibrary *, DOSBase, 62, Dos)
26 /* FUNCTION
27 Clone a lock on a file or directory. This will only work on shared
28 locks.
30 INPUTS
31 lock - Old lock.
33 RESULT
34 The new lock or NULL in case of an error. IoErr() will give additional
35 information in that case.
37 NOTES
39 EXAMPLE
41 BUGS
43 SEE ALSO
45 INTERNALS
47 *****************************************************************************/
49 AROS_LIBFUNC_INIT
51 struct FileHandle *fh = BADDR(handle);
52 BPTR ret;
54 if (handle == BNULL)
55 return BNULL;
57 /* Special case for NIL: */
58 if (fh->fh_Type == BNULL) {
59 struct FileLock *fl = AllocMem(sizeof(struct FileLock), MEMF_PUBLIC | MEMF_CLEAR);
60 return MKBADDR(fl);
63 ret = (BPTR)dopacket1(DOSBase, NULL, fh->fh_Type, ACTION_COPY_DIR_FH, fh->fh_Arg1);
64 D(bug("[DupLockFromFH] %x -> %x\n", fh, BADDR(ret)));
65 return ret;
67 AROS_LIBFUNC_EXIT
68 } /* DupLockFromFH */