]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MINICERN/packlib/kernlib/kerngen/ccgen/stati.c
This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / MINICERN / packlib / kernlib / kerngen / ccgen / stati.c
1 /*
2  * $Id$
3  *
4  * $Log$
5  * Revision 1.4  1997/09/02 14:26:39  mclareni
6  * WINNT correction
7  *
8  * Revision 1.3  1997/02/04 17:34:45  mclareni
9  * Merge Winnt and 97a versions
10  *
11  * Revision 1.2  1996/10/11 07:49:51  cernlib
12  * Sgi now has  st_blksize and st_blocks, so store and return these.
13  * Use #else  instead of complicated #if
14  *
15  * Revision 1.1.1.1.2.1  1997/01/21 11:29:44  mclareni
16  * All mods for Winnt 96a on winnt branch
17  *
18  * Revision 1.1.1.1  1996/02/15 17:49:27  mclareni
19  * Kernlib
20  *
21  */
22 #include "kerngen/pilot.h"
23 /*>    ROUTINE STATI
24   CERN PROGLIB# Z265    STATI           .VERSION KERNFOR  4.40  940929
25 C ORIG. 14/03/91, RDM
26   Fortran interface routine to stat
27 */
28 #include <stdio.h>
29 #if defined(CERNLIB_QMVAX)||defined(CERNLIB_QMOS9)
30 #include <types.h>
31 #include <stat.h>
32 #endif
33 #if (!defined(CERNLIB_QMVAX))&&(!defined(CERNLIB_QMOS9))
34 #include <sys/types.h>
35 #include <sys/stat.h>
36 #include "kerngen/fortchar.h"
37 #endif
38 #include "kerngen/fortranc.h"
39 #if defined(CERNLIB_QX_SC)
40 int type_of_call stati_(fname, info, lgname)
41 #endif
42 #if defined(CERNLIB_QXNO_SC)
43 int type_of_call stati(fname, info, lgname)
44 #endif
45 #if defined(CERNLIB_QXCAPT)
46 # ifndef CERNLIB_MSSTDCALL
47     int type_of_call STATI(fname, info, lgname)
48 # else
49     int type_of_call STATI(fname, lfname, info, lgname)
50     int lfname;
51 # endif
52 #endif
53 #if defined(CERNLIB_QMCRY)
54       _fcd  fname;
55 #endif
56 #if !defined(CERNLIB_QMCRY)
57       char *fname;
58 #endif
59       int  *lgname;
60       int  *info;
61 {
62 #ifndef WIN32
63       struct stat *buf;
64 #else
65       struct _stat *buf;
66 #endif
67       char *ptname, *fchtak();
68       int  istat, stat();
69
70       istat  = -1;
71       ptname = fchtak(fname,*lgname);
72       if (ptname == NULL)          goto out1;
73
74 #ifndef WIN32
75       buf = (struct stat *) malloc(sizeof (struct stat));
76 #else
77       buf = (struct _stat *) malloc(sizeof (struct _stat));
78 #endif
79
80       if (buf == NULL)             goto out2;
81
82       istat = stat(ptname, buf);
83
84       if (!istat) {
85          info[0] = (int) buf->st_dev;
86          info[1] = (int) buf->st_ino;
87          info[2] = (int) buf->st_mode;
88          info[3] = (int) buf->st_nlink;
89          info[4] = (int) buf->st_uid;
90          info[5] = (int) buf->st_gid;
91          info[6] = (int) buf->st_size;
92          info[7] = (int) buf->st_atime;
93          info[8] = (int) buf->st_mtime;
94          info[9] = (int) buf->st_ctime;
95 #if defined(CERNLIB_QMDOS)||defined(CERNLIB_QMVAX)||defined(CERNLIB_QMOS9)||defined(CERNLIB_WINNT)
96          info[10] = 0;
97          info[11] = 0;
98 #else
99          info[10] = (int) buf->st_blksize;
100          info[11] = (int) buf->st_blocks;
101 #endif
102        };
103
104       free(buf);
105 out2: free(ptname);
106 out1: return istat;
107
108 }
109 /*> END <----------------------------------------------------------*/