home *** CD-ROM | disk | FTP | other *** search
/ PC Press 1997 July / Sezamfile97_1.iso / msdos / c / cbase11.a03 / CBASE11.ZIP / LSEQ / LSGETLCK.C < prev    next >
C/C++ Source or Header  |  1993-01-01  |  1KB  |  53 lines

  1. /*
  2.  *    Copyright (c) 1989-1992 Citadel Software, Inc.
  3.  *    All Rights Reserved
  4.  */
  5.  
  6. /* #ident    "@(#)lsgetlck.c    1.7 - 93/01/01" */
  7.  
  8. #include <port.h>
  9.  
  10. /* local headers */
  11. #include "lseq_.h"
  12.  
  13. /*man---------------------------------------------------------------------------
  14. NAME
  15.      lsgetlck - get lseq lock status
  16.  
  17. SYNOPSIS
  18.      #include <lseq.h>
  19.  
  20.      int lsgetlck(lsp)
  21.      lseq_t *lsp;
  22.  
  23. DESCRIPTION
  24.      The lsgetlck function reports the lock status of lseq lsp.  The
  25.      function returns the status of the lock currently held by the
  26.      calling process.  Locks held by other processes are not reported.
  27.  
  28.      The possible return values are:
  29.  
  30.           LS_UNLCK     lseq not locked
  31.           LS_RDLCK     lseq locked for reading
  32.           LS_WRLCK     lseq locked for reading and writing
  33.  
  34. SEE ALSO
  35.      lslock.
  36.  
  37. ------------------------------------------------------------------------------*/
  38. #ifdef AC_PROTO
  39. int lsgetlck(lseq_t *lsp)
  40. #else
  41. int lsgetlck(lsp)
  42. lseq_t *lsp;
  43. #endif
  44. {
  45.     if (!(lsp->flags & LSLOCKS)) {
  46.         return LS_UNLCK;
  47.     } else if (lsp->flags & LSWRLCK) {
  48.         return LS_WRLCK;
  49.     }
  50.  
  51.     return LS_RDLCK;
  52. }
  53.