| 
                Last change
                  on this file since 523 was
                  444,
                  checked in by satin@…, 7 years ago
           | 
        
        
          | 
               
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc 
 
           | 
        
        | 
            File size:
            726 bytes
           | 
      
      
        
  | Line |   | 
|---|
| 1 | /* This is file ACCESS.C */ | 
|---|
| 2 | /* | 
|---|
| 3 |  * Copyright (C) 1993 DJ Delorie | 
|---|
| 4 |  * All rights reserved. | 
|---|
| 5 |  * | 
|---|
| 6 |  * Redistribution, modification, 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 | } | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.