Commit | Line | Data |
---|---|---|
1329e475 | 1 | /* |
45c46c23 | 2 | char id_fstat[] = "@(#)fstat_.c 1.3"; |
1329e475 DW |
3 | * |
4 | * get file status | |
5 | * | |
6 | * calling sequence: | |
45c46c23 | 7 | * integer fstat, statb(12) |
1329e475 DW |
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/f_errno.h" | |
16 | #include "../libI77/fiodefs.h" | |
17 | ||
18 | extern unit units[]; | |
19 | ||
20 | long fstat_(lunit, stbuf) | |
21 | long *lunit, *stbuf; | |
22 | { | |
23 | struct stat statb; | |
24 | ||
25 | if (*lunit < 0 || *lunit >= MXUNIT) | |
abb67f25 | 26 | return((long)(errno=F_ERUNIT)); |
1329e475 DW |
27 | if (!units[*lunit].ufd) |
28 | return((long)(errno=F_ERNOPEN)); | |
29 | if (fstat(fileno(units[*lunit].ufd), &statb) == 0) | |
30 | { | |
31 | *stbuf++ = statb.st_dev; | |
32 | *stbuf++ = statb.st_ino; | |
33 | *stbuf++ = statb.st_mode; | |
34 | *stbuf++ = statb.st_nlink; | |
35 | *stbuf++ = statb.st_uid; | |
36 | *stbuf++ = statb.st_gid; | |
37 | *stbuf++ = statb.st_rdev; | |
38 | *stbuf++ = statb.st_size; | |
39 | *stbuf++ = statb.st_atime; | |
40 | *stbuf++ = statb.st_mtime; | |
41 | *stbuf++ = statb.st_ctime; | |
45c46c23 | 42 | *stbuf++ = statb.st_blksize; |
1329e475 DW |
43 | return(0L); |
44 | } | |
45 | return ((long)errno); | |
46 | } |