c0c762e419
Gina Verlekar <gina.verlekar@kpitcummins.com> Moving files from libc/sys/sysnecv850 to libgloss/v850 * libgloss/libnosys/configure: Regenerated. * libgloss/libnosys/configure.in: Compact v850 support to v850*-*-*. * libgloss/libnosys/configure: Regenerated. * libgloss/configure.in: Add libgloss support for v850. * libgloss/configure: Regenerated. * libgloss/v850/access.c: New file. * libgloss/v850/aclocal.m4: New. * libgloss/v850/chmod.c: New. * libgloss/v850/chown.c: New. * libgloss/v850/close.c: New. * libgloss/v850/configure: New. * libgloss/v850/configure.in: New. * libgloss/v850/crt0.S: New. * libgloss/v850/crt1.c: New. * libgloss/v850/execv.c: New. * libgloss/v850/execve.c: New. * libgloss/v850/_exit.c: New. * libgloss/v850/fork.c: New. * libgloss/v850/fstat.c: New. * libgloss/v850/getpid.c: New. * libgloss/v850/gettime.c: New. * libgloss/v850/isatty.c: New. * libgloss/v850/kill.c: New. * libgloss/v850/link.c: New. * libgloss/v850/lseek.c: New. * libgloss/v850/Makefile.in: New. * libgloss/v850/open.c: New. * libgloss/v850/pipe.c: New. * libgloss/v850/read.c: New. * libgloss/v850/sbrk.c: New. * libgloss/v850/sim.ld: New. * libgloss/v850/stat.c: New. * libgloss/v850/time.c: New. * libgloss/v850/times.c: New. * libgloss/v850/trap.S: New. * libgloss/v850/unlink.c: New. * libgloss/v850/utime.c: New. * libgloss/v850/wait.c: New. * libgloss/v850/write.c: New.
34 lines
713 B
C
34 lines
713 B
C
/* This is file ACCESS.C */
|
|
/*
|
|
* Copyright (C) 1993 DJ Delorie
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms is permitted
|
|
* provided that the above copyright notice and following paragraph are
|
|
* duplicated in all such forms.
|
|
*
|
|
* This file is distributed WITHOUT ANY WARRANTY; without even the implied
|
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
*/
|
|
|
|
#include <fcntl.h>
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
|
|
int access(const char *fn, int flags)
|
|
{
|
|
struct stat s;
|
|
if (stat(fn, &s))
|
|
return -1;
|
|
if (s.st_mode & S_IFDIR)
|
|
return 0;
|
|
if (flags & W_OK)
|
|
{
|
|
if (s.st_mode & S_IWRITE)
|
|
return 0;
|
|
return -1;
|
|
}
|
|
return 0;
|
|
}
|
|
|