* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
"@(#) Copyright (c) 1980 Regents of the University of California.\n\
static char sccsid
[] = "@(#)repquota.c 5.1 (Berkeley) %G%";
struct fileusage
*fu_next
;
char fu_name
[LOGINNAMESIZE
+ 1];
struct fileusage
*fuhead
[FUHASH
];
struct fileusage
*lookup();
struct fileusage
*adduid();
struct passwd
*getpwent();
int aflag
; /* all file systems */
char quotafile
[MAXPATHLEN
+ 1];
register struct fstab
*fs
;
register struct passwd
*pw
;
register struct fileusage
*fup
;
char quotafile
[MAXPATHLEN
];
if (argc
> 0 && strcmp(*argv
, "-v") == 0) {
if (argc
> 0 && strcmp(*argv
, "-a") == 0) {
if (argc
<= 0 && !aflag
) {
fprintf(stderr
, "Usage:\n\t%s\n\t%s\n",
"repquota [-v] filesys ...");
while ((pw
= getpwent()) != 0) {
fup
= lookup(pw
->pw_uid
);
fup
= adduid(pw
->pw_uid
);
strncpy(fup
->fu_name
, pw
->pw_name
, sizeof(fup
->fu_name
));
while ((fs
= getfsent()) != NULL
) {
(fs
->fs_type
== 0 || strcmp(fs
->fs_type
, "rq") != 0))
!(oneof(fs
->fs_file
, argv
, argc
) ||
oneof(fs
->fs_spec
, argv
, argc
)))
(void) sprintf(quotafile
, "%s/%s", fs
->fs_file
, qfname
);
errs
+= repquota(fs
->fs_spec
, quotafile
);
for (i
= 0; i
< argc
; i
++)
if ((done
& (1 << i
)) == 0)
fprintf(stderr
, "%s not found in /etc/fstab\n",
register struct fileusage
*fup
;
fprintf(stdout
, "*** Quota report for %s\n", fsdev
);
if (fstat(fileno(qf
), &statb
) < 0) {
if (quota(Q_SYNC
, 0, statb
.st_dev
, 0) < 0 &&
errno
== EINVAL
&& !warned
&& vflag
) {
"*** Warning: Quotas are not compiled into this kernel\n");
fread(&dqbuf
, sizeof(struct dqblk
), 1, qf
);
if (dqbuf
.dqb_curinodes
== 0 && dqbuf
.dqb_curblocks
== 0)
printf(" Block limits File limits\n");
printf("User used soft hard warn used soft hard warn\n");
for (uid
= 0; uid
<= highuid
; uid
++) {
if (fup
->fu_dqblk
.dqb_curinodes
== 0 &&
fup
->fu_dqblk
.dqb_curblocks
== 0)
if (fup
->fu_name
[0] != '\0')
printf("%-10s", fup
->fu_name
);
printf("%c%c%8d%8d%8d %5d %5d %5d %5d %5d\n",
fup
->fu_dqblk
.dqb_bsoftlimit
&&
fup
->fu_dqblk
.dqb_curblocks
>=
fup
->fu_dqblk
.dqb_bsoftlimit
? '+' : '-',
fup
->fu_dqblk
.dqb_isoftlimit
&&
fup
->fu_dqblk
.dqb_curinodes
>=
fup
->fu_dqblk
.dqb_isoftlimit
? '+' : '-',
fup
->fu_dqblk
.dqb_curblocks
/ btodb(1024),
fup
->fu_dqblk
.dqb_bsoftlimit
/ btodb(1024),
fup
->fu_dqblk
.dqb_bhardlimit
/ btodb(1024),
fup
->fu_dqblk
.dqb_curinodes
,
fup
->fu_dqblk
.dqb_isoftlimit
,
fup
->fu_dqblk
.dqb_ihardlimit
,
fup
->fu_dqblk
.dqb_iwarn
);
fup
->fu_dqblk
= zerodqblk
;
if (strcmp(target
, list
[i
]) == 0) {
register struct fileusage
*fup
;
for (fup
= fuhead
[uid
% FUHASH
]; fup
!= 0; fup
= fup
->fu_next
)
return ((struct fileusage
*)0);
struct fileusage
*fup
, **fhp
;
fup
= (struct fileusage
*)calloc(1, sizeof(struct fileusage
));
fprintf(stderr
, "out of memory for fileusage structures\n");
fhp
= &fuhead
[uid
% FUHASH
];