static char *sccsid
= "@(#)quot.c 4.3 (Berkeley) 82/10/24";
#define ISIZ (MAXBSIZE/sizeof(struct dinode))
#define sblock sb_un.u_sblock
struct dinode itab
[MAXBSIZE
/sizeof(struct dinode
)];
long blocks30
,blocks60
,blocks90
;
struct passwd
*getpwent();
register struct passwd
*lp
;
while((lp
=getpwent()) != 0) {
du
[n
].name
= copy(lp
->pw_name
);
fprintf(stderr
, "usage: df device ...\n");
else if (argv
[0][1]=='f')
else if (argv
[0][1]=='c')
else if (argv
[0][1]=='v')
else if (argv
[0][1]=='h')
printf("cannot open %s\n", file
);
bread(SBLOCK
, (char *)&sblock
, SBSIZE
);
if (isdigit(c
= getchar()))
else while (c
!='\n' && c
!= EOF
)
nfiles
= sblock
.fs_ipg
* sblock
.fs_ncg
;
for (ino
= 0; ino
< nfiles
; ) {
iblk
= fsbtodb(&sblock
, itod(&sblock
, ino
));
bread(iblk
, (char *)itab
, sblock
.fs_bsize
);
for (j
= 0; j
< INOPB(&sblock
) && ino
< nfiles
; j
++) {
register struct dinode
*ip
;
if ((ip
->di_mode
&IFMT
) == 0)
* Assume that there are no holes in files.
blks
= lblkno(&sblock
, ip
->di_size
);
frags
= blks
* sblock
.fs_frag
+
numfrags(&sblock
, dblksize(&sblock
, ip
, blks
));
* Actually go out and count the number of allocated blocks.
printf("Sorry, hard way not implemented yet...\n");
size
= frags
* sblock
.fs_fsize
/ 1024;
if ((ip
->di_mode
&IFMT
)!=IFDIR
&& (ip
->di_mode
&IFMT
)!=IFREG
)
du
[ip
->di_uid
].blocks
+= size
;
#define DAY (60 * 60 * 24) /* seconds per day */
if (now
- ip
->di_atime
> 30 * DAY
)
du
[ip
->di_uid
].blocks30
+= size
;
if (now
- ip
->di_atime
> 60 * DAY
)
du
[ip
->di_uid
].blocks60
+= size
;
if (now
- ip
->di_atime
> 90 * DAY
)
du
[ip
->di_uid
].blocks90
+= size
;
if (scanf("%d", &fino
)<=0)
while ((n
=getchar())!='\n' && n
!=EOF
)
if (np
= du
[ip
->di_uid
].name
)
printf("%d ", ip
->di_uid
);
while ((n
= getchar())==' ' || n
=='\t')
while (n
!=EOF
&& n
!='\n') {
lseek(fi
, (long)bno
*DEV_BSIZE
, 0);
if (read(fi
, buf
, cnt
) != cnt
) {
printf("read error %u\n", bno
);
register struct du
*p1
, *p2
;
if (p1
->blocks
> p2
->blocks
)
if (p1
->blocks
< p2
->blocks
)
return(strcmp(p1
->name
, p2
->name
));
for (i
=0; i
<TSIZE
-1; i
++)
printf("%d %d %D\n", i
, sizes
[i
], t
);
printf("%d %d %D\n", TSIZE
-1, sizes
[TSIZE
-1], overflow
+t
);
qsort(du
, NUID
, sizeof(du
[0]), qcmp
);
printf("%5D\t", du
[i
].blocks
);
printf("%5D\t", du
[i
].nfiles
);
printf("%-8.8s", du
[i
].name
);
printf("#%-8d", du
[i
].uid
);
printf("\t%5D\t%5D\t%5D",
du
[i
].blocks30
, du
[i
].blocks60
, du
[i
].blocks90
);
p
= malloc((unsigned)n
+1);
for(n
=0; p
[n
] = s
[n
]; n
++)