]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MINICERN/packlib/kernlib/kerngen/ccgencf/cfstati.c
Bugfix in AliPoints2Memory
[u/mrichter/AliRoot.git] / MINICERN / packlib / kernlib / kerngen / ccgencf / cfstati.c
1 /*
2  * $Id$
3  *
4  * $Log$
5  * Revision 1.5  1997/11/05 11:05:35  mclareni
6  * Remove malloc and free, which caused optimisation problems on NT; should be faster on Unix too.
7  *
8  * Revision 1.4  1997/10/23 16:33:20  mclareni
9  * NT mods
10  *
11  * Revision 1.3  1997/09/02 14:26:47  mclareni
12  * WINNT correction
13  *
14  * Revision 1.2  1997/02/20 16:41:48  gunter
15  * Mods for WNT; ie. transcribe the mods done to stati.c for WNT.
16  *
17  * Revision 1.1  1996/10/16 12:57:35  cernlib
18  * Add cfstat. cfstati is used by cfstat. This uses rfio_stat if CERNLIB_SHIFT
19  * is set.
20  *
21  * Kernlib
22  *
23  */
24
25 #ifdef CERNLIB_WINNT
26 /*#pragma optimize( "", off ) */
27 #endif
28
29 #include "kerngen/pilot.h"
30 /*>    ROUTINE STATI
31  *  CERN PROGLIB# Z310    CFSTATI
32  * ORIG. stolen with mods from stati.c, 11-Oct-96; GF.
33  *  Routine used by cfstat; interface to stat or rfio_stat ( if shift software 
34  *    is in use)
35 */
36 #include <stdio.h>
37 #if defined(CERNLIB_QMVAX)||defined(CERNLIB_QMOS9)
38 #include <types.h>
39 #include <stat.h>
40 #endif
41 #if (!defined(CERNLIB_QMVAX))&&(!defined(CERNLIB_QMOS9))
42 #ifndef WIN32
43 #include <sys/types.h>
44 #include <sys/stat.h>
45 #include "kerngen/cf_xaft.h"
46 #else
47 # include <sys\types.h>
48 # include <sys\stat.h>
49 #endif
50 #include "kerngen/fortchar.h"
51 #endif
52 #include "kerngen/fortranc.h"
53 #if defined(CERNLIB_QX_SC)
54 int type_of_call cfstati_(fname, info, lgname)
55 #endif
56 #if defined(CERNLIB_QXNO_SC)
57 int type_of_call cfstati(fname, info, lgname)
58 #endif
59 #if defined(CERNLIB_QXCAPT)
60 #ifndef CERNLIB_MSSTDCALL
61   int type_of_call CFSTATI(fname, info, lgname)
62 #else
63   int type_of_call CFSTATI(fname, lfname, info, lgname )
64   int lfname;
65 #endif
66 #endif
67 #if defined(CERNLIB_QMCRY)
68       _fcd  fname;
69 #endif
70 #if !defined(CERNLIB_QMCRY)
71       char *fname;
72 #endif
73       int  *lgname;
74       int  *info;
75 {
76
77       struct stat buf;
78       char *ptname, *fchtak();
79       int  istat=-1, stat();
80
81       ptname = fchtak(fname,*lgname);
82       if (ptname == NULL) return -1;
83
84
85 #if defined(CERNLIB_PROJSHIFT)
86
87       istat = rfio_stat(ptname, &buf);
88
89 #else
90
91       istat = stat(ptname, &buf);
92
93 #endif
94
95       if (!istat) {
96          info[0] = (int) buf.st_dev;
97          info[1] = (int) buf.st_ino;
98          info[2] = (int) buf.st_mode;
99          info[3] = (int) buf.st_nlink;
100          info[4] = (int) buf.st_uid;
101          info[5] = (int) buf.st_gid;
102          info[6] = (int) buf.st_size;
103          info[7] = (int) buf.st_atime;
104          info[8] = (int) buf.st_mtime;
105          info[9] = (int) buf.st_ctime;
106 #if defined(CERNLIB_QMDOS)||defined(CERNLIB_QMVAX)||defined(CERNLIB_QMOS9) \
107   ||defined(CERNLIB_WINNT)
108          info[10] = 0;
109          info[11] = 0;
110 #else
111          info[10] = (int) buf.st_blksize;
112          info[11] = (int) buf.st_blocks;
113 #endif
114        };
115
116       free(ptname);
117       return istat;
118
119 }
120 /*> END <----------------------------------------------------------*/