date and time created 81/02/18 21:37:15 by dlw
[unix-history] / usr / src / usr.bin / f77 / libU77 / fstat_.c
CommitLineData
1329e475
DW
1/*
2char id_fstat[] = "@(#)fstat_.c 1.1";
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/f_errno.h"
16#include "../libI77/fiodefs.h"
17
18extern unit units[];
19
20long fstat_(lunit, stbuf)
21long *lunit, *stbuf;
22{
23 struct stat statb;
24
25 if (*lunit < 0 || *lunit >= MXUNIT)
26 return((long)(errno=F_ERARG));
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;
42 return(0L);
43 }
44 return ((long)errno);
45}