home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / dos / duplock.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-27  |  2.7 KB  |  128 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: duplock.c,v 1.7 1997/01/27 00:36:17 ldp Exp $
  4.     $Log: duplock.c,v $
  5.     Revision 1.7  1997/01/27 00:36:17  ldp
  6.     Polish
  7.  
  8.     Revision 1.6  1996/12/09 13:53:24  aros
  9.     Added empty templates for all missing functions
  10.  
  11.     Moved #include's into first column
  12.  
  13.     Revision 1.5  1996/10/24 15:50:26  aros
  14.     Use the official AROS macros over the __AROS versions.
  15.  
  16.     Revision 1.4  1996/08/13 13:52:54  digulla
  17.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  18.     Replaced AROS_LA by AROS_LHA
  19.  
  20.     Revision 1.3  1996/08/12 14:20:37  digulla
  21.     Added aliases
  22.  
  23.     Revision 1.2  1996/08/01 17:40:49  digulla
  24.     Added standard header for all files
  25.  
  26.     Desc:
  27.     Lang: english
  28. */
  29. #include <proto/exec.h>
  30. #include "dos_intern.h"
  31.  
  32. /*****************************************************************************
  33.  
  34.     NAME */
  35. #include <proto/dos.h>
  36.  
  37.     AROS_LH1(BPTR, DupLock,
  38.  
  39. /*  SYNOPSIS */
  40.     AROS_LHA(BPTR, lock, D1),
  41.  
  42. /*  LOCATION */
  43.     struct DosLibrary *, DOSBase, 16, Dos)
  44.  
  45. /*  FUNCTION
  46.     Clone a lock on a file or directory. This will only work on shared
  47.     locks.
  48.  
  49.     INPUTS
  50.     lock - Old lock.
  51.  
  52.     RESULT
  53.     The new lock or 0 in case of an error. IoErr() will give additional
  54.     information in that case.
  55.  
  56.     NOTES
  57.     This function is identical to DupLockFromFH().
  58.  
  59.     EXAMPLE
  60.  
  61.     BUGS
  62.  
  63.     SEE ALSO
  64.  
  65.     INTERNALS
  66.  
  67.     HISTORY
  68.     29-10-95    digulla automatically created from
  69.                 dos_lib.fd and clib/dos_protos.h
  70.  
  71. *****************************************************************************/
  72.  
  73. /*****************************************************************************
  74.  
  75.     NAME
  76. #include <clib/dos_protos.h>
  77.  
  78.     AROS_LH1(BPTR, DupLockFromFH,
  79.  
  80.     SYNOPSIS
  81.     AROS_LHA(BPTR, fh, D1),
  82.  
  83.     LOCATION
  84.     struct DosLibrary *, DOSBase, 62, Dos)
  85.  
  86.     FUNCTION
  87.     Try to get a lock on the object selected by the filehandle.
  88.  
  89.     INPUTS
  90.     fh - filehandle.
  91.  
  92.     RESULT
  93.     The new lock or 0 in case of an error. IoErr() will give additional
  94.     information in that case.
  95.  
  96.     NOTES
  97.     This function is identical to DupLock().
  98.  
  99.     EXAMPLE
  100.  
  101.     BUGS
  102.  
  103.     SEE ALSO
  104.  
  105.     INTERNALS
  106.  
  107.     HISTORY
  108.     29-10-95    digulla automatically created from
  109.                 dos_lib.fd and clib/dos_protos.h
  110.  
  111. *****************************************************************************/
  112. /*AROS alias DupLockFromFH DupLock */
  113. {
  114.     AROS_LIBFUNC_INIT
  115.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  116.  
  117.     BPTR old, new;
  118.     struct Process *me=(struct Process *)FindTask(NULL);
  119.  
  120.     /* Use Lock() to clone the handle. cd to it first. */
  121.     old=me->pr_CurrentDir;
  122.     me->pr_CurrentDir=lock;
  123.     new=Lock("",SHARED_LOCK);
  124.     me->pr_CurrentDir=old;
  125.     return new;
  126.     AROS_LIBFUNC_EXIT
  127. } /* DupLock */
  128.