]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MINICERN/packlib/kernlib/kerngen/ccgen/accesi.c
Bugfix in AliPoints2Memory
[u/mrichter/AliRoot.git] / MINICERN / packlib / kernlib / kerngen / ccgen / accesi.c
CommitLineData
fe4da5cc 1/*
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.3 1997/10/23 16:25:08 mclareni
6 * NT mods, mostly C Fortran interface
7 *
8 * Revision 1.2 1997/02/04 17:34:13 mclareni
9 * Merge Winnt and 97a versions
10 *
11 * Revision 1.1.1.1.2.1 1997/01/21 11:29:22 mclareni
12 * All mods for Winnt 96a on winnt branch
13 *
14 * Revision 1.1.1.1 1996/02/15 17:49:21 mclareni
15 * Kernlib
16 *
17 */
18#include "kerngen/pilot.h"
19#ifdef CERNLIB_WINNT
20# include <io.h>
21#endif
22/*> ROUTINE ACCESI
23 CERN PROGLIB# Z265 ACCESI .VERSION KERNFOR 4.34 930114
24 ORIG. 06/10/92, RDM + JZ
25 Fortran interface to access
26
27 R_OK 4 test for read permission
28 W_OK 2 test for write permission
29 X_OK 1 test for execute (search) permission
30 F_OK 0 test for presence of file
31
32 accessible = access(path, mode)
33 int accessible;
34 char *path;
35 int mode;
36
37 access checks the given file path for accessibility according to mode,
38 which is an inclusive or of the bits R_OK, W_OK, and X_OK. Specifying
39 mode as F_OK (that is, 0) tests whether the directories leading to the
40 file can be searched and the file exists.
41*/
42#include <stdio.h>
43#include "kerngen/fortchar.h"
44#if defined(CERNLIB_QX_SC)
45int type_of_call accesi_(fname, mode, lgname)
46#endif
47#if defined(CERNLIB_QXNO_SC)
48int type_of_call accesi(fname, mode, lgname)
49#endif
50#if defined(CERNLIB_QXCAPT)
51int type_of_call ACCESI(fname,
52#ifdef CERNLIB_MSSTDCALL
53 lfname,
54#endif
55 mode, lgname)
56#endif
57#ifdef CERNLIB_MSSTDCALL
58 int lfname;
59#endif
60#if defined(CERNLIB_QMCRY)
61 _fcd fname;
62#endif
63#if !defined(CERNLIB_QMCRY)
64 char *fname;
65#endif
66 int *lgname, *mode;
67{
68 char *ptf, *fchtak();
69 int istat, umode;
70
71 istat = -1;
72 ptf = fchtak(fname, *lgname);
73 if (ptf == NULL) goto exit;
74
75 umode = *mode & 7;
76 istat = access(ptf, umode);
77 free(ptf);
78
79exit:
80 return istat;
81}