home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 316 / libsrc / access.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-20  |  542 b   |  30 lines

  1. /*
  2.  *        Cross Development System for Atari ST 
  3.  *     Copyright (c) 1988, Memorial University of Newfoundland
  4.  *
  5.  * $Header: access.c,v 1.1 88/01/29 17:30:49 m68k Exp $
  6.  *
  7.  * $Log:    access.c,v $
  8.  * Revision 1.1  88/01/29  17:30:49  m68k
  9.  * Initial revision
  10.  * 
  11.  */
  12. #include    <types.h>
  13. #include    <stat.h>
  14. #include    <errno.h>
  15.  
  16. int
  17. access(path, mode)
  18.     char    *path;
  19.     int    mode;
  20. {
  21.     struct stat    statb;
  22.  
  23.     if (stat(path, &statb) < 0)
  24.         return -1;
  25.     if ((statb.st_mode & mode) == mode)
  26.         return 0;
  27.     errno = EACCESS;
  28.     return -1;
  29. }
  30.