home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Tex / Dvi / shdvi10b.zoo / src / access.c next >
C/C++ Source or Header  |  1990-07-16  |  653b  |  35 lines

  1. /*
  2.  *        Cross Development System for Atari ST 
  3.  *     Copyright (c) 1988, Memorial University of Newfoundland
  4.  *
  5.  * $Header: access.c,v 1.2 90/02/14 20:10:34 rbs$
  6.  *
  7.  * $Log:    access.c,v $
  8.  * Revision 1.1  88/01/29  17:30:49  m68k
  9.  * Initial revision
  10.  * 
  11.  * Version 1.2   90/02/14  20:10:34  rbs
  12.  * Modified for compilation under Turbo C V1.1/V2.0
  13.  */
  14.  
  15. #include <ext.h>
  16. #include <errno.h>
  17. #include <stdio.h>
  18.  
  19. int access(char *path, int mode)
  20. {
  21.  static struct stat statb;
  22.  int i;
  23.  
  24.  if (stat(path, &statb) < 0)
  25.   {
  26.    return -1;
  27.   }
  28.  if ((statb.st_mode & mode) == mode)
  29.   {
  30.    return 0;
  31.   }
  32.  errno = EACCES;
  33.  return -1;
  34. }
  35.