Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

cfstati.c

Go to the documentation of this file.
00001 /*
00002  * $Id: cfstati.c,v 1.2 2009/02/16 08:04:36 schubert Exp $
00003  *
00004  * Revision 1.1.1.1  2002/07/24 15:56:28  rdm
00005  * initial import into CVS
00006  *
00007  * Revision 1.1.1.1  2002/06/16 15:18:46  hristov
00008  * Separate distribution  of Geant3
00009  *
00010  * Revision 1.1.1.1  1999/05/18 15:55:29  fca
00011  * AliRoot sources
00012  *
00013  * Revision 1.5  1997/11/05 11:05:35  mclareni
00014  * Remove malloc and free, which caused optimisation problems on NT; should be faster on Unix too.
00015  *
00016  * Revision 1.4  1997/10/23 16:33:20  mclareni
00017  * NT mods
00018  *
00019  * Revision 1.3  1997/09/02 14:26:47  mclareni
00020  * WINNT correction
00021  *
00022  * Revision 1.2  1997/02/20 16:41:48  gunter
00023  * Mods for WNT; ie. transcribe the mods done to stati.c for WNT.
00024  *
00025  * Revision 1.1  1996/10/16 12:57:35  cernlib
00026  * Add cfstat. cfstati is used by cfstat. This uses rfio_stat if CERNLIB_SHIFT
00027  * is set.
00028  *
00029  * Kernlib
00030  *
00031  */
00032 
00033 #ifdef CERNLIB_WINNT
00034 /*#pragma optimize( "", off ) */
00035 #endif
00036 
00037 #include "kerngen/pilot.h"
00038 /*>    ROUTINE STATI
00039  *  CERN PROGLIB# Z310    CFSTATI
00040  * ORIG. stolen with mods from stati.c, 11-Oct-96; GF.
00041  *  Routine used by cfstat; interface to stat or rfio_stat ( if shift software 
00042  *    is in use)
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 /*> END <----------------------------------------------------------*/

Generated on Mon Feb 15 11:06:31 2010 for loon by  doxygen 1.3.9.1