00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifdef CERNLIB_WINNT
00034
00035 #endif
00036
00037 #include "kerngen/pilot.h"
00038
00039
00040
00041
00042
00043
00044 #include <stdio.h>
00045 #include <stdlib.h>
00046 #if defined(CERNLIB_QMVAX)||defined(CERNLIB_QMOS9)
00047 #include <types.h>
00048 #include <stat.h>
00049 #endif
00050 #if (!defined(CERNLIB_QMVAX))&&(!defined(CERNLIB_QMOS9))
00051 #ifndef WIN32
00052 #include <sys/types.h>
00053 #include <sys/stat.h>
00054 #include "kerngen/cf_xaft.h"
00055 #else
00056 # include <sys\types.h>
00057 # include <sys\stat.h>
00058 #endif
00059 #include "kerngen/fortchar.h"
00060 #endif
00061 #include "kerngen/fortranc.h"
00062 #if defined(CERNLIB_QX_SC)
00063 int type_of_call cfstati_(fname, info, lgname)
00064 #endif
00065 #if defined(CERNLIB_QXNO_SC)
00066 int type_of_call cfstati(fname, info, lgname)
00067 #endif
00068 #if defined(CERNLIB_QXCAPT)
00069 #ifndef CERNLIB_MSSTDCALL
00070 int type_of_call CFSTATI(fname, info, lgname)
00071 #else
00072 int type_of_call CFSTATI(fname, lfname, info, lgname )
00073 int lfname;
00074 #endif
00075 #endif
00076 #if defined(CERNLIB_QMCRY)
00077 _fcd fname;
00078 #endif
00079 #if !defined(CERNLIB_QMCRY)
00080 char *fname;
00081 #endif
00082 int *lgname;
00083 int *info;
00084 {
00085
00086 struct stat buf;
00087 char *ptname, *fchtak();
00088 int istat=-1, stat();
00089
00090 ptname = fchtak(fname,*lgname);
00091 if (ptname == NULL) return -1;
00092
00093
00094 #if defined(CERNLIB_PROJSHIFT)
00095
00096 istat = rfio_stat(ptname, &buf);
00097
00098 #else
00099
00100 istat = stat(ptname, &buf);
00101
00102 #endif
00103
00104 if (!istat) {
00105 info[0] = (int) buf.st_dev;
00106 info[1] = (int) buf.st_ino;
00107 info[2] = (int) buf.st_mode;
00108 info[3] = (int) buf.st_nlink;
00109 info[4] = (int) buf.st_uid;
00110 info[5] = (int) buf.st_gid;
00111 info[6] = (int) buf.st_size;
00112 info[7] = (int) buf.st_atime;
00113 info[8] = (int) buf.st_mtime;
00114 info[9] = (int) buf.st_ctime;
00115 #if defined(CERNLIB_QMDOS)||defined(CERNLIB_QMVAX)||defined(CERNLIB_QMOS9) \
00116 ||defined(CERNLIB_WINNT)
00117 info[10] = 0;
00118 info[11] = 0;
00119 #else
00120 info[10] = (int) buf.st_blksize;
00121 info[11] = (int) buf.st_blocks;
00122 #endif
00123 };
00124
00125 free(ptname);
00126 return istat;
00127
00128 }
00129