home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 1.ddi / CLIBSRC1.ZIP / UMASK.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.3 KB  |  50 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - umask.c
  3.  *
  4.  * function(s)
  5.  *    umask - set file read/write permission mask
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #include <io.h>
  18. #include <RtlData.h>
  19.  
  20. #if !defined( _RTLDLL )
  21. extern  unsigned _notUmask;
  22. #endif
  23.  
  24. /*---------------------------------------------------------------------*
  25.  
  26. Name            umask - set file read/write permission mask
  27.  
  28. Usage           #include <io.h>
  29.                 unsigned  umask(unsigned modeMask)
  30.  
  31. Prototype in    io.h
  32.  
  33. Description     Changes the read/write permission mask used for "open"
  34.                 and "creat" calls.
  35.  
  36. Return value    The replaced value of the umask.  There is no error return.
  37.  
  38. Note            "umask" is stored internally in inverted form, for convenience.
  39.  
  40. *---------------------------------------------------------------------*/
  41. unsigned  umask(unsigned modeMask)
  42. {
  43.     register    oldMask;
  44.     _QRTLDataBlock;
  45.  
  46.     oldMask = ~_QRTLInstanceData(_notUmask);
  47.     _QRTLInstanceData(_notUmask) = ~modeMask;
  48.     return (oldMask);
  49. }
  50.