|
|
1.1 root 1: #
2: #include "ufs.h"
3: #include "sys/types.h"
4: #include "sys/stat.h"
5: /*
6: * Converts stat command to intermediate form to
7: * decrease filesystem dependency
8: */
9: filstat(name,b)
10: char *name;
11: struct ustat *b;
12: {
13: struct stat s;
14: long l;
15: int i;
16:
17: if(stat(name,&s)<0)
18: return(-1);
19: uconv(&s,b);
20: return(1);
21: }
22: uconv(ip,b)
23: char *ip;
24: struct ustat *b;
25: {
26: long l;
27: int i;
28:
29: b->mode = ip->st_mode&0777;
30: switch(ip->st_mode&S_IFMT){
31: case S_IFDIR:
32: b->type = DIR;
33: break;
34: case S_IFCHR:
35: b->type = CHR;
36: break;
37: case S_IFBLK:
38: b->type = BLK;
39: break;
40: case S_IFREG:
41: b->type = ORDFILE;
42: break;
43: }
44: b->size = ip->st_size;
45: b->uid = ip->st_uid;
46: b->gid = ip->st_gid;
47: b->modtime = ip->st_mtime;
48: b->acctime = ip->st_atime;
49: return(1);
50: }
51: desstat(f,b)
52: char *b;
53: {
54: struct stat s;
55: if(fstat(f,&s)<0)
56: return(-1);
57: uconv(&s,b);
58: return(1);
59: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.