OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [machine/] [arm/] [access.c] - Blame information for rev 158

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* This is file ACCESS.C */
2
/*
3
 * Copyright (C) 1993 DJ Delorie
4
 * All rights reserved.
5
 *
6
 * Redistribution and use in source and binary forms is permitted
7
 * provided that the above copyright notice and following paragraph are
8
 * duplicated in all such forms.
9
 *
10
 * This file is distributed WITHOUT ANY WARRANTY; without even the implied
11
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
 */
13
 
14
#include <fcntl.h>
15
#include <sys/stat.h>
16
#include <unistd.h>
17
 
18
int access(const char *fn, int flags)
19
{
20
  struct stat s;
21
  if (stat(fn, &s))
22
    return -1;
23
  if (s.st_mode & S_IFDIR)
24
    return 0;
25
  if (flags & W_OK)
26
  {
27
    if (s.st_mode & S_IWRITE)
28
      return 0;
29
    return -1;
30
  }
31
  return 0;
32
}
33
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.