1: /* 2: char id_fstat[] = "@(#)fstat_.c 1.4"; 3: * 4: * get file status 5: * 6: * calling sequence: 7: * integer fstat, statb(11) 8: * call fstat (name, statb) 9: * where: 10: * 'statb' will receive the stat structure for file 'name'. 11: */ 12: 13: #include <sys/types.h> 14: #include <sys/stat.h> 15: #include "../libI77/fiodefs.h" 16: 17: extern unit units[]; 18: 19: ftnint fstat_(lunit, stbuf) 20: ftnint *lunit, *stbuf; 21: { 22: struct stat statb; 23: 24: if (*lunit < 0 || *lunit >= MXUNIT) 25: return((ftnint)(errno=F_ERUNIT)); 26: if (!units[*lunit].ufd) 27: return((ftnint)(errno=F_ERNOPEN)); 28: if (fstat(fileno(units[*lunit].ufd), &statb) == 0) 29: { 30: *stbuf++ = statb.st_dev; 31: *stbuf++ = statb.st_ino; 32: *stbuf++ = statb.st_mode; 33: *stbuf++ = statb.st_nlink; 34: *stbuf++ = statb.st_uid; 35: *stbuf++ = statb.st_gid; 36: *stbuf++ = statb.st_rdev; 37: *stbuf++ = statb.st_size; 38: *stbuf++ = statb.st_atime; 39: *stbuf++ = statb.st_mtime; 40: *stbuf++ = statb.st_ctime; 41: return((ftnint) 0); 42: } 43: return ((ftnint)errno); 44: }