Commit | Line | Data |
---|---|---|
38dbab99 | 1 | /* |
05ec41e3 | 2 | char id_stat[] = "@(#)stat_.c 1.3"; |
38dbab99 DW |
3 | * |
4 | * get file status | |
5 | * | |
6 | * calling sequence: | |
45c46c23 | 7 | * integer stat, statb(12) |
38dbab99 DW |
8 | * call stat (name, statb) |
9 | * where: | |
10 | * 'statb' will receive the stat structure for file 'name'. | |
11 | */ | |
12 | ||
05ec41e3 DW |
13 | #include <sys/param.h> |
14 | #ifndef MAXPATHLEN | |
15 | #define MAXPATHLEN 128 | |
16 | #endif | |
38dbab99 DW |
17 | #include <sys/stat.h> |
18 | #include "../libI77/f_errno.h" | |
19 | ||
20 | long stat_(name, stbuf, namlen) | |
21 | char *name; long *stbuf, namlen; | |
22 | { | |
05ec41e3 | 23 | char buf[MAXPATHLEN]; |
38dbab99 DW |
24 | struct stat statb; |
25 | ||
26 | if (namlen >= sizeof buf) | |
27 | return((long)(errno=F_ERARG)); | |
28 | g_char(name, namlen, buf); | |
29 | if (stat(buf, &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; |
38dbab99 DW |
43 | return(0L); |
44 | } | |
45 | return ((long)errno); | |
46 | } |